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:com.chanlytech.unicorn.cache.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat)
 * onward this returns the allocated memory size of the bitmap which can be larger than the
 * actual bitmap data byte count (in the case it was re-used).
 *
 * @param value//from  w w w. j av  a  2  s.com
 *
 * @return size in bytes
 */
@TargetApi(Build.VERSION_CODES.KITKAT)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be
    // larger than bitmap byte count.
    if (AndroidVersion.hasKitKat()) {
        return bitmap.getAllocationByteCount();
    }

    if (AndroidVersion.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }

    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:com.higgses.griffin.cache.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat)
 * onward this returns the allocated memory size of the bitmap which can be larger than the
 * actual bitmap data byte count (in the case it was re-used).
 *
 * @param value/* w ww . j av  a  2 s  .c  om*/
 *
 * @return size in bytes
 */
@TargetApi(Build.VERSION_CODES.KITKAT)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be
    // larger than bitmap byte count.
    if (GriUAndroidVersion.hasKitKat()) {
        return bitmap.getAllocationByteCount();
    }

    if (GriUAndroidVersion.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }

    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:us.happ.bitmap.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable.
 * @param value//from  w w  w .j a  v  a2s. c o m
 * @return size in bytes
 */
@TargetApi(12)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    if (Happ.hasHoneycombMR1) {
        return bitmap.getByteCount();
    }
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:cn.com.wo.bitmap.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable.
 * @param value//from  w w  w  .  jav  a  2  s . c o  m
 * @return size in bytes
 */
@TargetApi(12)
public static int getBitmapSize(BitmapDrawable value) {
    if (value == null)
        return 0;
    Bitmap bitmap = value.getBitmap();

    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:com.wetrain.client.customviews.imagecache.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable.
 * @param value/*from w  w  w  .j a v a  2s  .c om*/
 * @return size in bytes
 */
@TargetApi(12)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    if (Utills.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:com.afrozaar.jazzfestreporting.util.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable.
 *
 * @param value//  w  w  w.jav  a2 s. c  om
 * @return size in bytes
 */
@TargetApi(12)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    if (Utils.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:com.androidsx.imagesearch.util.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable.
 * @param value//from  w w w.  ja  v a  2s .co m
 * @return size in bytes
 */
@TargetApi(12)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    if (Platform.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:com.tsu.common.image.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable.
 * @param value/*from w  w  w  .ja va 2s  .  com*/
 * @return size in bytes
 */
@TargetApi(12)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    if (VersionUtils.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:com.android.volley.cache.MemLruImageCache.java

/**
 * Get the size in bytes of a bitmap./*  w  w w  .j a v  a  2s.  c o  m*/
 */
@TargetApi(19)
public static int getBitmapSize(Bitmap bitmap) {
    // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be
    // larger than bitmap byte count.
    /*      if (Utils.hasKitKat()) {
    return bitmap.getAllocationByteCount();
          }*/

    if (Utils.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }

    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:org.iisgcp.waterwalk.utils.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat)
 * onward this returns the allocated memory size of the bitmap which can be larger than the
 * actual bitmap data byte count (in the case it was re-used).
 *
 * @param value/*from ww w . j  ava  2  s .  c o m*/
 * @return size in bytes
 */
@TargetApi(12)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    if (Utils.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }

    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}