[Cairo] gtk2 cairo engine
cworth at east.isi.edu
Mon Jul 28 16:18:19 PDT 2003
On Jul 28, jboulnois at neo-rousseaux.org wrote:
> I have done a sample gtk2 engine using cairo,
> For now it is in very early stage, but the result is promising.
> You can find it at
> Please send feedback
Great work! This looks quite interesting. Let me know if there are any
aspects of the Cairo API that make this task especially painful, (or
even especially pleasant).
One thing I noticed in the code:
That allocates two separate cairo_t structures (and leaks the first
one). You definitely don't want to do that.
Also, if you are interested, you might try rendering gradients with
Cairo. The OLS paper has an example that shows how you can achieve
linear gradients, (you'll have to change the XrNames to cairo_names of
The idea is to draw a small Nx1 image with one pixel per component of
the gradient, (eg. in the black->white->black gradients in the paper,
N=3). Then set a matrix to scale this image to the size of the object
to be filled and set it to use bilinear interpolation when
scaling. Apply the scaled image using cairo_set_pattern, then fill and
Voila! a lovely, smooth gradient.
More information about the cairo