Bug 25839

Summary: pathinformation of a polygon or line
Product: cairo Reporter: Volker <volkerobhof>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: enhancement    
Priority: high    
Version: 1.9.5   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: sample view

Description Volker 2009-12-31 08:43:59 UTC
Hello,

I think it would be very useful to have a function which return a path with the outmost or inmost path positions. So you could set text direct on these shapes.

example of this function:

cairo_path = cairo_out_path(cairo_t *cr);

cairo_path = cairo_in_path(cairo_t *cr);

Then you could text the text on a shape like in my attachment.
Comment 1 Volker 2009-12-31 08:46:21 UTC
Created attachment 32384 [details]
sample view
Comment 2 Andrea Canciani 2010-08-10 00:24:18 UTC
What you actually want is not very clear.
Cairo might expose some functions to test if a point is in a (closed) path (depending on the fill rule), but that doesn't seem to be what you're looking for.
Your examples shows two paths which are not closed and to me it seems that the text in the circle arbitrarily stops when it reaches the radiuses.
Could you try explaining the feature you want more in detail?
Comment 3 Volker 2010-08-11 10:34:42 UTC
Well, I only want to write text in shapes which I have painted. So I need at a defined position where the text inside a shape could reach out that the text can begin at a new line because everything should be written inside. 

What's the name of the function which returns a point of a closed path? Maybe it could be the right thing for me.
Comment 4 Andrea Canciani 2010-12-13 02:46:29 UTC
(In reply to comment #3)
> Well, I only want to write text in shapes which I have painted. So I need at a
> defined position where the text inside a shape could reach out that the text
> can begin at a new line because everything should be written inside. 
> 
> What's the name of the function which returns a point of a closed path? Maybe
> it could be the right thing for me.

cairo_in_fill() and cairo_in_stroke() test if a point is inside the drawn part of a path,
but I'm afraid that they are not immediately useful for your purpose.

Vikloud solves a related problem (drawing a "cloud" of text strings without collisions), so you might want to have a look at its source: http://vikloud.git.sourceforge.net/

IIRC the approach used in Vikloud is checking if the text extents collide with the colored pixels of the image.
Comment 5 GitLab Migration User 2018-08-25 13:50:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/224.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.