[cairo] path gradients and cairo

Vladimir Vukicevic vladimir at pobox.com
Sun Apr 25 20:00:44 PDT 2004


David Reveman wrote:
> I think a "path gradient" pattern can be quite useful. 
> Something similar to:
> 
> cairo_pattern_t *
> cairo_pattern_create_for_current_path (cairo_t *cr);
 >
 > would be nice and we would probably need to add on or two functions for
 > setting the center and surrounding color points, right?

Mmm.  I was thinking of something like this, but I have a hard time 
figuring out how you'd specify the colors.  Concievably, the current 
path could include curves and the like.. I'm not sure how you'd specify 
what point to attach a color to.  The "simple" implementation would be 
cairo_pattern_create_path (cairo_point_t *points, cairo_color_t *colors, 
int num_points) -- but this doesn't really fit with any of the current 
API functions (especially considering there's no publicly exported 
cairo_point_t nor cairo_color_t).

It also probably wouldn't make sense to extend paths to be able to store 
color ops, so I'm not sure of the right way to specify the color data.

> There would be no problem in passing this pattern data down to glitz. I
> actually think it could be efficiently accelerated by the current
> version of glitz using non-rectangular clipping and the color triangles.

Good to hear!  The non-accelerated/pixel-rendering case shouldn't be too 
bad to implement, either; it should fit in cleanly within the current 
framework in cairo_pattern.c.

	- Vlad




More information about the cairo mailing list