Consider two ways to draw a rectangle:

//---------------------------------------------
int x=10;
int y=10;
int w=2;
int h=2;

canvas.drawRect(x,y,x+w,y+h,p); // (1)

float[] lines=new float[]{
        x,y,x+w,y,
        x+w,y,x+w,y+h,
        x+w,y+h,x,y+h,
        x,y+h,x,y
};

canvas.drawLines(lines,p); // (2)
//---------------------------------------------

You may think that they both produce same rectagle, but you would be
wrong.
Call (2) draws a rectangle without bottom-right pixel. (Call (1) draws
rectangle correctly.)

This is because drawLine doesn't draw endpoint's pixel. So
drawLine(0,0,2,0) draws 2 pixels, not three. Hence the missing pixel
at the bottom-right (drawLines also sorts points, so bottom line is
drawn from (x,y+h) to (x+w,y+h)).

This behaviour is different from J2ME's & J2SE's, where drawLine
always draws both endpoints, and drawing rectange with drawLine
produces same result as drawRect.

The question is: is this a bug?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to