[cairo] Radial shader transformation
Bill Spitzak
spitzak at d2.com
Mon Mar 1 14:00:30 PST 2004
On Monday 01 March 2004 01:32 pm, Thomas Hunger wrote:
> > I may be wrong, perhaps the current transform applies to the current
> > shader?
>
> Hm. I thought quite a bit about that and came the the result that the
> current transform should apply to the current shader.
> I.e. if you do create horizontal, linear gradient via shader_linear
> (0,y,1,y) and then call rotate(PI/2) the gradient would rotate together
> with the shape.
>
> Did I understand you rightly that in your proposal the gradient would not
> rotate, since it would use the transform frozen at its creation time?
That was what I was proposing, but in fact I realize now it is not a
necessary restriction, and you are right it could be a pain for cases where
the shader wants to be moved or scaled to match the current shape.
Instead the shader could be transformed by the difference between the space
it was defined in and the current transform. This is just the inverse of the
transform matrix when the shader was defined, multiplied by the current
transform matrix. You could then use rotate and scale to define a tilted
ellipse transform, and still scale and translate and even rotate as you draw
your shapes.
--
,~,~,~,~ ~ ~ ~ ~
/\_ _|_========___ Bill Spitzak
~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com
More information about the cairo
mailing list