image - How to read the original alpha channel from PNG in J2ME? -
i'm writing simple j2me game uses png images 8-bit alpha channel. problem: not hardware supports full alpha transparency rendering. however, since game pretty static in nature (at beginning, "sprites" layed out onto background image, based on current screen size, , that's it), thought possible prerender transparent images directly onto background during game initialization , use later in game. can't prerender them in photoshop positions not known in advance.
but, seems there no way read original alpha channel on devices not support semi-transparency gets resampled during png loading. there library can that? or idea store alpha channels separately (e.g. separate 8-bit png images) , manually apply them?
thanks!
png images have transparency support if want create transparent image have read rgb data along alpha channels , process alpha
image transpng=image.createimage("/trans.png"); //load tranparent image int rgbdata[]; transpng.getrgb(rgbdata, 0,transpng.getwidth(), 0, 0,transpng.getwidth(), transpng.getheight()); image tranparentimage=image.creatergbimage(rgbdata, width, height, true); //process alpha transpng=null;
above code shows how create transparent image , use.
Comments
Post a Comment