×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    3

    mutable transparent image

    Hi,

    I would like to know, if it is possible to create mutable image with transparency?
    I would like to have either empty transparent image on the start
    or ability to draw transparency on image. I would prefer second option.
    I know I can acheive the same effect by using drawPixels, but that is much slower than by blitting Image.

    And I know about S60 emulator alpha problems...

    Thanks.

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Irving, Texas, USA
    Posts
    419

    RE: mutable transparent image

    Hello,

    You can create a transparent mutable image using the following code snippet (you need Nokia UI API for it to work):

    Image img = DirectUtils.createImage(10, 10, 0x00000000);
    Graphics imgG = img.getGraphics();
    imgG.setColor(0xFF0000);
    imgG.fillArc(0,0,10,10,0,360);

    This code makes the background transparent for a 10 x 10 pixels image. Now you can draw on the image as normal. In the example I draw a red ball.

    Regards,

    Petteri / Forum Nokia

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    3

    RE: mutable transparent image

    I found the problem (and new one too).
    It seems that you have to use DirectGraphics.drawImage to draw created image. If you use Graphics.drawImage, transparency is ignored.
    It would be good, if somebody added that to the documentation.

    Now, on the other hand, DirectGraphics.drawImage is much slower than Graphics.drawImage (in case of transparent mutable images, didn't check other combinations), and is, as such, useless to me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×