[cairo] Clipping and stroking

Bill Spitzak spitzak at d2.com
Fri Apr 29 18:06:35 PDT 2005



Carl Worth wrote:

> 	    x = floor (x);
> 	    y = floor (y);
> 	    width = ceil (width);
> 	    height = ceil (height);

As somebody who has made this mistake before, I'll have to be the first 
to point out that this does not return the correct surrounding 
rectangle, for instance if x=1.5 and width=2. The correct answer is:

	width = ceil(x+width)-floor(x);
	x = floor(x);
	height = ceil(y+height)-floor(y);
	y = floor(y);

Therefore it may make sense to return the extents as coordinates so this 
mistake is less likely.



More information about the cairo mailing list