Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // You are using RGBA that's why Config is ARGB.8888
- bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
- // vector is your int[] of ARGB
- bitmap.copyPixelsFromBuffer(IntBuffer.wrap(vector));
- //OR , you can generate IntBuffer from following native method
- /*private IntBuffer makeBuffer(int[] src, int n) {
- IntBuffer dst = IntBuffer.allocate(n*n);
- for (int i = 0; i < n; i++) {
- dst.put(src);
- }
- dst.rewind();
- return dst;
- }*/
- int[] array = your array of pixels here...
- int width = width of "array"...
- int height = height of "array"...
- // Create bitmap
- Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- // Set the pixels
- bitmap.setPixels(array, 0, width, 0, 0, width, height);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement