source: project/release/4/cairo/trunk/cairo.scm @ 28126

Last change on this file since 28126 was 28126, checked in by Christian Kellermann, 9 years ago

cairo: add cairo-surface-show-page

File size: 25.6 KB
Line 
1;; Cairo vector graphics bindings for Chicken Scheme
2;
3; Copyright (C) 2004, 2005 Michael Bridgen <mikeb@squaremobius.net>,
4;                          Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
5;
6; This library is free software; you can redistribute it and/or modify
7; it under the terms of the GNU Library General Public License as
8; published by the Free Software Foundation; either version 2 of the
9; License, or (at your option) any later version.
10;
11; This library is distributed in the hope that it will be useful, but
12; WITHOUT ANY WARRANTY; without even the implied warranty of
13; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14; Library General Public License for more details.
15;
16; You should have received a copy of the GNU Library General Public
17; License along with this library; if not, write to the Free
18; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19; USA
20
21; --------------------------------------------------
22
23(module cairo
24 *
25 (import chicken scheme foreign)
26
27 (use srfi-1)
28 (use srfi-4)
29 (use srfi-13)
30 (use lolevel)
31
32 (import-for-syntax srfi-1)
33 (import-for-syntax srfi-13)
34
35 (foreign-declare #<<EOF
36
37#include "cairo.h"
38#include "cairo-svg.h"
39#include "cairo-pdf.h"
40#include "cairo-ps.h"
41EOF
42)
43
44;; Define a list of DEFINEs or enums at once.
45(define-syntax --cairo-flags
46  (lambda (e r c)
47    (let ((strs (cdr e)))
48      `(begin
49         ,@(append-map (lambda (str)
50                         (let* ((sym (string->symbol str))
51                                (psym (string->symbol (string-append "-" (symbol->string sym)))))
52                           `((,(r 'define-foreign-variable) ,psym unsigned-integer ,str)
53                             (,(r 'define) ,sym ,psym))))
54                       strs)))))
55
56(define *cairo-egg-version* '(0 1 3 alpha))
57
58(define cairo-pi (foreign-value "M_PI" float))
59
60;; Functions are mostly in the same order to
61;; cairo.h
62
63;; State manipulation
64;; -----------------------------------------------
65
66;; cairo_t encapsulates the current state
67
68(define-foreign-type cairo_t (c-pointer "cairo_t")
69  values
70  (cut tag-pointer <> 'cairo))
71
72; formerly didn't take the surface argument
73(define cairo-create (foreign-lambda cairo_t "cairo_create"
74                                     cairo_surface_t))
75
76; For reference counting?
77(define cairo-reference (foreign-lambda void "cairo_reference" cairo_t))
78
79(define cairo-destroy (foreign-lambda void "cairo_destroy" cairo_t))
80
81; Save the state of this context (and keep it as the state)
82(define cairo-save (foreign-lambda void "cairo_save" cairo_t))
83
84; Restore the last saved state of this context
85(define cairo-restore (foreign-lambda void "cairo_restore" cairo_t))
86
87; cairo-copy deprecated
88
89; ------------------------------------------------
90
91; Surfaces and backends
92; ------------------------------------------------
93
94;; cairo_surface_t is a drawing surface abstraction
95
96(define-foreign-type cairo_surface_t (c-pointer "cairo_surface_t")
97  values
98  (cut tag-pointer <> 'cairo-surface))
99
100(--cairo-flags "CAIRO_FORMAT_ARGB32"
101               "CAIRO_FORMAT_RGB24"
102               "CAIRO_FORMAT_A8"
103               "CAIRO_FORMAT_A1")
104
105;; %%% TO DO Several surface creation procedures
106
107(define cairo-image-surface-create-for-data (foreign-lambda cairo_surface_t "cairo_image_surface_create_for_data"
108                                                            (c-pointer byte)
109                                                            integer
110                                                            int
111                                                            int
112                                                            int))
113
114(define cairo-surface-create-for-rectangle (foreign-lambda cairo_surface_t "cairo_surface_create_for_rectangle"
115                                                            cairo_surface_t
116                                                            double
117                                                            double
118                                                            double
119                                                            double))
120
121(define cairo-svg-surface-create (foreign-lambda cairo_surface_t "cairo_svg_surface_create"
122                                                 c-string
123                                                 double
124                                                 double))
125
126(define cairo-pdf-surface-create (foreign-lambda cairo_surface_t "cairo_pdf_surface_create"
127                                                 c-string
128                                                 double
129                                                 double))
130
131(define cairo-ps-surface-create (foreign-lambda cairo_surface_t "cairo_ps_surface_create"
132                                                c-string
133                                                double
134                                                double))
135
136(define cairo-surface-create-for-rectangle
137  (foreign-lambda cairo_surface_t "cairo_surface_create_for_rectangle"
138                  cairo_surface_t
139                  double
140                  double
141                  double
142                  double))
143
144; cairo-create-image deprecated
145
146; cairo-set-target-image deprecated
147
148(--cairo-flags "CAIRO_OPERATOR_CLEAR"
149               
150               "CAIRO_OPERATOR_SOURCE"
151               "CAIRO_OPERATOR_OVER"
152               "CAIRO_OPERATOR_IN"
153               "CAIRO_OPERATOR_OUT"
154               "CAIRO_OPERATOR_ATOP"
155
156               "CAIRO_OPERATOR_DEST"
157               "CAIRO_OPERATOR_DEST_OVER"
158               "CAIRO_OPERATOR_DEST_IN"
159               "CAIRO_OPERATOR_DEST_OUT"
160               "CAIRO_OPERATOR_DEST_ATOP"
161               
162               "CAIRO_OPERATOR_XOR"
163               "CAIRO_OPERATOR_ADD"
164               "CAIRO_OPERATOR_SATURATE")
165
166; Set the composition operator --
167; see cairo docs or otherwise what they do.
168; http://cairographics.org/samples/snippets.html has
169; pictures of the results.
170(define cairo-set-operator (foreign-lambda void "cairo_set_operator" cairo_t integer))
171
172; formerly cairo-set-rgb-color
173(define cairo-set-source-rgb (foreign-lambda void "cairo_set_source_rgb"
174                                            cairo_t
175                                            double ;red
176                                            double ;green
177                                            double ;blue
178                                            ))
179
180;; Also see cairo-paint-with-alpha
181(define cairo-set-source-rgba (foreign-lambda void "cairo_set_source_rgba"
182                                            cairo_t
183                                            double ;red
184                                            double ;green
185                                            double ;blue
186                                            double ;alpha
187                                            ))
188
189(define cairo-set-source-surface
190  (foreign-lambda void "cairo_set_source_surface"
191                  cairo_t
192                  cairo_surface_t
193                  double ;x
194                  double ;y
195                  ))
196
197; ?
198(define cairo-set-tolerance (foreign-lambda void "cairo_set_tolerance" cairo_t double))
199;; -----------------------------------------------
200;;
201;; Antialias and fill
202;; -----------------------------------------------
203
204(--cairo-flags "CAIRO_ANTIALIAS_DEFAULT"
205               "CAIRO_ANTIALIAS_NONE"
206               "CAIRO_ANTIALIAS_GRAY"
207               "CAIRO_ANTIALIAS_SUBPIXEL")
208
209(define cairo-set-antialias (foreign-lambda void "cairo_set_antialias" cairo_t integer))
210
211(--cairo-flags "CAIRO_FILL_RULE_WINDING"
212               "CAIRO_FILL_RULE_EVEN_ODD")
213
214; Set the fill rule:
215; 'winding' is like a union (anything inside a path)
216; 'even-odd' is like xor (anything inside an odd number of paths)
217(define cairo-set-fill-rule (foreign-lambda void "cairo_set_fill_rule" cairo_t integer))
218
219; ------------------------------------------------
220
221; Lines, joins, and caps
222; ------------------------------------------------
223
224(define cairo-set-line-width (foreign-lambda void "cairo_set_line_width" cairo_t double))
225
226(--cairo-flags "CAIRO_LINE_CAP_BUTT"
227               "CAIRO_LINE_CAP_ROUND"
228               "CAIRO_LINE_CAP_SQUARE")
229
230(define cairo-set-line-cap (foreign-lambda void "cairo_set_line_cap" cairo_t integer))
231
232(--cairo-flags "CAIRO_LINE_JOIN_MITER"
233               "CAIRO_LINE_JOIN_ROUND"
234               "CAIRO_LINE_JOIN_BEVEL")
235
236(define cairo-set-line-join (foreign-lambda void "cairo_set_line_join" cairo_t integer))
237
238(define cairo-set-dash (foreign-lambda void "cairo_set_dash" cairo_t f64vector integer double))
239
240(define cairo-set-miter-limit (foreign-lambda void "cairo_set_miter_limit" cairo_t double))
241
242; ------------------------------------------------
243
244; Context transform operations
245; ------------------------------------------------
246
247;; These following operate on the current transform of
248;; the context -- there are also operations on arbitrary
249;; transforms further on (but perhaps not yet)
250
251(define cairo-translate (foreign-lambda void "cairo_translate" cairo_t double double))
252
253(define cairo-scale (foreign-lambda void "cairo_scale" cairo_t double double))
254
255(define cairo-rotate (foreign-lambda void "cairo_rotate" cairo_t double))
256
257(define cairo-transform (foreign-lambda void "cairo_transform" cairo_t cairo_matrix_t))
258
259(define cairo-set-matrix (foreign-lambda void "cairo_set_matrix" cairo_t cairo_matrix_t))
260
261(define cairo-identity-matrix (foreign-lambda void "cairo_identity_matrix" cairo_t))
262
263;; Matrix operations
264
265(define-foreign-type cairo_matrix_t (c-pointer "cairo_matrix_t")
266  values
267  (cut tag-pointer <> 'cairo-matrix))
268
269(define %fill-matrix
270  (foreign-lambda* (c-pointer cairo_matrix_t)
271                   ((f64vector v))
272                   "cairo_matrix_t *m = malloc(sizeof(cairo_matrix_t));
273                    int i=0;
274                    m->xx = v[i++];
275                    m->xy = v[i++];
276                    m->yx = v[i++];
277                    m->yx = v[i++];
278                    m->x0 = v[i++];
279                    m->y0 = v[i++];
280                    C_return(m);"))
281
282(define (cairo-transform/matrix ctx v)
283  (when (not (= (f64vector-length v) 6))
284    (error "Vector size mismatch should be 6, is " (f64vector-length v)))
285  (let ((m (%fill-matrix v)))
286    (cairo-transform ctx m)
287    (free m)))
288
289(define cairo-new-matrix
290  (foreign-lambda* cairo_matrix_t ()
291    "C_return(malloc(sizeof(cairo_matrix_t)));"))
292
293; accessors for each element might be nice, but probably not
294; immediately necessary
295
296; cairo-concat-matrix replaced by cairo-transform
297
298; cairo-matrix-set replaced by cairo-set-matrix
299
300; was cairo-transform-point
301(define cairo-user-to-device (foreign-lambda void "cairo_user_to_device" cairo_t f64vector f64vector))
302
303; was cairo-transform-distance
304(define cairo-user-to-device-distance (foreign-lambda void "cairo_user_to_device" cairo_t f64vector f64vector))
305
306; was cairo-inverse-transform-point
307(define cairo-device-to-user (foreign-lambda void "cairo_device_to_user" cairo_t f64vector f64vector))
308
309; was cairo-inverse-transform-distance
310(define cairo-device-to-user-distance (foreign-lambda void "cairo_device_to_user_distance" cairo_t f64vector f64vector))
311
312; ------------------------------------------------
313
314; Path creation
315; ------------------------------------------------
316
317;; Note that actually drawing paths is destructive;
318;; it will erase the current path.  Use cairo_save
319;; and cairo_restore if you want to use a path for
320;; more than one drawing operation.  Clipping is
321;; _not_ destructive.
322
323(define cairo-new-path (foreign-lambda void "cairo_new_path" cairo_t))
324
325(define cairo-move-to (foreign-lambda void "cairo_move_to" cairo_t double double))
326
327(define cairo-line-to (foreign-lambda void "cairo_line_to" cairo_t double double))
328
329(define cairo-curve-to (foreign-lambda void "cairo_curve_to" cairo_t double double double double double double))
330
331(define cairo-arc (foreign-lambda void "cairo_arc" cairo_t double double double double double))
332
333(define cairo-arc-negative (foreign-lambda void "cairo_arc_negative" cairo_t double double double double double))
334
335;; there's some relative move_to etc. things here .. mneh
336
337(define cairo-rectangle (foreign-lambda void "cairo_rectangle" cairo_t double double double double))
338
339;; Finish the current shape so you can draw another disjoint one
340(define cairo-close-path (foreign-lambda void "cairo_close_path" cairo_t))
341
342; ------------------------------------------------
343
344; Drawing operations
345; ------------------------------------------------
346
347(define cairo-stroke (foreign-lambda void "cairo_stroke" cairo_t))
348
349(define cairo-fill (foreign-lambda void "cairo_fill" cairo_t))
350
351; ------------------------------------------------
352
353; Insideness testing ... mneh
354; ------------------------------------------------
355
356(define-foreign-variable sizeof-cairo-text-extents int "sizeof(cairo_text_extents_t)")
357
358;; We want a garbage-collectable type here; wrap a record type around a byte vector buffer, and make
359;; chicken type-pun the buffer to the C struct.  We only ever construct these to hand to a function
360;; for filling in, so no initialisation needed aside from the buffer.
361(define-record cairo-text-extents-type buffer)
362(let ((maker make-cairo-text-extents-type))
363  (set! make-cairo-text-extents-type
364    (lambda () (maker (make-blob sizeof-cairo-text-extents)))))
365
366(define-record-printer (cairo-text-extents-type te out)
367  (for-each (lambda (x) (display x out))
368                    (list "#<cairo-text-extents "
369                          (cairo-text-extents-x-bearing te)" "
370                          (cairo-text-extents-y-bearing te)" "
371                          (cairo-text-extents-width te)" "
372                          (cairo-text-extents-height te)" "
373                          (cairo-text-extents-x-advance te)" "
374                          (cairo-text-extents-y-advance te)">")))
375
376(define-foreign-type cairo_text_extents_t scheme-pointer cairo-text-extents-type-buffer)
377
378(define cairo-text-extents-x-bearing (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->x_bearing);"))
379(define cairo-text-extents-y-bearing (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->y_bearing);"))
380(define cairo-text-extents-width (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->width);"))
381(define cairo-text-extents-height (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->height);"))
382(define cairo-text-extents-x-advance (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->x_advance);"))
383(define cairo-text-extents-y-advance (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->y_advance);"))
384
385(define cairo-text-extents-x-bearing-set! (foreign-lambda* double ((cairo_text_extents_t te) (double v)) "((cairo_text_extents_t*)te)->x_bearing = v;"))
386(define cairo-text-extents-y-bearing-set! (foreign-lambda* double ((cairo_text_extents_t te) (double v)) "((cairo_text_extents_t*)te)->y_bearing = v;"))
387(define cairo-text-extents-width-set! (foreign-lambda* double ((cairo_text_extents_t te) (double v)) "((cairo_text_extents_t*)te)->width = v;"))
388(define cairo-text-extents-height-set! (foreign-lambda* double ((cairo_text_extents_t te) (double v)) "((cairo_text_extents_t*)te)->height = v;"))
389(define cairo-text-extents-x-advance-set! (foreign-lambda* double ((cairo_text_extents_t te) (double v)) "((cairo_text_extents_t*)te)->x_advance = v;"))
390(define cairo-text-extents-y-advance-set! (foreign-lambda* double ((cairo_text_extents_t te) (double v)) "((cairo_text_extents_t*)te)->y_advance = v;"))
391
392(define-foreign-variable sizeof-cairo-font-extents int "sizeof(cairo_font_extents_t)")
393
394(define-record cairo-font-extents-type buffer)
395(let ((maker make-cairo-font-extents-type))
396  (set! make-cairo-font-extents-type
397    (lambda () (maker (make-blob sizeof-cairo-font-extents)))))
398
399(define-record-printer (cairo-font-extents-type e out)
400  (for-each (lambda (x) (display x out))
401                    (list "#<cairo-font-extents "
402                          (cairo-font-extents-ascent e)" "
403                          (cairo-font-extents-descent e)" "
404                          (cairo-font-extents-height e)" "
405                          (cairo-font-extents-max-x-advance e)" "
406                          (cairo-font-extents-max-y-advance e)">")))
407
408(define-foreign-type cairo_font_extents_t scheme-pointer cairo-font-extents-type-buffer)
409
410(define cairo-font-extents-ascent (foreign-lambda* double ((cairo_font_extents_t e)) "C_return(((cairo_font_extents_t*)e)->ascent);"))
411(define cairo-font-extents-descent (foreign-lambda* double ((cairo_font_extents_t e)) "C_return(((cairo_font_extents_t*)e)->descent);"))
412(define cairo-font-extents-height (foreign-lambda* double ((cairo_font_extents_t e)) "C_return(((cairo_font_extents_t*)e)->height);"))
413(define cairo-font-extents-max-x-advance (foreign-lambda* double ((cairo_font_extents_t e)) "C_return(((cairo_font_extents_t*)e)->max_x_advance);"))
414(define cairo-font-extents-max-y-advance (foreign-lambda* double ((cairo_font_extents_t e)) "C_return(((cairo_font_extents_t*)e)->max_y_advance);"))
415
416(define cairo-font-extents-ascent-set! (foreign-lambda* double ((cairo_font_extents_t e) (double v)) "((cairo_font_extents_t*)e)->ascent = v;"))
417(define cairo-font-extents-descent-set! (foreign-lambda* double ((cairo_font_extents_t e) (double v)) "((cairo_font_extents_t*)e)->descent = v;"))
418(define cairo-font-extents-height-set! (foreign-lambda* double ((cairo_font_extents_t e) (double v)) "((cairo_font_extents_t*)e)->height = v;"))
419(define cairo-font-extents-max-x-advance-set! (foreign-lambda* double ((cairo_font_extents_t e) (double v)) "((cairo_font_extents_t*)e)->max_x_advance = v;"))
420(define cairo-font-extents-max-y-advance-set! (foreign-lambda* double ((cairo_font_extents_t e) (double v)) "((cairo_font_extents_t*)e)->max_y_advance = v;"))
421
422(define cairo-text-extents (foreign-lambda void "cairo_text_extents" cairo_t c-string cairo_text_extents_t))
423
424; was cairo-current-font-extents
425(define cairo-font-extents (foreign-lambda void "cairo_font_extents" cairo_t cairo_font_extents_t))
426
427; Clipping
428; ------------------------------------------------
429
430;; Clipping does reset the path, unless you use the
431;; -preserve functions
432
433; was cairo-init-clip
434(define cairo-reset-clip (foreign-lambda void "cairo_reset_clip" cairo_t))
435
436;; Intersect the current path with the clipping region
437;; for the new clipping region
438(define cairo-clip (foreign-lambda void "cairo_clip" cairo_t))
439
440(define cairo-clip-extents (foreign-lambda void "cairo_clip_extents"
441                                           cairo_t
442                                           (c-pointer double)
443                                           (c-pointer double)
444                                           (c-pointer double)
445                                           (c-pointer double)))
446
447; ------------------------------------------------
448;
449; Fonts and text
450; ------------------------------------------------
451
452(--cairo-flags
453; font weight
454 "CAIRO_FONT_WEIGHT_NORMAL"
455 "CAIRO_FONT_WEIGHT_BOLD"
456 ; and slant
457 "CAIRO_FONT_SLANT_NORMAL"
458 "CAIRO_FONT_SLANT_ITALIC"
459 "CAIRO_FONT_SLANT_OBLIQUE")
460
461; An easy-osy function for choosing a font to use
462; (as usual, affects the context)
463; was cairo-select-font
464(define cairo-select-font-face
465  (foreign-lambda void "cairo_select_font_face"
466                  cairo_t
467                  c-string
468                  integer ; slant
469                  integer ; weight
470                  ))
471
472;; NB regarding font transforms:
473;; cairo_gstate.c has notes regarding font co-ordinate
474;; systems.  I should read them ;-)
475
476; was cairo-scale-font
477(define cairo-set-font-size
478  (foreign-lambda void "cairo_set_font_size" cairo_t double))
479
480; was cairo-transform-font
481(define cairo-set-font-matrix
482  (foreign-lambda void "cairo_set_font_matrix" cairo_t cairo_matrix_t))
483
484(define cairo-show-text
485  (foreign-lambda void "cairo_show_text" cairo_t c-string))
486
487;; There's also cairo_show_glyphs(), which might be useful
488;; if it's worthwhile caching glyphs (I'll look at the cairo
489;; source -- it may well convert text to glyphs every time)
490
491(define-foreign-type cairo_font_t (c-pointer "cairo_font_t")
492  values
493  (cut tag-pointer <> 'cairo-font))
494
495;; Here would be the text extent stuff, certainly useful
496
497;; .. and here, converting fonts to paths
498
499;; .. and some functions for transforming fonts directly
500
501; ------------------------------------------------
502;
503; Context status and query
504; ------------------------------------------------
505
506; All these used to be -current-, now -get-
507
508(define cairo-get-target
509  (foreign-lambda cairo_surface_t "cairo_get_target" cairo_t))
510
511(define cairo-get-operator
512  (foreign-lambda integer "cairo_get_operator" cairo_t))
513
514; cairo-current-rgb-color deprecated
515
516; cairo-current-alpha deprecated
517
518(define cairo-get-matrix
519  (foreign-lambda void "cairo_get_matrix" cairo_t cairo_matrix_t))
520
521;; and some more skipped
522
523;; cairo_status_t
524(--cairo-flags
525  "CAIRO_STATUS_SUCCESS"
526  "CAIRO_STATUS_NO_MEMORY"
527  "CAIRO_STATUS_INVALID_RESTORE"
528  "CAIRO_STATUS_INVALID_POP_GROUP"
529  "CAIRO_STATUS_NO_CURRENT_POINT"
530  "CAIRO_STATUS_INVALID_MATRIX"
531  "CAIRO_STATUS_INVALID_STATUS"
532  "CAIRO_STATUS_NULL_POINTER"
533  "CAIRO_STATUS_INVALID_STRING"
534  "CAIRO_STATUS_INVALID_PATH_DATA"
535  "CAIRO_STATUS_READ_ERROR"
536  "CAIRO_STATUS_WRITE_ERROR"
537  "CAIRO_STATUS_SURFACE_FINISHED"
538  "CAIRO_STATUS_SURFACE_TYPE_MISMATCH"
539  "CAIRO_STATUS_PATTERN_TYPE_MISMATCH"
540  "CAIRO_STATUS_INVALID_CONTENT"
541  "CAIRO_STATUS_INVALID_FORMAT"
542  "CAIRO_STATUS_INVALID_VISUAL"
543  "CAIRO_STATUS_FILE_NOT_FOUND"
544  "CAIRO_STATUS_INVALID_DASH")
545
546
547
548; ------------------------------------------------
549
550; Matrix operations
551; ------------------------------------------------
552
553; (cairo_matrix_t defined earlier)
554
555; NB: These may be renamed to cairo_transform_* in future
556; versions of Cairo.
557
558(define cairo-matrix-init-identity
559  (foreign-lambda void
560                  "cairo_matrix_init_identity"
561                  cairo_matrix_t))
562
563(define cairo-matrix-init
564  (foreign-lambda void
565                  "cairo_matrix_init"
566                  cairo_matrix_t
567                  double double ;; a, b
568                  double double ;; c, d
569                  double double ;; tx, ty
570                  ))
571
572(define cairo-matrix-translate
573  (foreign-lambda void
574                  "cairo_matrix_translate"
575                  cairo_matrix_t
576                  double double ;; x, y
577                  ))
578
579(define cairo-matrix-scale
580  (foreign-lambda void
581                  "cairo_matrix_scale"
582                  cairo_matrix_t
583                  double double ;; x, y
584                  ))
585
586(define cairo-matrix-rotate
587  (foreign-lambda void
588                  "cairo_matrix_rotate"
589                  cairo_matrix_t
590                  double ;; radians
591                  ))
592
593(define cairo-matrix-invert
594  (foreign-lambda integer ;; cairo_status_t
595                  "cairo_matrix_invert"
596                  cairo_matrix_t))
597
598(define cairo-matrix-multiply
599  (foreign-lambda void
600                  "cairo_matrix_multiply"
601                  cairo_matrix_t ;; dest
602                  cairo_matrix_t
603                  cairo_matrix_t))
604
605(define cairo-matrix-transform-distance
606  (foreign-lambda void
607                  "cairo_matrix_transform_distance"
608                  cairo_matrix_t
609                  f64vector f64vector))
610
611(define cairo-matrix-transform-point
612  (foreign-lambda void
613                  "cairo_matrix_transform_point"
614                  cairo_matrix_t
615                  f64vector f64vector))
616
617; PNG Support
618(define cairo-image-surface-create-from-png (foreign-lambda cairo_surface_t
619                                                            "cairo_image_surface_create_from_png"
620                                                            c-string
621                                                            ))
622
623(define cairo-surface-write-to-png (foreign-lambda integer
624                                                   "cairo_surface_write_to_png"
625                                                   cairo_surface_t
626                                                   c-string
627                                                   ))
628
629; Auxiliary
630(define cairo-image-surface-create (foreign-lambda cairo_surface_t
631                                                   "cairo_image_surface_create"
632                                                   integer
633                                                   integer
634                                                   integer
635                                     ))
636
637(define cairo-image-surface-get-width (foreign-lambda int
638                                                      "cairo_image_surface_get_width"
639                                                      cairo_surface_t))
640
641(define cairo-image-surface-get-height (foreign-lambda int
642                                                       "cairo_image_surface_get_height"
643                                                       cairo_surface_t))
644
645(define cairo-mask-surface  (foreign-lambda void
646                                            "cairo_mask_surface"
647                                            cairo_t
648                                            cairo_surface_t
649                                            double
650                                            double))
651
652
653
654(define cairo-paint (foreign-lambda void
655                                    "cairo_paint"
656                                    cairo_t
657                                    ))
658
659(define cairo-paint-with-alpha  (foreign-lambda void
660                                                "cairo_paint_with_alpha"
661                                                cairo_t
662                                                double
663                                                ))
664
665(define cairo-surface-destroy (foreign-lambda void
666                                              "cairo_surface_destroy"
667                                              cairo_surface_t
668                                              ))
669
670(define cairo-surface-flush (foreign-lambda void
671                                            "cairo_surface_flush"
672                                            cairo_surface_t
673                                            ))
674
675(define cairo-surface-finish (foreign-lambda void
676                                             "cairo_surface_finish"
677                                             cairo_surface_t))
678
679(define cairo-surface-show-page (foreign-lambda void
680                                                "cairo_surface_show_page"
681                                                cairo_surface_t))
682
683(define cairo-mask-surface (foreign-lambda void
684                                           "cairo_mask_surface"
685                                           cairo_t
686                                           cairo_surface_t
687                                           double
688                                           double)))
Note: See TracBrowser for help on using the repository browser.