Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The Image class (javax.microedition.lcdui.Image ) contains a method getRGB(...) which parses the Image into an array of RGB+Alpha values for each pixel in the image. Once you have the image in that format, its easy to tweak the alpha values to increase their transparency before you layer the images. This is really the only dynamic way I've seen to edit the transparency of an image in J2ME.</p> <p>to get the alpha (transparency) value out of the rgba array you have to use bit-shifting like this:</p> <pre><code>int origAlpha = (rgba[j] &gt;&gt; 24); </code></pre> <p>and then to change the alpha (transparency) value to something different (without changing the color at that pixel), you can use bitshifting to insert a different transparency level.</p> <pre><code>int newAlpha = 0x33; // or use whatever 0-255 value you want, with 255=opaque, 0=transparent rgba[j] = (rgba[j] &amp; 0x00ffffff); rgba[j] = (rgba[j] | (newAlpha &lt;&lt; 24)); </code></pre> <p>Then there is a createImage(...) method in Image that takes a byte-array of image data as a parameter, that can be used to create a new image out of your modified pixel data array.</p> <p>Also helpful, SonyEricsson's developer website also has a tutorial with sample code called "<a href="http://developer.sonyericsson.com/cws/devworld/article/techsupport-tipstrickscode-java-pjava0501?cc=gb&amp;lc=en" rel="nofollow noreferrer">Fade in and out images in MIDP 2.0</a>" which explains "how to change the alpha value of an image to make it appear blended" which is essentially alpha-blending.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload