java - bitmap set pixel/pixels does not work -


    textview loadingtext = (textview)findviewbyid(r.id.loadingtext);     loadingtext.settextsize(36);     loadingtext.settext("morphing...");     bitmap leftbm = ((bitmapdrawable)leftimage.getdrawable()).getbitmap();     bitmap rightbm = ((bitmapdrawable)rightimage.getdrawable()).getbitmap();       bitmap newbm = leftbm.copy(bitmap.config.alpha_8, true);     int[] pixels = new int[newbm.getheight() * newbm.getwidth()];     newbm.getpixels(pixels, 0, newbm.getwidth(), 0, 0, newbm.getwidth(), newbm.getheight());      if (!newbm.ismutable()) {         log.d("mutable check", "" + newbm.ismutable());         return;     }      (int = 0; < newbm.getwidth(); i++) {         (int j = 0; j < newbm.getheight(); j++) {             newbm.sethasalpha(false);             newbm.setpixel(i, j, color.rgb(0, 0, 255));         }     }      loadingtext.clearcomposingtext();     ((imageview)findviewbyid(r.id.morphview)).setimagebitmap(newbm); 

this code button click method in main activity. ever outputs black image. have done both alpha , without, or using set pixel or set pixels. getting same result.

edit: problem using wrong configuration when using copy method (which using mutable bitmap of image) need alpha_8888 not alpha_8.

its format. set alpha_8. format stores alpha, no color data. user argb_8888 instead- 8 bits per color channel , 8 bit alpha.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -