List of usage examples for android.graphics Bitmap getConfig
public final Config getConfig()
From source file:Main.java
private static Bitmap.Config getSafeConfig(Bitmap bitmap) { return bitmap.getConfig() != null ? bitmap.getConfig() : Bitmap.Config.ARGB_8888; }
From source file:Main.java
private static Config getConfig(Bitmap bitmap) { Config config = bitmap.getConfig(); return config == null ? Config.ARGB_8888 : config; }
From source file:Main.java
public static Bitmap ensureGLCompatibleBitmap(Bitmap bitmap) { if (bitmap == null || bitmap.getConfig() != null) return bitmap; Bitmap newBitmap = bitmap.copy(Config.ARGB_8888, false); bitmap.recycle();//from w w w .j a v a 2 s. c o m return newBitmap; }
From source file:Main.java
private static Bitmap.Config getConfig(final Bitmap bitmap) { Bitmap.Config config = bitmap.getConfig(); if (config == null) { config = Bitmap.Config.RGB_565;// w ww . j av a 2 s . c om } return config; }
From source file:Main.java
private static Config getConfig(Bitmap bitmap) { Config config = bitmap.getConfig(); if (config == null) { config = Config.ARGB_8888;/* www .ja v a2 s. c o m*/ } return config; }
From source file:Main.java
private static Bitmap.Config getConfig(Bitmap bitmap) { Bitmap.Config config = bitmap.getConfig(); if (config == null) { config = Bitmap.Config.ARGB_8888; }/*from www. ja va 2 s . c o m*/ return config; }
From source file:Main.java
private static Bitmap.Config getConfig(final Bitmap bitmap) { Bitmap.Config config = bitmap.getConfig(); if (config == null) { config = Bitmap.Config.ARGB_8888; }//from w w w . ja v a 2 s . c o m return config; }
From source file:Main.java
public static Bitmap changeBitmapColor(Bitmap bmp, int color) { Bitmap b = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), bmp.getConfig()); Canvas canvas = new Canvas(b); Paint paint = new Paint(); paint.setColor(color);//from w w w. j av a2 s .com paint.setAntiAlias(true); canvas.drawBitmap(bmp, bmp.getWidth(), bmp.getHeight(), paint); return b; }
From source file:Main.java
public static Bitmap converttoBitmap565(Bitmap b) { if (b == null) { return null; }//from w w w . jav a 2 s . c o m if (b.getConfig() == Bitmap.Config.RGB_565) { return b; } Bitmap b565 = Bitmap.createBitmap(b.getWidth(), b.getHeight(), Bitmap.Config.RGB_565); Canvas c = new Canvas(b565); c.drawBitmap(b, 0, 0, null); return b565; }
From source file:Main.java
/** * Expand the bitmap to the specified scale. * * @param bitmap to expand./* w w w .j av a2s . co m*/ * @param scale the expand scale, must be > 1.0. * @return the expanded bitmap. */ public static Bitmap expand(Bitmap bitmap, float scale) { if (scale <= 1.0f) { return bitmap.copy(bitmap.getConfig(), false); } Matrix matrix = new Matrix(); matrix.postScale(scale, scale); return Bitmap.createBitmap(bitmap, 0, 0, (int) (scale * bitmap.getWidth()), (int) (scale * bitmap.getHeight()), matrix, true); }