[cairo] Re: add solid/gradient pattern info getters

Vladimir Vukicevic vladimirv at gmail.com
Wed Sep 13 16:21:49 PDT 2006


If you had a hard time viewing the patch in the previous post, I'm
attaching it here again!  Ahem.

   - Vlad

On 9/13/06, Vladimir Vukicevic <vladimirv at gmail.com> wrote:
> The attached patch adds 4 new API methods:
>
>  cairo_status_t
> cairo_solid_pattern_get_color (cairo_pattern_t *pattern,
>                                double *r, double *g, double *b, double *a);
>
> cairo_status_t
> cairo_gradient_pattern_get_color_stop (cairo_pattern_t *pattern,
>                                        int index, double *offset,
>                                        double *r, double *g, double *b, double *a);
> cairo_status_t
> cairo_linear_gradient_pattern_get_endpoints (cairo_pattern_t *pattern,
>                                              double *x0, double *y0,
>                                              double *x1, double *y1);
>
> cairo_status_t
> cairo_linear_gradient_pattern_get_endpoints (cairo_pattern_t *pattern,
>                                              double *x0, double *y0, double *r0,
>                                              double *x1, double *y1, double *r1);
>
> They all return CAIRO_STATUS_PATTERN_TYPE_MISMATCH on error.  The only
> oddball here is get_color_stop, where the expected usage is to start
> index at 0 and keep incrementing it until the function returns
> CAIRO_STATUS_INVALID_INDEX (a new error code).  This seemed simpler
> than having an explicit getter for the number of color stops, or for
> doing some kind of bulk dump of the color stop data (e.g. something
> like get_color_stops (int *num_values, double *values) that will
> return the # of doubles needed in num_values if values is null, and
> will fill values with 'offset r g b a' chunks).
>
> Let me know if this looks ok to commit.
>
>     - Vlad
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pattern-getter-functions.patch
Type: application/octet-stream
Size: 7475 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060913/e714928c/pattern-getter-functions.obj


More information about the cairo mailing list