×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    60

    a transparent problem on series60

    hi,

    for my app i have my own font images
    so i load a large png and cut it into seperat images
    like the code below:

    loadfont = Image.createImage("/font.png");

    for(int i=0;i<anz_chars;i++) {
    font[i] = DirectUtils.createImage(fontwidth,fontheight,0x00000000);
    Graphics g = font[i].getGraphics();
    g.drawImage(loadfont,-fontwidth*i,0,Graphics.TOP|Graphics.LEFT);
    }

    my problem is, that on a series60 phone i cant create transparent initalcolor. (AARRGGBB) i have tried serveral values - but no luck.
    the transparent parts of the images are filled with color and arent transparent!
    on a 7210 or 6610 all looks good

    anybody a solution for this problem?

    andreas

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    18
    Hey, sadly I can't say I have the answer for you, I just thought I'd tell you that I was just about to post a question on this topic myself. I have done a very similar thing myself in my code and just as you say everything works well on both the 7210 emulator
    and the actual device itself.

    However, when trying to run it on the series 40 concept SDK then the transparency does no longer work, same thing with the series 60 concept SDK. Is this a bug in the implementation of the Nokia UI on some devices or is this only an added feature on the 6610/7210 ? The way I see it was that all Series 40 phones were supposed to be created equal in respect to the Nokia UI so that the write once run anywhere concept would actually work. So, if the case is that there are variations in how the Nokia UI API is implemented then could someone please point me out how to find out about them before developing an application instead of afterwards.

    Also, to work around your problem I suggest that you use clipping and offseting the drawing location of your image as specified in the Efficient MIDP Programming document that can be found from the Game Developer site on forum Nokia

  3. #3
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    I answered a similar question in the graphics forum. And I also imagine this is what fwahrman is talking about:
    http://discussion.forum.nokia.com/fo...threadid=17650

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    19
    You cannot preserve transparency using the default getGraphics method. Use Nokias getDirectGraphics instead and draw images to this context (see Nokia UI docs).

    for(int i=0;i<anz_chars;i++) {
    font[i] = DirectUtils.createImage(fontwidth,fontheight,0x00000000);
    Graphics g = font[i].getGraphics();
    DirectGraphics dg=DirectUtils.getDirectGraphics(g);
    dg.drawImage(loadfont,-fontwidth*i,0,Graphics.TOP|Graphics.LEFT,0);
    }

    Without DirectGraphics you cannot preserve the transparency in loaded images *unless* they are loaded individually without a new Graphics context (which you're obviously not doing here).

    Hope this helps.

    r

  5. #5
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    60
    thanks
    but sorry,
    this also doesnt work on 7650/3650 real device or emulator!

    on my 6610 and 7210 it works well, also with my code

    so what the trick to do it????
    i think i must load the png images seperatly to get the transparency on s60 devices

    andreas

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    19
    It works for me (on 7650 and Nokia emmy).

    You say it works on your 7210, which means something must be working...I have used this exact code successfully for all my 7650 releases.

    Are you sure the image you're loading is already a transparent png? (sorry for the obvious question...).

    r

  7. #7
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    60
    mhhh...
    the png image is an indexed 8bit image with transparent background.

    when i copy the image to seperat images the background of the created image must be transparent - so i use AARRGGBB as 0x00000000 - wich means to my - all pixels are transparent
    than i draw the image on it.

    so i dont know how to fix the problem???
    when i use the image directly the transparent is ok - so the problem is in the seperating routine.

    i have read the on the 7650/3650 the alpha musst be FF for fully transparent und 00 for full opaque. but also this doesnt work?

    i wonder if nobody else have this problem

    thanks for your help
    andreas

Posting Permissions

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