[cairo] How to draw a Rect with red border

Boris Popov boris at deepcovelabs.com
Mon Jan 23 11:11:27 PST 2006

yinglcs2 at yahoo.com wrote:
> How can I draw a Rect with red border?
> I know the function cairo_rectangle() to draw a Rect,
> but how can I set the color to "red"?
>  cairo_rectangle(aSurf, 20, 20, 40, 40);

That would be,

cairo_rectangle(cr, 20, 20, 40, 40);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_stroke (cr);

I would also suggest you take a look at the snippets page, which I found 
to be very useful when learning the basics of Cairo a little while ago,




DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

boris at deepcovelabs.com


This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any

Thank you.

More information about the cairo mailing list