Bug 1025 : JAVA2D/P2D - rect() stroke is one pixel too wide/high
Last modified: 2008-11-20 07:30




Status:
RESOLVED
Resolution:
LATER -
Priority:
P4
Severity:
normal

 

Reporter:
davbol
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-11-19 09:10
Beta 0157 (but also earlier), WinXPsp3, included JRE.

Not really sure if this is a bug, or by design as part of some larger pixel-filling rule...
Should the stroke of a rect() be properly inside the specified dimensions? Currently,
it extends one pixel beyond the right/bottom:

//size(300,100,JAVA2D);
size(300,100,P2D);
background(0);
// just fill = 50x50 pixels
fill(255,0,0);
noStroke();
rect(25,25,50,50);
// just stroke = 51x51 pxiels
noFill();
stroke(0,255,0);
rect(125,25,50,50);
// stroke/fill = 51x51 pixels
fill(255,0,0);
stroke(0,255,0);
rect(225,25,50,50);
save("test.png");
Additional Comment #1 From fry 2008-11-20 07:30
It's working as I'd expect, as in:

//size(300,100,JAVA2D);
size(100, 100, P2D);
// The whole stroke should be on-screen
//rect(0, 0, 99, 99);
// The right and bottom stroke is not visible
rect(0, 0, 100, 100);

Though it's a broader philosophical issue so that may not be best. I'll
table ot for now and mark it for later.