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:Main.java

public static int getSize(Bitmap bm) {
    return bm.getRowBytes() * bm.getHeight();
}

From source file:Main.java

public static int sizeofBitmap(Bitmap value) {
    return value.getRowBytes() * value.getHeight();
}

From source file:Main.java

public static int getBitmapSize(Bitmap bitmap) {
    return bitmap.getRowBytes() * bitmap.getHeight() / 1024;
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static void openLrucache() {

    lruCache = new LruCache<String, Bitmap>((int) Runtime.getRuntime().maxMemory() / 8) {
        @Override//from   w w w .j av a  2 s.  c o  m
        protected int sizeOf(String key, Bitmap value) {

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

From source file:Main.java

private static void checkBitmapCache() {
    if (bitmapCache == null) {
        bitmapCache = new LruCache<String, Bitmap>((int) Runtime.getRuntime().maxMemory() / 8) {
            @Override/*from  w  w  w  .j  av a2s  . c  om*/
            protected int sizeOf(String key, Bitmap bitmap) {
                return bitmap.getRowBytes() * bitmap.getHeight();
            }
        };
    }
}

From source file:Main.java

public static InputStream bitmapToInputStream(Bitmap bitmap) {
    int size = bitmap.getHeight() * bitmap.getRowBytes();
    ByteBuffer buffer = ByteBuffer.allocate(size);
    bitmap.copyPixelsToBuffer(buffer);//from  w  ww  .java2s. c  om
    return new ByteArrayInputStream(buffer.array());
}