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

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 27 13:00:17 PST 2011


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?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list