chicken-users
[Top][All Lists]
Advanced

[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: Christian Kellermann
Subject: Re: [Chicken-users] how to create a cairo_matrix_t (defined by define-foreign-type) ?
Date: Fri, 27 Jan 2012 11:44:55 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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!

Cheers,

Christian

-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]