List of usage examples for android.util Config equals
public boolean equals(Object obj)
From source file:Main.java
/** * //from w ww. ja v a 2 s . c o m * @return Bitmap's RGBA byte array */ public static byte[] getImageRGBA(Bitmap inputBitmap) { Config config = inputBitmap.getConfig(); ByteBuffer buffer; Bitmap bitmap; /** * if bitmap size is not 32*32 create scaled bitmap */ if (inputBitmap.getWidth() != 32 || inputBitmap.getHeight() != 32) { Log.d(TAG, "bitmap resized to 32x32"); bitmap = Bitmap.createScaledBitmap(inputBitmap, 32, 32, false); } else { bitmap = inputBitmap; } /** * if bitmap is not ARGB_8888 format, copy bitmap with ARGB_8888 format */ if (!config.equals(Bitmap.Config.ARGB_8888)) { Bitmap bitmapARBG = bitmap.copy(Bitmap.Config.ARGB_8888, false); buffer = ByteBuffer.allocate(bitmapARBG.getByteCount()); bitmapARBG.copyPixelsToBuffer(buffer); bitmapARBG.recycle(); } else { buffer = ByteBuffer.allocate(bitmap.getByteCount()); bitmap.copyPixelsToBuffer(buffer); } return buffer.array(); }