[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] how to create a cairo_matrix_t (defined by define-fo
From: |
Markus Klotzbuecher |
Subject: |
Re: [Chicken-users] how to create a cairo_matrix_t (defined by define-foreign-type) ? |
Date: |
Mon, 30 Jan 2012 11:29:04 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi Christian,
On Fri, Jan 27, 2012 at 11:44:55AM +0100, Christian Kellermann wrote:
> Hi all fans of cairo bindings,
>
> * Christian Kellermann <address@hidden> [120117 21:06]:
> > * Markus Klotzbuecher <address@hidden> [120115 18:02]:
> > > Is this branch available somewhere? I would prefer a correct but
> > > untested version to my wrong but coincidentally working one :-)
> >
> > I am not sure yet what's best. What I am using now is this:
> >
> >
> > (define %fill-matrix
> > (foreign-lambda* (c-pointer cairo_matrix_t)
> > ((f64vector v))
> > "cairo_matrix_t *m = malloc(sizeof(cairo_matrix_t));
> > int i=0;
> > m->xx = v[i++];
> > m->xy = v[i++];
> > m->yx = v[i++];
> > m->yx = v[i++];
> > m->x0 = v[i++];
> > m->y0 = v[i++];
> > C_return(m);"))
> >
> > (define (cairo-transform/matrix ctx v)
> > (when (not (= (vector-length v) 6))
> > (error "Vector size mismatch should be 6, is " (vector-length v)))
> > (let ((m (%fill-matrix v)))
> > (cairo-transform ctx m)
> > (free m)))
> >
> > (define new-matrix
> > (foreign-lambda* cairo_matrix_t ()
> > "C_return(malloc(sizeof(cairo_matrix_t)));"))
> >
> > There is still a freeing operation missing, I tend to use the
> > cairo-transform/matrix procedure most of the time though.
> >
> > What do others think?
>
> Markus did you have a chance to have a look at the code? I would
> love to release a new cairo version. If there are any missing
> features on your wishlist, please let me know!
I unfortuately did not have any time to look into this so far. I hope
to give it a try towards the end of the week. One (low priority) thing
on my wishlist would be support for writing to svg files. I suppose
the latter would be largely a duplication of the png code, but I have
not looked into it yet.
Thank you for your effort!
Markus