Re: Cairo drawing



Op di, 10-01-2006 te 17:43 +0000, schreef Duncan Coutts:
> >From the FAQ:
>         The reason this happens is easy to explain to someone who
>         believes pixels are little squares. By default, integer
>         coordinates map to the intersections of the pixel squares. So a
>         width-1 horizontal/vertical line is centered on the boundary
>         between pixel rows and extends half way into the pixels on
>         either side.
> 
> So yes what you said sounds right.
> 
> >From my little experiment with drawing rectangles the result is that we
> can make them sharp.
> 
> If we say
> 
> rectangle 10 10 10 10
> setLineWidth 1
> stroke
> 
> Then we get the smeared box that you had before. Just changing that to:
> 
> rectangle 10.5 10.5 10 10
> setLineWidth 1
> stroke
> 
> makes it sharp (verified using xmag). That's because now all the
> endpoints of the rectangle are in the middle of pixels rather than at
> corners (the width & height remains the same of course).

Whoops, I forgot the last two parameters were width and height instead
of coordinates. I was adding .5 to them aswell. It works nicely now,
thanks! :)

I'll code the cairo check tomorrow probably, and upload a new patch.

-- Stéphan

Attachment: signature.asc
Description: Dit berichtdeel is digitaal ondertekend



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]