[racket] Snips displaying pdfs

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Mar 27 20:15:14 EDT 2012

At Sun, 18 Mar 2012 15:29:01 +0100, Jens Axel Søgaard wrote:
> I can now open a pdf-file and render it into a cairo_t context.
> The code is attached. To test that the rendering works,
> I saved it in a png, and then displayed it in a snip.
> 
> I am struggling with creating a bitmap directly from the cairo context.
> Any pointers?

As of the latest in the git repo, `bitmap%' has a `get-handle' method,
which you could use to get a `cairo_surface_t' for a bitmap.

Alternatively, you could use the new `make-handle-brush' from
`racket/draw/unsafe/brush', which lets you use a `cairo_surface_t'
directly as a brush. That's probably better; I imagine that it would
avoid rasterization of the PDF content if you're drawing back out to
something like a new PDF stream.



Posted on the users mailing list.