[cairo] How to draw a Rect with red border

Olexiy Avramchenko aolexiy at gmail.com
Mon Jan 23 11:12:34 PST 2006

On 1/23/06, yinglcs2 at yahoo.com <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);

Set the colour with cairo_set_source_rgb(), like:
cairo_set_source_rgb(cr, 1.0,0.0,0.0)
If you want to draw transparent rectangle, use cairo_set_source_rgba(),
cairo_set_source_rgb() assumes alpha component equal to 1.0.

After that use cairo_fill() to fill the rectangle and, optionally,
to draw rectangle's border.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20060123/6349b984/attachment.html

More information about the cairo mailing list