android - Generated Bitmap has only zero values -


i'm trying decode byte array bitmap used in android. byte array use decoding generated opengl conmmand named glreadpixels , data inside correct.

    mainactivity.datainputstream.readfully(image, 0,256 * 256 * 4);  //converting rgba argb     (int = 0; < image.length - 1; = + 4) {         aux = (image[i + 3] & 0xff);     intimage[i + 3] = (int) (image[i + 2] & 0xff);     intimage[i + 2] = (int) (image[i + 1] & 0xff);     intimage[i + 1] = (int) (image[i] & 0xff);     intimage[i] = aux;      } 

if :bmp = bitmap.createbitmap(intimage, 256, 256,config.argb_8888); or this:

bmp = bitmap.createbitmap(256, 256, config.argb_8888); bmp.setpixels(intimage, 0, 256, 0, 0, 256, 256); ,

the resulted bitmap have 0 values.

can please tell me why ?

bitmap.createbitmap expecting array of 256*256 size, , giving 256*256*4, , therefore giving 1 part , looks this, 0x000000ff .. 0x000000rr, 0x000000gg, if understand mean.

change argb function in this

int[] imageargb = new int[256 * 256];  for(int = 0; < imageargb.length, i++){     imageargb[i] = color.argb(youralpha, rr, gg, bb); } 

hope helps , enjoy work


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -