[cairo] Radial shader transformation

Bill Spitzak spitzak at d2.com
Mon Mar 1 12:55:30 PST 2004


On Monday 01 March 2004 10:26 am, Thomas Hunger wrote:
> It might be usefull to have a rx, ry for a radial shader instead of just r
> to allow elliptical shaders.

It appears arbitrary transforms are already allowed for the shader, which 
would allow ellipses, plus it would also allow diagonal major/minor axes. 
Doesn't something like this work: ?

save_transform
  rotate,scale,translate
  setup_radial_shader
restore_transform
rotate,scale,translate differently
  create path & fill

I may be wrong, perhaps the current transform applies to the current shader?

Certainly in my experience the fastest way to do an elliptical shader is to 
do a 2x3 matrix transform of the actual coordinate to map it to a 1-radius 
circle around 0,0 and then figure out the color from there. So specifying it 
this way with an arbitrary transform will not limit the implementation at all.

Of course  if this is true, there is no requirement to provide a radius, or 
even an x,y center point, to the radial shader. It can actually draw a 
1-radius circle around 0,0 and the user must use transformations to put it in 
the correct place.

-- 
                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com




More information about the cairo mailing list