List of usage examples for android.graphics Bitmap getRowBytes
public final int getRowBytes()
From source file:com.conferenceengineer.android.iosched.util.BitmapCache.java
/** * Get the size in bytes of a bitmap.//from w ww . j av a 2s . c o m */ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static int getBitmapSize(Bitmap bitmap) { if (UIUtils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.android.volley.cache.BitmapCache.java
/** * Get the size in bytes of a bitmap./* w w w . ja v a2 s .c om*/ */ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static int getBitmapSize(Bitmap bitmap) { if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.likou.util.BitmapCache.java
/** * Get the size in bytes of a bitmap./*w ww. j a v a 2s . c om*/ */ // @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static int getBitmapSize(Bitmap bitmap) { // if (NetUtils.hasHoneycombMR1()) { // return bitmap.getByteCount(); // } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:Main.java
/** * Load bitmap from resources/* w ww . ja v a 2 s. c o m*/ * * @param resources resource * @param drawableId resource image id * @param imgH destination image height * @param imgW destination image width * @return */ public static Bitmap loadHugeBitmapFromDrawable(Resources resources, int drawableId, int imgH, int imgW) { Log.d(TAG, "imgH:" + imgH + " imgW:" + imgW); BitmapFactory.Options options = new BitmapFactory.Options(); //preload set inJustDecodeBounds true, this will load bitmap into memory options.inJustDecodeBounds = true; //options.inPreferredConfig = Bitmap.Config.ARGB_8888;//default is Bitmap.Config.ARGB_8888 BitmapFactory.decodeResource(resources, drawableId, options); //get the image information include: height and width int height = options.outHeight; int width = options.outWidth; String mimeType = options.outMimeType; Log.d(TAG, "width:" + width + " height:" + height + " mimeType:" + mimeType); //get sample size int sampleSize = getScaleInSampleSize(width, height, imgW, imgH); options.inSampleSize = sampleSize; // Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; Log.d(TAG, "memory size:" + getBitmapSizeInMemory(width / sampleSize, height / sampleSize)); Bitmap bitmap = BitmapFactory.decodeResource(resources, drawableId, options); Log.d(TAG, "w=" + bitmap.getWidth() + " h=" + bitmap.getHeight() + " bitmap size:" + bitmap.getRowBytes() * bitmap.getHeight()); return bitmap; }
From source file:so.contacts.hub.basefunction.imageloader.DataCache.java
/** * Get the size in bytes of a bitmap. Bitmapbyte? * // w w w . j a v a 2 s . c o m * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (CacheUtils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:id.wibisana.priadimulia.imagecaching.cache.ImageCache.java
@TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { return bitmap.getByteCount(); }//ww w. j a v a 2 s. c o m return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.ttoview.nakayosi.ttoview.util.picker.image.ImageCache.java
@TargetApi(VERSION_CODES.KITKAT) public static int getBitmapSize(RecyclingBitmapWrapper value) { Bitmap bitmap = value.getBitmap(); // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be // larger than bitmap byte count. if (Utils.hasKitKat()) { return bitmap.getAllocationByteCount(); }/*from w ww . j a va 2 s . c om*/ if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.airad.zhonghan.ui.components.ImageCache.java
/** * Get the size in bytes of a bitmap./* w ww . j a v a 2 s . c om*/ * * @param bitmap * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.msx7.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 */ public static int getBitmapSize(Bitmap bitmap) { return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.intelerad.android.portal.ImageCache.java
/** * Get the size in bytes of a bitmap./*ww w . j a v a2s. c om*/ */ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static int getBitmapSize(Bitmap bitmap) { if (UiUtils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }