[cairo] Draw a single pixel or group of pixels

Carl Worth cworth at cworth.org
Thu Apr 10 10:20:16 PDT 2008


On Thu, 10 Apr 2008 18:13:23 +0200, "Gerdus van Zyl" wrote:
> I use the following:
> ctx.rectangle(p.x,p.y,1.5,1.5)
> ctx.fill()
>
> the reason for the 0.5 larger is the little squares,sample point model
> described in "How do I draw a sharp, single-pixel-wide line?" in
> http://www.cairographics.org/FAQ/#sharp_lines

Hi Gerdus,

I think I really need to clarify that FAQ answer somehow. The correct
code for drawing a single pixel, (assuming the default identity
transformation matrix), is:

	cairo_rectangle (cr, x, y, 1.0, 1.0);
	cairo_fill (cr);

with both x and y as integers.

Please let me know what text on that page might have caused the
misunderstanding so that I can fix it.

Thanks,

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080410/5a1d87a7/attachment.pgp 


More information about the cairo mailing list