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. Advertising

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:
    470
    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:
    332
    =?Utf-8?B?QmlsYWw=?=
    Feb 28, 2004
  3. Steven D'Aprano

    Why are "broken iterators" broken?

    Steven D'Aprano, Sep 21, 2008, in forum: Python
    Replies:
    8
    Views:
    665
  4. Cameron Simpson

    Re: Why are "broken iterators" broken?

    Cameron Simpson, Sep 22, 2008, in forum: Python
    Replies:
    0
    Views:
    593
    Cameron Simpson
    Sep 22, 2008
  5. Fredrik Lundh

    Re: Why are "broken iterators" broken?

    Fredrik Lundh, Sep 22, 2008, in forum: Python
    Replies:
    0
    Views:
    610
    Fredrik Lundh
    Sep 22, 2008
Loading...

Share This Page