[cairo] Binding cairo_pattern_get_color_stop_rgba
jonathon.jongsma at gmail.com
Thu Jan 18 17:54:27 PST 2007
On 1/15/07, Torsten Schoenfeld <kaffeetisch at gmx.de> wrote:
> On Mon, 2007-01-08 at 10:52 +0800, Steve Chaplin wrote:
> > cairo_pattern_get_color_stop_rgba()
> > returns one item from a list list[i] == (o,r,g,b,a)
> > where list == [(o,r,g,b,a),
> > (o,r,g,b,a), ...]
> > It looks like cairo_pattern_get_color_stop_rgba() is the odd one out -
> > it returns an item from a list whereas the others return lists.
> > Why not simply return the whole list?
> For what it's worth, that's exactly what I did for the Perl bindings:
> name it get_color_stops and make it return a list of lists.
> I think we should agree on a common name and common semantics. So, does
> the above sound sensible to other language binding authors?
(speaking with my C++-binding hat on)
That sounds reasonable to me. It seems that returning the entire list
at once simplifies the API significantly. However, this assumes that
you'll almost always want all of the color stops together in a single
structure. As Carl mentioned in a different thread, the existing C
API provides some additional flexibility since it doesn't define the
type of container that it must be stored in, and it also allows you to
only get a single stop at a time if you're only interested in a single
stop. In practice, I'm not sure whether this added flexibility would
ever be useful or not, so I'd lean towards simply returning the
'list-of-lists' that Torsten described above.
More information about the cairo