[cairo] Draw a single pixel or group of pixels

Gerdus van Zyl gerdusvanzyl at gmail.com
Thu Apr 10 09:13:23 PDT 2008


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

I don't know of any setpixel API in cairo (because cairo isnt pixel
orientated). Except if you use an image surface and manipulate the buffer
directly but that's not cairo directly. The rectangle method was fast enough
for 500 pixels @ 25fps in my case.

~Gerdus

On Thu, Apr 10, 2008 at 5:27 PM, Joseph Fradley <joe.fradley at fradeng.com>
wrote:

> Hello,
>
> I'm sure there must be a way somewhere but I haven't been able to find it.
> How do you draw just a single pixel? or better yet a group of disjoint
> pixels at specific 'x,y' locations?
>
> Joe
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080410/063dea95/attachment-0001.htm 


More information about the cairo mailing list