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

Daniel Goldman dagoldman at yahoo.com
Mon Aug 9 10:30:17 PDT 2010


Hi,

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.

Can cairo fill polygons from a pre-existing png file? Is it correct the GD model 
(import 

png outline map, fill existing polygons) doesn't work under vector-based cairo? 
Do I
need to use cairo_move_to () and  cairo_line_to () to create the polygons in 
real-time 

before filling them? My preference is to use the pre-existing outline, since it 
never
changes, but it would not be that big a deal to draw the map each time.


Thanks,
Daniel


More information about the cairo mailing list