A
Alex Hunsley
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
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