0

Android scaled Bitmap from RGBA byte array

view story
linux-howto

http://stackoverflow.com – I am well aware that one can manipulate an array of RGBA bytes into a Bitmap as follows: int width = 300; int height = 500; int depth = 4; byte[] img = new byte[height*width*depth]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int shade = (int) ((x/(float)width)*255.0); img[y*(depth*width) + (depth*x)] = (byte) shade; img[y*(depth*width) + (depth*x) + 1] = (byte) shade; img[y*(depth*width) + (depth*x) + 2] = (byte) shade; img[y*(depth*width) + (depth*x) + 3] = (byte) 255; } } Bitmap b = Bitmap.createBitmap(widt (HowTos)