[cairo] mesh APi naming (was: cairo snapshot 1.11.2 now available)

Andrea Canciani ranma42 at gmail.com
Thu Jan 27 16:19:10 PST 2011


On Thu, Jan 27, 2011 at 10:00 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Thu, 27 Jan 2011 18:51:49 +0100, Benjamin Otte <otte at redhat.com> wrote:
>> On Sun, 2011-01-23 at 16:59 +0000, Chris Wilson wrote:
>> > API additions:
>> >
>> > The ability to construct piece-wise Bezier surface gradients:
>> >
>> >         cairo_pattern_create_mesh
>> >
>> >         constructs a pattern of type CAIRO_PATTERN_TYPE_MESH using
>> >
>> >         cairo_pattern_mesh_begin_patch
>> >         cairo_pattern_mesh_end_patch
>> >
>> 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.
>
> So yes, it should be cairo_pattern_foo(), the question is whether _mesh_
> is useful in the name.
>
> So an alternative would be:
>
>        cairo_pattern_begin_patch
>        cairo_pattern_end_patch
>        cairo_pattern_curve_to
>        cairo_pattern_line_to
>        cairo_pattern_move_to
>        cairo_pattern_set_control_point
>        cairo_pattern_set_corner_color_rgb
>        cairo_pattern_set_corner_color_rgba
>        cairo_pattern_get_patch_count
>        cairo_pattern_get_path
>        cairo_pattern_get_corner_color_rgba
>        cairo_pattern_get_control_point
>
> But that leaves the reader in doubt over the applicability of the method
> to the cairo_pattern_t in hand, and will quickly lead to congestion of the
> cairo_pattern namespace. (The latter is more of a moot point.)
>
> Does
>
>        cairo_pattern_begin_patch
>        cairo_pattern_patch_curve_to
>        cairo_pattern_patch_line_to
>        cairo_pattern_patch_move_to
>        cairo_pattern_patch_set_control_point
>        cairo_pattern_patch_set_corner_color_rgb
>        cairo_pattern_patch_set_corner_color_rgba
>        cairo_pattern_end_patch
>
>        cairo_pattern_get_patch_count
>        cairo_pattern_get_path
>        cairo_pattern_get_corner_color_rgba
>        cairo_pattern_get_control_point
>
> work any better?

This was the original naming proposed by Adrian, which was
changed to the current naming scheme after
http://lists.cairographics.org/archives/cairo/2009-September/018098.html

Andrea


More information about the cairo mailing list