Getting a pointer to a cairo context?

Hazen Babcock <[email protected]> Mon, 7 Apr 2008 22:49:09 -0400
Newsgroups gmane.lisp.clg.devel
Message-ID <[email protected]>
Hello,

It is possible to get a pointer to a cairo context? I thought that  
perhaps (gffi::foreign-location cr) would do it, but passing this to  
the code that expects a pointer to a cairo context seems to crash my  
(SBCL) Lisp process.

More details about what I'm trying to do. I'd like to use cl-plplot  
(a wrapper for the C plotting library PLplot) to render graphs in the  
cairo context of a window provided by clg, but to do this I need to  
pass a pointer to the windows cairo context off to the PLplot  
graphics library. CL-plplot is using CFFI to interact with PLplot, so  
I'm passing the return value of (gffi::foreign-location cr) as  
type :pointer and assuming that it is in fact a cairo_t *.

I hoped that something like this might work:

(gdk:with-cairo-context (cr (widget-window drawing-area))
     (multiple-value-bind (width height)
           (widget-get-size-allocation drawing-area)
         (cairo:scale cr width height))
     (draw-a-plot (gffi::foreign-location cr)))

Thank you,
-Hazen


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone