Java Code Examples for android.graphics.Bitmap.Config#ARGB_4444
The following examples show how to use
android.graphics.Bitmap.Config#ARGB_4444 .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PLUtils.java From PanoramaGL with Apache License 2.0 | 6 votes |
/**conversion methods*/ public static Bitmap.Config convertTextureColorFormatToBitmapConfig(PLTextureColorFormat colorFormat) { Bitmap.Config config = Config.ARGB_8888; switch(colorFormat) { case PLTextureColorFormatRGB565: config = Config.RGB_565; break; case PLTextureColorFormatRGBA4444: config = Config.ARGB_4444; break; default: break; } return config; }
Example 2
Source File: PLUtils.java From panoramagl with Apache License 2.0 | 6 votes |
/** * conversion methods */ public static Config convertTextureColorFormatToBitmapConfig(PLTextureColorFormat colorFormat) { Config config = Config.ARGB_8888; switch (colorFormat) { case PLTextureColorFormatRGB565: config = Config.RGB_565; break; case PLTextureColorFormatRGBA4444: config = Config.ARGB_4444; break; default: break; } return config; }
Example 3
Source File: ImageCache.java From graphics-samples with Apache License 2.0 | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * * @param config The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 4
Source File: ImageCache.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * * @param config * The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 5
Source File: ImageCache.java From RoMote with Apache License 2.0 | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * @param config The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 6
Source File: ImageCache.java From malevich with MIT License | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * @param config The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 7
Source File: Cache.java From tns-core-modules-widgets with Apache License 2.0 | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * * @param config The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 8
Source File: AndroidGraphics.java From Alite with GNU General Public License v3.0 | 5 votes |
public Pixmap newPixmap(Bitmap bitmap, String fileName) { PixmapFormat format; float newWidth = bitmap.getWidth(); float newHeight = bitmap.getHeight(); int textureWidth = determineTextureSize((int) newWidth); int textureHeight = determineTextureSize((int) newHeight); float tx2 = (float) newWidth / (float) textureWidth; float ty2 = (float) newHeight / (float) textureHeight; Bitmap scaledBitmap = Bitmap.createBitmap(textureWidth, textureHeight, bitmap.getConfig()); float ratioX = newWidth / (float) bitmap.getWidth(); float ratioY = newHeight / (float) bitmap.getHeight(); float middleX = newWidth / 2.0f; float middleY = newHeight / 2.0f; Matrix scaleMatrix = new Matrix(); scaleMatrix.setScale(ratioX, ratioY, middleX, middleY); Canvas canvas = new Canvas(scaledBitmap); canvas.setMatrix(scaleMatrix); canvas.drawBitmap(bitmap, middleX - bitmap.getWidth() / 2, middleY - bitmap.getHeight() / 2, new Paint(Paint.FILTER_BITMAP_FLAG)); MemUtil.freeBitmap(bitmap); bitmap = scaledBitmap; if (bitmap.getConfig() == Config.RGB_565) { format = PixmapFormat.RGB565; } else if (bitmap.getConfig() == Config.ARGB_4444) { format = PixmapFormat.ARGB4444; } else { format = PixmapFormat.ARGB8888; } AndroidPixmap pm = new AndroidPixmap(bitmap, format, fileName, textureManager, (int) newWidth, (int) newHeight, tx2, ty2); return pm; }
Example 9
Source File: ImageCache.java From BubbleCloudView with MIT License | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * @param config The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 10
Source File: ImageCache.java From android-DisplayingBitmaps with Apache License 2.0 | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * @param config The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 11
Source File: ImageProvider.java From cube-sdk with Apache License 2.0 | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * * @param config The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 12
Source File: ImageCache.java From vocefiscal-android with Apache License 2.0 | 5 votes |
/** * Return the byte usage per pixel of a bitmap based on its configuration. * @param config The bitmap configuration. * @return The byte usage per pixel. */ private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; }
Example 13
Source File: BitmapUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static Bitmap addBitmap(ArrayList<Integer> listResId, int lineNum, int columnNum, Context context) { // 等分图片的处理 // System.gc(); // BitmapFactory.Options bfOptions=new BitmapFactory.Options(); // bfOptions.inTempStorage=new byte[12 * 1024 * 1024]; BitmapFactory.Options bfOptions = new BitmapFactory.Options(); bfOptions.inTempStorage = new byte[2 * 1024 * 1024]; bfOptions.inPreferredConfig = Config.ARGB_4444; Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), listResId.get(0), bfOptions); int width = bmp.getWidth() * lineNum; int height = bmp.getHeight() * columnNum; // int width = bmp.getWidth() ; // int height = bmp.getHeight(); bmp.recycle(); bmp = null; // System.gc(); Bitmap result = Bitmap.createBitmap(width, height, Config.ARGB_4444); Canvas canvas = new Canvas(result); int flag = 0; float left = 0, top = 0; for (int line = 0; line < lineNum; line++) { for (int column = 0; column < columnNum; column++) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inTempStorage = new byte[2 * 1024 * 1024]; options.inPreferredConfig = Config.ARGB_4444; Bitmap bmpTemp = BitmapFactory.decodeResource( context.getResources(), listResId.get(flag), options); canvas.drawBitmap(bmpTemp, left, top, null); left += bmpTemp.getWidth(); flag++; if (column == columnNum - 1) { left = 0; top += bmpTemp.getHeight(); } } } // canvas.drawBitmap(second, first.getWidth(), 0, null); return result; // // Bitmap bitmap = Bitmap // .createBitmap( // drawable.getIntrinsicWidth(), // drawable.getIntrinsicHeight(), // drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 // : Bitmap.Config.RGB_565); // Canvas canvas = new Canvas(bitmap); // // canvas.setBitmap(bitmap); // drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), // drawable.getIntrinsicHeight()); // drawable.draw(canvas); // return bitmap; }