[racket-dev] cairo_recording_surface_create

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sat Nov 30 19:08:19 EST 2013

Hi All,

I'd like to add cairo_recording_surface_create to the cairo ffi in
draw/unsafe/cairo.rkt.

Adding the line (and just that line)

(define-cairo cairo_recording_surface_create (_cfun _uint
_cairo_rectangle_t-pointer -> _cairo_surface_t)

  #:make-fail make-not-available

  #:wrap (allocator cairo_surface_destroy)

will however prevent DrRacket from running.

It seems to me, that it ought to have worked. Even more interesting is
that the exact same definition works in this example:

#lang racket
(require ffi/unsafe ffi/unsafe/alloc ffi/unsafe/define)
(define cairo-lib2 (ffi-lib "libcairo.2.dylib"))
(define-ffi-definer define-cairo cairo-lib2)
(define-syntax-rule (_cfun . rest) (_fun #:in-original-place? #t . rest))
(define-cstruct _cairo_rectangle_t ([x _double] [y _double] [width
_double] [height _double]))
(define _cairo_surface_t (_cpointer 'cairo_surface_t))
(define-cairo cairo_surface_destroy (_cfun _cairo_surface_t -> _void)
#:wrap (deallocator))

(define-cairo cairo_recording_surface_create
  (_cfun _uint _cairo_rectangle_t-pointer -> _cairo_surface_t)
  #:make-fail make-not-available
  #:wrap (allocator cairo_surface_destroy))

What am I missing in cairo.rkt ?

--
Jens Axel Søgaard


Posted on the dev mailing list.