J2ME's fillTriangle is badly broken

Discussion in 'Java' started by Alex Hunsley, Feb 14, 2007.

  1. Alex Hunsley

    Alex Hunsley Guest

    J2ME's fillTriangle method is badly broken and doesn't honour the
    contract of the method.
    For example, to make the following code work as it should:


    g.fillTriangle(xx + halfButtonWidth,
    yy + buttonWidth,
    xx + halfButtonWidth, yy,
    xx + buttonWidth + 1, yy + halfButtonWidth);

    I have to actually write:

    g.fillTriangle(xx + halfButtonWidth,
    yy + buttonWidth + 1, // note the +1
    xx + halfButtonWidth, yy - 1, // note the -1
    xx + buttonWidth + 1, yy + halfButtonWidth);

    I can't actually work out what it is doing wrong (haven't checked the
    J2ME source code for it yet either). It behaves badly in other ways too:
    sometimes it will refuse to draw the rightmost and bottommost lines of
    pixels for the triangle that should be drawn.

    Just out of curiousity, anyone else been there and worked out in what
    way fillTriangle is broken? (And how to predictably fix your calls to
    fillTriangle so that they behave as the javadoc promises?)

    cheers,
    lex
     
    Alex Hunsley, Feb 14, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Deepak

    Badly stuck, Please help

    Deepak, Feb 23, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    623
    Deepak
    Feb 23, 2004
  2. =?Utf-8?B?QmlsYWw=?=

    Urgent: Please need help badly

    =?Utf-8?B?QmlsYWw=?=, Feb 26, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    500
    =?Utf-8?B?QmlsYWw=?=
    Feb 28, 2004
  3. Sam Samnah

    I need help badly

    Sam Samnah, Jun 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    852
    Sam Samnah
    Jun 27, 2005
  4. Sam Samnah

    I need help badly

    Sam Samnah, Jun 27, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    527
    Sam Samnah
    Jun 27, 2005
  5. robin
    Replies:
    0
    Views:
    1,075
    robin
    Jul 20, 2003
  6. Markus
    Replies:
    4
    Views:
    2,083
    Darryl Pierce
    Feb 12, 2005
  7. nishadixit
    Replies:
    5
    Views:
    1,547
    Joe Discar
    Jun 1, 2005
  8. Steven D'Aprano

    Why are "broken iterators" broken?

    Steven D'Aprano, Sep 21, 2008, in forum: Python
    Replies:
    8
    Views:
    963
Loading...