[cairo] radial transformations and non-linear gradients

Jon Wild wild at music.mcgill.ca
Tue Jun 9 08:23:20 PDT 2009


Hello,

Just getting started with Cairo (and with image manipulation in general). 
Could anyone point me to a way to perform (or simulate) radial 
transformations using polar coordinates? I would like to take a disk with 
radius normalised to 1, and transform the source image within that disk 
such that point (r, theta) gets sent to (f(r), theta), where f is an 
exponential or trig function. The goal is a "bubble" type transform, as if 
a refracting glass hemisphere was placed above the image at that point.

Another question: a colour gradient moves uniformly along a line in 3D rgb 
space between the colour stops. How do you make (or simulate) a gradient 
that moves along that line at a non-linear rate? For example an 
exponential gradient--in other words transform the linear gradient so that 
when you are x% of the way between the end points on the surface, the 
resulting colour is (x%)^n between the colour stops? (I can see breaking 
the gradient into many parts, with linear relationships in each, to 
approximate the function--but that seems tedious)

Thank you for any help!  --Jon



More information about the cairo mailing list