Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2010

    j2me transparent image drawing problem


    I am using low level API and drawing a transparent image on the screen. First I create the image with the following code:

        	int [] c = new int[width*height];
    		for (int i = 0; i < c.length; i++) {
    			c[i] = 0x88000000; 
    		Image img = Image.createRGBImage(c, width, height, true);
    then I draw it in the Canvas' paint(Graphics g) method by calling:

    g.drawImage(img , 0, 0, Graphics.TOP|Graphics.LEFT);
    it works fine and appears transparent on Sun Java Wireless Toolkit emulator but it is not transparent on Nokia SDK3 Symbian 0.8 emulator and on Nokia E61 device(real device).

    Any advice to fix this problem?



  2. #2
    Regular Contributor
    Join Date
    Nov 2008

    Re: j2me transparent image drawing problem


    I draw transparent images regularly without any problems. May I suggest that you first create a transparent image (using whichever image processing software you like), store it in .png file and ask your program to display it. If you the image displays correctly then you will know that problem is not with the phone (or its firmware), and the problem must be in your software.

    Matt Brenner
    UnME2, Inc.

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Cheshire, UK

    Re: j2me transparent image drawing problem

    Some Nokia S60s have problems with getRGB() losing the alpha channel, and perhaps some also have a problem with createRGBImage() in the same way.

    At Matt says, PNGs with alpha will paint much more reliably. It looks like you want to paint an alpha-black rectangle. I suggest using a small square PNG, using setClip() and drawImage() to tile the small image over the required area.


Similar Threads

  1. Drawing semi-transparent colors on mutable images
    By vpuchkov in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2010-07-27, 17:16
  2. transparent background drawing problem
    By cool_ranjeet in forum Symbian User Interface
    Replies: 10
    Last Post: 2009-11-13, 17:25
  3. problem for drawing image
    By sreehari434 in forum Mobile Java General
    Replies: 8
    Last Post: 2009-11-06, 17:12
  4. Drawing transparent text using CTextView
    By adamhusar in forum Symbian
    Replies: 2
    Last Post: 2006-09-07, 06:33
  5. Drawing image problem
    By cmonteiro in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-10-26, 15:42

Posting Permissions

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