[cairo] Paths and cairo_save()/restore()

Alexander Larsson alexl at redhat.com
Mon Jan 10 01:53:38 PST 2005


On Sat, 2005-01-08 at 22:25 -0500, Owen Taylor wrote:
> So, I was trying to write pango_cairo_layout_path(), which create a path
> for an entire styled paragraph  of text, and it turned out to be hard.
> 
> In the parallel function pango_cairo_show_layout() I'm using 
> cairo_save()/cairo_restore() so that I can change transform, current
> font, etc. But you can't do that when constructing a path because 
> save()/restore() save the path.
> 
> Talked to Carl about this some on IRC, and it seems like wanting
> to save/restore when constructing paths is at least somewhat
> common.

I might need something like this for the xpdf backend. To implement the
clip-to-text rendering mode of pdf i need to be able to for each glyph:
 restore the old path
 create the path from the glyph, adding new shapes to the path
 save the combined path
and at the end i want to restore the last path and set it as the clip
region.

How would I do this in Cairo?

Another question for xpdf. How do i implement ImageMask rendering? It
means taking a bitmask and rendering it with the foreground color. This
is basically the way glyphs are rendered, but I don't immediately see a
good way of doing it with the public API.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl at redhat.com    alla at lysator.liu.se 
He's a deeply religious chivalrous ex-con She's an artistic red-headed traffic 
cop from beyond the grave. They fight crime! 




More information about the cairo mailing list