Example usage for android.graphics Bitmap getRowBytes

List of usage examples for android.graphics Bitmap getRowBytes

Introduction

In this page you can find the example usage for android.graphics Bitmap getRowBytes.

Prototype

public final int getRowBytes() 

Source Link

Document

Return the number of bytes between rows in the bitmap's pixels.

Usage

From source file:info.wncwaterfalls.app.grid.MemoryCache.java

public static final int getByteCount(Bitmap bitmap) {
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:com.onemorecastle.util.ImageCache.java

private static synchronized LruCache<String, Bitmap> getBitmapCache() {
    if (bitmapCache == null) {
        bitmapCache = new LruCache<String, Bitmap>(cacheSize) {
            protected int sizeOf(String key, Bitmap value) {
                return (value.getRowBytes() * value.getHeight());
            }//from  w  w w  .j  a v  a 2  s.  c  om
        };
    }
    return (bitmapCache);
}

From source file:Main.java

public static int getBitmapSize(Bitmap bitmap) {
    if (bitmap == null)
        return 0;
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:Main.java

public static int getBitmapSize(Bitmap bitmap) {
    if (null == bitmap) {
        return 0;
    }/*w  w w .  j  a  v  a  2 s  .  com*/

    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public static int sizeOf(Bitmap data) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
        return data.getRowBytes() * data.getHeight();
    } else {//from w  w  w  .j av  a  2  s  . c o  m
        return data.getByteCount();
    }
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.KITKAT)
public static int sizeOf(Bitmap data) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
        return data.getRowBytes() * data.getHeight();
    } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        return data.getByteCount();
    } else {//from w  w w.  j  a  v a2  s.co  m
        return data.getAllocationByteCount();
    }
}

From source file:Main.java

/**
 * TODO doc/* w ww  .java2s . c o  m*/
 *
 * @param data
 * @return
 */
private static int byteSizeOf(Bitmap data) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
        return data.getRowBytes() * data.getHeight();
    } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        return data.getByteCount();
    } else {
        return data.getAllocationByteCount();
    }
}

From source file:Main.java

/**
 * Method to get the number of bytes of the source Bitmap.
 *
 * @param source The source Bitmap.//from   w w  w .  j a  v  a  2s .  c o m
 * @return The number of bytes of the source Bitmap.
 */
private static int byteSizeOf(Bitmap source) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
        return source.getRowBytes() * source.getHeight();
    } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        return source.getByteCount();
    } else {
        return source.getAllocationByteCount();
    }
}

From source file:com.example.android.uamp.AlbumArtCache.java

private static int getSizeInBytes(Bitmap bitmap) {
    return bitmap.getRowBytes() * bitmap.getHeight();

}

From source file:Main.java

public static int getSizeInBytes(Bitmap bitmap) {
    if (android.os.Build.VERSION.SDK_INT >= 12) {
        return bitmap.getByteCount();
    } else {// ww w  .  java 2 s. c  o m
        return bitmap.getRowBytes() * bitmap.getHeight();
    }
}