×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    4

    Drawing text in white color (Nokia 3650)

    Hello

    I have following problem with drawing string with white color on offscreen Image. for example

    private static class CanvasImpl extends Canvas {
    Image offscreen;
    public void paint(Graphics g1) {
    if (offscreen == null)
    offscreen = DirectUtils.createImage(getWidth(), getHeight(), 0);
    Graphics g = offscreen.getGraphics();

    g.setColor(0);
    g.fillRect(0,0, getWidth(), getHeight());
    g.setColor(255,255,255);
    g.drawString("Test string", 10, 10, Graphics.TOP | Graphics.LEFT);

    g1.drawImage(offscreen, 0,0, Graphics.TOP | Graphics.LEFT);
    }
    }

    The result is black rectanglar and no white text on it. This problem occurs only in real Nokia 3650 phone. All emulators and even Nokia 7650 work properly

    Thanks in advance

    Alexander Godin

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    9
    I don't know about the string drawing problem but I would advice you not to do the offscreen.getGraphics()-call on every repaint but do it only once and store it in a class-variable. Doing it in every frame might make you run into some trouble.

    Regards,

    Johan

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    2
    I've got the same problem.

    All strings are painted in black when running my application
    in a series 60 phone. All my other graphics are rendered in
    the correct color.

    If you have solved the problem please share the solution!

    /Andreas

  4. #4
    Registered User
    Join Date
    Mar 2003
    Location
    Maastricht, The Netherlands
    Posts
    21

    Everybody

    I think it's an 3650 problem! Because I also got it, but is it with everycolor? (I can't test it on this moment!)

    Maybe it's better we report this to Nokia, because they should fix it in a later software version!

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    2
    The problem seem to only occur when you use a mutable image for offscreen-drawing...

    Example:

    Image buffer = Image.createImage(width,height);
    Graphics g = buffer.getGraphics();
    g.setColor(0xFFFFFF);
    g.drawString("some text", 0,0,g.TOP|g.LEFT);


    when you then use the graphics object passed to Canvas or FullCanvas to paint the buffer image into the Canvas all strings
    are rendered in black.

    You can avoid it by not drawing any graphics into offscreen images but in many applications you need them so what to do???

  6. #6
    Registered User
    Join Date
    May 2003
    Posts
    1
    No ability to set color on fonts is a major error than must be fixed.

    The description of the problem is perfectly described above.

    Please fix this.

    David.

  7. #7
    Registered User
    Join Date
    Apr 2003
    Posts
    10

    hi~ ^^;

    /////////////
    g.setColor(0);
    g.fillRect(0,0, getWidth(), getHeight());
    g.setColor(255,255,255);
    g.drawString("Test string", 10, 10, Graphics.TOP | Graphics.LEFT);
    g.drawImage(offscreen, 0,0, Graphics.TOP | Graphics.LEFT);
    /////////////


    My opinion is .........

    it's out of drawing order

    drawImage AFTER drawString !!

  8. #8
    Registered User
    Join Date
    Mar 2003
    Location
    Maastricht, The Netherlands
    Posts
    21
    My opinion is .........

    it's out of drawing order

    drawImage AFTER drawString !!
    Dude!

    It's a real problem... Nokia should fix it!

    And you didn't paid much attention to the first post probably. because if you look better you see that g1 and g is used and not only g!!!!!

    g.drawString("Test string", 10, 10, Graphics.TOP | Graphics.LEFT);
    g1.drawImage(offscreen, 0,0, Graphics.TOP | Graphics.LEFT);
    He draws just fine and in the good order!

  9. #9
    Registered User
    Join Date
    Apr 2003
    Posts
    10

    :-)

    im sorry.
    my reply was stupid.

    Today...
    I finally discovered that problem.

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    2
    I think the problem is deeper rooted than this.
    Strings work in most of the screen area for me, but not at the bottom. I'm still trying to figure out what's wrong there.
    Even when drawing directly to the screen, strings don't always display. An issue that Nokia should fix asap.

  11. #11
    Registered User
    Join Date
    Jun 2003
    Posts
    4
    Has anybody found a workaround for this problem yet?

    I tried a few obvious things like doing multiple setcolors and shuffling the order of code around to put some other processing between the setcolor and the drawString. None of these worked.

    BTW The fault is evident in the 3650 emulator too.

    The setcolor & drawString works correctly on a 7210 handset and on the emulator.

    Cheers,
    Peter

  12. #12
    Registered User
    Join Date
    Jun 2003
    Posts
    6
    Is there same problem on 7650?
    I test my program on 3650,drawString in black color only.
    I want to konw how about 7650.

  13. #13
    Registered User
    Join Date
    Mar 2003
    Posts
    30
    Just a thought, have you tried using DirectGraphics.setARGBColor(int argbColor) instead of Graphics.setColor(int)?

  14. #14
    Registered User
    Join Date
    Jul 2003
    Posts
    1

    3650 font color problem

    Has anybody found a workaround for this? I have exactly the same problem... My code works fine in the emulator, but all my text is rendered in black on the real phone.

    This is a major problem for my application!

  15. #15
    Registered User
    Join Date
    Jun 2003
    Posts
    4

    3650 drawstring bug when rendering to an images Graphics

    I saw somewhere a recommendation that you do the following:

    -- Test to see if the device is double buffered and if so write directly to the regular Graphics for the framebuffer.

    This of course isn't a solution if you want to do anything like render an image in a background thread and then blit it to the main visible canvas.

    Let's hope that both Sun and Nokia try and improve the QA process so developers end up with a consistent level of functionality across the standard. This sort of thing is concerning for anyone who wants to write real applications & not just demos.

    --Peter

Posting Permissions

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