android - canvas.drawBitmap() only honors alpha layer when it is 0 -


i loading png resources bitmapfactory.decoderesource , drawing them on canvas using drawbitmap().

i draw different layers 1 @ time transparent objects should occlude supposed to, when have alpha levels in pngs above 0 seem ignored. places alpha 0 aren't rendered correct, alpha less 255 instead of blending color existing color @ pixel draws without alpha blending @ all.

how can draw bitmap on canvas proper blending based on source images' alpha channel? pertinent code snippets follow:

bitmapfactory.options opt = new bitmapfactory.options(); opt.inpreferredconfig = config.argb_8888; ... decorationtextures[1] = new      texturestatic(bitmapfactory.decoderesource(resources, r.drawable.ice_1, opt)); decorationtextures[2] = new      texturestatic(bitmapfactory.decoderesource(resources, r.drawable.ice_2, opt)); ... if(mtexture != null && minplay) {     if(mzone != null)         canvas.drawbitmap(mtexture.getbitmap(),                           mscreenx + mzone.getxoffset(),                            mscreeny + mzone.getyoffset(), null);     else         canvas.drawbitmap(mtexture.getbitmap(), mscreenx, mscreeny, null); } 

have tried changing format of surfaceview (if using one) and/or window match format (argb_8888) of bitmap using? may preventing having true transparency effects, , in case, should try match window/bitmap formats better performance/quality.

try window.setformat(pixelformat.rgba_8888); , surfaceholder.setformat(pixelformat.rgba_8888; set pixel format.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -