[cairo] newbie question - fill pre-existing png polygons?

Daniel Goldman dagoldman at yahoo.com
Sun Aug 15 17:36:40 PDT 2010


>
> I use GD to make maps with labels and color fills. To add pdf output, I've
> started
>
> using cairo / pango. The pdf is looking great so far.
>
> To make it easier to keep label placement consistent between png and pdf,
> I'm working on switching the png maps to also use cairo.
>
> With GD, I would import a png outline of the map that has been generated 
>before,
>
> and use gdImageFill () to fill a polygon. With cairo, it's easy to get the
> outline map
>
> in with cairo_image_surface_create_from_png (). But I'm getting the feeling 
>that
>
> is not a helpful step under cairo, that cairo does not fill existing png
> polygons.

Are you asking for a 'Flood Fill' tool in cairo?  If so, I think
there's none and it's not going to happen.

May be you can turn to use cairoscript backend to record your polygons
into a file.  Then load them and fill the path using cairo_fill().

--
Alex
> Hi,

*********** Response below

Thanks. No, I'm not looking for flood fill. I have no idea how cairo fills. But 
the cairo fill seems to work very well. I sometimes ran into problems with 
gdImageFill () when it would reach a narrow "bottleneck" and crap out and not 
fill the entire polygon.

Daniel


More information about the cairo mailing list