[cairo] Vector screen capture with Cairo

Behdad Esfahbod behdad at behdad.org
Wed Apr 4 14:22:12 PDT 2007


On Wed, 2007-04-04 at 17:07 -0400, Carl Worth wrote:
> On Wed, 04 Apr 2007 21:23:26 +0100, Peter Clifton wrote:
> > > I want to get a vector-based a window capture of a program for
> > inclusion
> > > in user-documentation. This would produce a nice scalable, (and
> > > hopefully memory efficient) way to embed the window capture.
> 
> Hi Peter,
> 
> I think this is a really interesting thing that you are looking into,
> and I'm looking forward to hearing more from you as you make progress.

Yeah, interesting stuff.  Note that latest Qt already supports things
like this.  Check Zack Russin's blog.


Summarizing Carl's excellent reply, you want to do something like this:

Patch Gtk+ to, upon receiving some kind of signal:

  - Process all updates
  - Create a PDF/SVG surface
  - Tweak a flag such that gdk_cairo_create() returns a cairo_t
targeting the created PDF/SVG surface.  Now you may have to make for
some translation here.  Try cairo_translate(), but that will not be
invisible to the user and so may cause incorrect results.
  - Invalidate all of your window
  - Process all updates
  - Tweak the flag back
  - Destroy the surface

Let us know how it works.  You may want to check the offscreen rendering
patch to.  That one sure has bits that are interesting for your goal.

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list