[cairo] Subsample at x,y position

Carlos López González genetita at gmail.com
Fri May 25 06:16:16 PDT 2012


Hi!
I'm Synfig developer and I am working on incorporate Cairo graphics on
current Synfig render method. Synfig is a 2D vector animation application
but it has some particularities. It does support layers that act like
raster filters (blur, distortions, etc.) apart of the typical geometry
layers (circle, rectangle, polygon, bezier shape. etc).

Synfig has its own Surface system that uses float ARGB color and HDR
support. Each geometry layer renders its content using the Synfig surface
primitives (very simple ones). The filter layers does its filter job by
asking the the layers below it for the color result on a given user space
point (x,y). Doing a subsampling of the returned value around the pixel
position allows to render properly the filter layer. So all the geometry
layers should define a function to return the color that it renders based
on a give x,y position.

When Cairo were implemented, floating point color and HDR will be lost. But
that's not the problem.

My plan to implement Cairo libraries is replace the geometry layers low
level calls to Synfig surface with high level calls to Cairo context API.
But the problem comes when the layer has to define a member function to
return the color on a certain x,y position. It is needed to give support to
the filter layers.

I've seen that cairo_context_t has three member functions that do something
similar. They return true if the given x,y point is inside the path or the
fill:

cairo_in_fill, cairo_in_stroke and cairo_in_clip

Since they were plain color I can assume than when the returned value is
true, the color at x,y is the layer's color.
The problem comes when using gradient patterns. I don't find any Cairo
function that tells me the color of the gradient at a certain x,y, position.

Any idea?

Thanks in advance!
-- 
Carlos
http://synfig.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120525/35181316/attachment.html>


More information about the cairo mailing list