[cairo] path gradients and cairo
David Reveman
c99drn at cs.umu.se
Sun Apr 25 16:59:27 PDT 2004
On Fri, 2004-04-23 at 22:48 -0700, Vladimir Vukicevic wrote:
> Howdy,
>
> In implementing some bits of GDI+ on top of Cairo for Mono's Drawing
> stuff, I'm looking for a way to implement GDI+'s notion of a "Path
> Gradient". What this is is an array of points, each with an associated
> color, and a center point and center color. The gradient is rendered by
> rendering triangles using two adjacent points on the path and the
> center point, smoothly interpolating between the 3 colors --
> essentially, Gouraud shading across the triangle, repeated for every 2
> adjacent points on the path and the center point.
>
> I'm thinking about trying to implement this in cairo, as a new pattern
> type. Are there any pitfalls that I should be aware of in doing so?
> Also, even though this is probably going to be a rarely-used pattern
> type, it can get easily hardware accelerated with the opengl back end.
> Is there any way to pass that kind of pattern data down to glitz, so
> that it can just render shaded triangles?
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?
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.
- David
--
David Reveman <c99drn at cs.umu.se>
More information about the cairo
mailing list