List of usage examples for android.graphics Bitmap getRowBytes
public final int getRowBytes()
From source file:com.haipeng.libraryforandroid.cacheormemory.imageload.ImageCache.java
/** * Get the size in bytes of a bitmap.//from www. jav a 2s. c o m * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (SDKVersionUtil.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.roach.framework.cache.ImageCache.java
/** * Get the size in bytes of a bitmap./*from w ww.ja v a 2 s. co m*/ * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (VersionUtils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.wowcow.chat10.imagecache.ImageCache.java
/** * Get the size in bytes of a bitmap.//from w w w .ja v a2 s. c o m * * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (VersionUtil.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.andreaszeiser.bob.ImageCache.java
/** * Get the size in bytes of a bitmap.//w ww . j a va 2 s. c om * * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (UIUtils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.fivehundredpxdemo.android.storage.ImageCache.java
/** * Get the size in bytes of a bitmap.// w w w . ja v a 2s. c o m * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.fireplace.market.fads.util.ImageCache.java
/** * Get the size in bytes of a bitmap.//from w w w. j a v a 2s. c om * * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (Fireplace.IS_HONEYCOMB_MR1) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.crazyapk.util.bitmap.ImageCache.java
/** * Get the size in bytes of a bitmap.//from w w w. ja v a 2 s. c o m * * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { // if (Utils.hasHoneycombMR1()) { // return bitmap.getByteCount(); // } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.example.image.ImageCache.java
/** * Get the size in bytes of a bitmap.//from ww w .j a v a 2s . c o m * @param bitmap * @return size in bytes */ // @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { // if (VersionUtils.hasHoneycombMR1()) { // return bitmap.getByteCount(); // } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:android.support.asy.image.ImageCache.java
/** * Get the size in bytes of a bitmap./*ww w .j a v a2 s.co m*/ * * @param bitmap * @return size in bytes */ public static int getBitmapSize(Bitmap bitmap) { // if (Utils.hasHoneycombMR1()) { // return bitmap.getByteCount(); // } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:Main.java
public static Double getBitmapsize(Bitmap bitmap, int sizeType) { long fileS = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { // fileS = bitmap.getByteCount(); Bitmap.Config config = bitmap.getConfig(); if (config == Bitmap.Config.RGB_565 || config == Bitmap.Config.ARGB_4444) { fileS = bitmap.getWidth() * bitmap.getHeight() * 2; } else if (config == Bitmap.Config.ALPHA_8) { fileS = bitmap.getWidth() * bitmap.getHeight(); } else if (config == Bitmap.Config.ARGB_8888) { fileS = bitmap.getWidth() * bitmap.getHeight() * 4; }//from w w w. j a v a 2 s . c o m } else { fileS = bitmap.getRowBytes() * bitmap.getHeight();// Pre HC-MR1 } DecimalFormat df = new DecimalFormat("#.00"); double fileSizeLong = 0; switch (sizeType) { case SIZETYPE_B: fileSizeLong = Double.valueOf(df.format((double) fileS)); break; case SIZETYPE_KB: fileSizeLong = Double.valueOf(df.format((double) fileS / 1024)); break; case SIZETYPE_MB: fileSizeLong = Double.valueOf(df.format((double) fileS / 1048576)); break; case SIZETYPE_GB: fileSizeLong = Double.valueOf(df.format((double) fileS / 1073741824)); break; default: break; } return fileSizeLong; }