[cairo] Can I provide a location to obtain a drawn object?
Gerdus van Zyl
gerdusvanzyl at gmail.com
Tue Jun 17 00:32:38 PDT 2008
The short answer is no, cairo can not do it in the way you are describing.
But cairo does have functions like cairo_in_fill and cairo_in_stroke
that tests for intersection.
The way you would use this is to have for every object a duplicate of
the drawing code without cairo_stroke,cairo_fill and using
cairo_in_fill,cairo_in_stroke for hit testing. You can of course use
hit masks or your own scenegraph, etc.
You might want to consider one of the cairo powered scenegraph/canvas
projects. see http://www.cairographics.org/examples/
~Gerdus
On Tue, Jun 17, 2008 at 2:45 AM, Matthew Walker <mattgwwalker at gmail.com> wrote:
> Hello,
>
> If I have drawn something on a surface, is it possible to look up what has
> been drawn at a specific location?
>
> This is my first time looking into Cairo, so please forgive me if this is a
> stupid question. I attempted to search through the mailing list archives
> and the documentation, but I didn't find concrete answers.
>
> I would like to know if it's possible to take, say, the mouse pointer's
> location and obtain some sort of reference to the "object" that is at that
> location. Is this easy to do in Cairo? Can you point me to any relevant
> API functions?
>
> The objects that I want to draw will be made up of a number of strokes (and
> possibly fills). I would like primarily to print these (automatically
> produced) drawings, but I would also like to have some sort of interface to
> allow users to add information through a "click to select" style interface.
> Do you have any suggestions? Or is Cairo not the right library to consider?
>
> Thanks in advance for your comments.
>
> Matthew.
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
More information about the cairo
mailing list