Skip to content

agg::gradient_biradial

oncaphillis edited this page Mar 8, 2014 · 7 revisions

agg::gradient_biradial represents a plugin for gradient_polymorphic_wrapper which generates a radial gradient fill as in PDF or Postscript documents. See here for an example.

The gradient is defined between two circles which do *not* have to be concentric. A continuous series of circles may be defined on a horizontal line (x0..y1) with the radius ranging from (r0...r1) in the two functions r(t) and x(t) with x(t) for the centre of each circle as x(t) = x0+(x1-x0) * t and r(t) for the radius as r(t) = r0 + (r1-r0) * t. The parameter t defines the colouring of the circle.

For a given position x and a given parameter t one may calculate two y positions a follows.

<math>y = \pm \sqrt{ ( r_0 + ( r_1 - r_0 ) * t ) ^ 2 - ( x - ( x_0 + ( x_1 - x_0 ) * t ) ) ^ 2 }</math>

This has to be transformed into t=f(x,y) since AGG gives our plug-in a (x,y) pair and asks for the intensity factor t corresponding to the r(t) value for the circle on which the specified (x,y) value is located. Playing around with the solve(...) method of maxima gave me the two solutions which provide me with the gradient position parameter t for a given (x,y) pair.



        
You can’t perform that action at this time.