[cairo] mesh APi naming

Behdad Esfahbod behdad at behdad.org
Fri Jan 28 11:58:32 PST 2011


On 01/28/11 01:43, Benjamin Otte wrote:
> On Thu, 2011-01-27 at 21:00 +0000, Chris Wilson wrote:
>>> Why are we using cairo_pattern_mesh_foo instead of
>>> cairo_mesh_pattern_foo in the API?
>>> Isn't it a mesh pattern and not a pattern mesh?
>>
>> The public struct is cairo_pattern_t and the other specialised setters
>> take the form cairo_pattern_add_color_stop_rgba. Though the existing
>> gradients do not require such a complicated constructor.
>>
> Yeah, I think that was a mistake in retrospect. It works very well if
> you only intend to have 3 different pattern types and don't do a real
> object system - like the situation was when Carl created the universe.
> But now where we get mesh patterns and are still thinking about more
> pattern types (like blur filters etc), I think it makes sense to apply
> the same naming we do for the other "real" objects: surfaces.
> And that's cairo_foo_surface_get_bar(). So I'm thinking
> cairo_foo_pattern_get_bar() is the right thing to do.

The reason the _add_color_stop_rgba() and family were done that way was to
share methods between linear and radial gradients.

But I also agree that moving forrward, cairo_mesh_pattern_* makes much more sense.

behdad


More information about the cairo mailing list