Discussion Board

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

    Reseting a mutable transparent image

    I have a mutable transparent image on a series 40 (4444 native pixel).
    FYI I use it for a scrolling terrain buffer that's going to be drawn onto the screen over some background image.

    I create the buffer using DirectUtils.createImage(w, h, 0x00000000) to set all the pixels to fully transparent.

    Every frame I draw the terrain into my terrain image buffer and drawImage it over the background.

    Now, I want to reset part of that terrain image to be fully transparent so I can draw some more stuff into it. I can't!
    There appears to be no way to set a transparent image pixel back
    to being 0x0000.

    If I use drawPixel it leaves the original image intact.

    So my question is:
    Has anyone successfully reset a mutable transparent dirty image
    back to being fully transparent?


    Keith Marsh

  2. #2
    Regular Contributor
    Join Date
    Mar 2003

    RE: Reseting a mutable transparent image


    I think I understand your problem, but forgive me if I've got it wrong.

    Obviously, you can't draw transparent pixels over the top of opaque pixels to create resultant transparent ones!

    I presume you're trying drawPixels with transparency set to false?

    It isn't documented exactly how DrawPixels works if you set the transparency flag to false. I suspect that it's overwriting the RGB data for each pixel, but leaving the Alpha component untouched, whereas you want it set to 0.

    You'll have to do a getPixels on the image into an array of shorts, then loop over the array setting the pixels as you want them.

    Bit of a bummer that, sorry. Have you tried it on a real phone at all? It wouldn't surprise me if the behaviour was different to the emulator.



Posting Permissions

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