[cairo] How can I find out the current color when I call cairo_fill?

Kalle Vahlman kalle.vahlman at gmail.com
Fri Jan 4 09:24:38 PST 2008


2008/1/4, ying lcs <yinglcs at gmail.com>:
> Hi,
>
> Can you please tell me if there is any function in cairo which allow me to find
> out what is the color (rbg), when i call
> cairo_rectangle(...);
> cairo_fill(...);
>
> I see there is a method cairo_set_source_rgb(), but I don't see a corresponding
> getter?

There is, but as all sources are patterns (in the solid pattern case
the source is not just a color, but a infinite plane of color) it's in
the pattern namespace:

  http://cairographics.org/manual/cairo-Patterns.html#cairo-pattern-get-rgba

and to get the current source pattern you can use

  http://cairographics.org/manual/cairo-cairo-t.html#cairo-get-source

-- 
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi


More information about the cairo mailing list