×

Discussion Board

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

    j2me transparent image drawing problem

    Hello;

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

    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:

    Code:
    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?

    Thanks

    Destan

  2. #2
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    75

    Re: j2me transparent image drawing problem

    Hi,

    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.
    Cheers,

    Matt Brenner
    UnME2, Inc.

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    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.

    Graham.

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 C++
    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
  •