chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Update: Cairo binding


From: Matthew Welland
Subject: Re: [Chicken-users] Update: Cairo binding
Date: Sun, 6 Apr 2008 19:33:36 -0700
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)

Yippie! I can't wait to try this on ARM scratchbox for the n800/n810. 

On Sunday 06 April 2008 05:43:41 pm Luke McCarthy wrote:
> I've got about 99% of the API for Cairo 1.4.14 complete. Notable
> additions are patterns and scaled fonts, and some missing drawing
> functions, but it's mostly getters and setters of which there are many!
> The main thing missing is glyph support, because I can't think of a good
> way of passing arrays of structs from Scheme, and a few other
> trivialities like getting the reference count and get/set "user data"
> which are not very useful for Schemers.
>
> I want to change some aspects of the API for ease of use. Obviously I
> want to consult the list first since I don't want to break anyone's code.
> I don't imagine many (any?) people are using the Cairo binding yet, it is
> *alpha* after all.
>
> Mainly I want to change things so that values which are returned from the
> C function through "out" args are instead returned as any Scheme
> programmer would expect. For example, change (cairo-text-extents) to
> return a text extents object instead of mutating an object passed as an
> argument.
>
> ; private
> (define cairo-font-extents*
>   (foreign-lambda void "cairo_font_extents" cairo_t
> cairo_font_extents_t))
>
> ; public
> (define (cairo-font-extents cr)
>   (let ([fe (make-cairo-font-extents-type)])
>     (cairo-font-extents* cr fe)
>     fe))
>
> There are similar cases for floating-point arguments which currently
> expect f64vectors (of 1) which is a bit of a hack. It would be better to
> hide this and return doubles.
>
> Some procedures return multiple arguments. Should I use (values) or
> (list) ? Currently I am using (values) in most cases but there is a case
> where I had to use (list) since there could be an error (return #f on
> error) e.g. (cairo-pattern-get-rgba) which may fail if the pattern is not
> an RGBA pattern (there are different types of pattern). Alternatively I
> could throw an exception but I'm not familiar with the Chicken way of
> doing this.
>
> I'd like to get feedback on these issues before I release the code.
>
> Cheers,
>
> Luke McCarthy
>
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users




reply via email to

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