Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   J2ME's fillTriangle is badly broken (http://www.velocityreviews.com/forums/t390850-j2mes-filltriangle-is-badly-broken.html)

Alex Hunsley 02-14-2007 02:26 PM

J2ME's fillTriangle is badly broken
 
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






All times are GMT. The time now is 05:02 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.