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

Last change on this file since 31288 was 31288, checked in by Christian Kellermann, 7 years ago

Add support for blend mode operators, brought to you by Matt Gushee

File size: 26.2 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 15 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               "CAIRO_OPERATOR_MULTIPLY"
167               "CAIRO_OPERATOR_SCREEN"
168               "CAIRO_OPERATOR_OVERLAY"
169               "CAIRO_OPERATOR_DARKEN"
170               "CAIRO_OPERATOR_LIGHTEN"
171               "CAIRO_OPERATOR_COLOR_DODGE"
172               "CAIRO_OPERATOR_COLOR_BURN"
173               "CAIRO_OPERATOR_HARD_LIGHT"
174               "CAIRO_OPERATOR_SOFT_LIGHT"
175               "CAIRO_OPERATOR_DIFFERENCE"
176               "CAIRO_OPERATOR_EXCLUSION"
177               "CAIRO_OPERATOR_HSL_HUE"
178               "CAIRO_OPERATOR_HSL_SATURATION"
179               "CAIRO_OPERATOR_HSL_COLOR"
180               "CAIRO_OPERATOR_HSL_LUMINOSITY")
181
182; Set the composition operator --
183; see cairo docs or otherwise what they do.
184; http://cairographics.org/samples/snippets.html has
185; pictures of the results.
186(define cairo-set-operator (foreign-lambda void "cairo_set_operator" cairo_t integer))
187
188; formerly cairo-set-rgb-color
189(define cairo-set-source-rgb (foreign-lambda void "cairo_set_source_rgb"
190                                            cairo_t
191                                            double ;red
192                                            double ;green
193                                            double ;blue
194                                            ))
195
196;; Also see cairo-paint-with-alpha
197(define cairo-set-source-rgba (foreign-lambda void "cairo_set_source_rgba"
198                                            cairo_t
199                                            double ;red
200                                            double ;green
201                                            double ;blue
202                                            double ;alpha
203                                            ))
204
205(define cairo-set-source-surface
206  (foreign-lambda void "cairo_set_source_surface"
207                  cairo_t
208                  cairo_surface_t
209                  double ;x
210                  double ;y
211                  ))
212
213; ?
214(define cairo-set-tolerance (foreign-lambda void "cairo_set_tolerance" cairo_t double))
215;; -----------------------------------------------
216;;
217;; Antialias and fill
218;; -----------------------------------------------
219
220(--cairo-flags "CAIRO_ANTIALIAS_DEFAULT"
221               "CAIRO_ANTIALIAS_NONE"
222               "CAIRO_ANTIALIAS_GRAY"
223               "CAIRO_ANTIALIAS_SUBPIXEL")
224
225(define cairo-set-antialias (foreign-lambda void "cairo_set_antialias" cairo_t integer))
226
227(--cairo-flags "CAIRO_FILL_RULE_WINDING"
228               "CAIRO_FILL_RULE_EVEN_ODD")
229
230; Set the fill rule:
231; 'winding' is like a union (anything inside a path)
232; 'even-odd' is like xor (anything inside an odd number of paths)
233(define cairo-set-fill-rule (foreign-lambda void "cairo_set_fill_rule" cairo_t integer))
234
235; ------------------------------------------------
236
237; Lines, joins, and caps
238; ------------------------------------------------
239
240(define cairo-set-line-width (foreign-lambda void "cairo_set_line_width" cairo_t double))
241
242(--cairo-flags "CAIRO_LINE_CAP_BUTT"
243               "CAIRO_LINE_CAP_ROUND"
244               "CAIRO_LINE_CAP_SQUARE")
245
246(define cairo-set-line-cap (foreign-lambda void "cairo_set_line_cap" cairo_t integer))
247
248(--cairo-flags "CAIRO_LINE_JOIN_MITER"
249               "CAIRO_LINE_JOIN_ROUND"
250               "CAIRO_LINE_JOIN_BEVEL")
251
252(define cairo-set-line-join (foreign-lambda void "cairo_set_line_join" cairo_t integer))
253
254(define cairo-set-dash (foreign-lambda void "cairo_set_dash" cairo_t f64vector integer double))
255
256(define cairo-set-miter-limit (foreign-lambda void "cairo_set_miter_limit" cairo_t double))
257
258; ------------------------------------------------
259
260; Context transform operations
261; ------------------------------------------------
262
263;; These following operate on the current transform of
264;; the context -- there are also operations on arbitrary
265;; transforms further on (but perhaps not yet)
266
267(define cairo-translate (foreign-lambda void "cairo_translate" cairo_t double double))
268
269(define cairo-scale (foreign-lambda void "cairo_scale" cairo_t double double))
270
271(define cairo-rotate (foreign-lambda void "cairo_rotate" cairo_t double))
272
273(define cairo-transform (foreign-lambda void "cairo_transform" cairo_t cairo_matrix_t))
274
275(define cairo-set-matrix (foreign-lambda void "cairo_set_matrix" cairo_t cairo_matrix_t))
276
277(define cairo-identity-matrix (foreign-lambda void "cairo_identity_matrix" cairo_t))
278
279;; Matrix operations
280
281(define-foreign-type cairo_matrix_t (c-pointer "cairo_matrix_t")
282  values
283  (cut tag-pointer <> 'cairo-matrix))
284
285(define %fill-matrix
286  (foreign-lambda* (c-pointer cairo_matrix_t)
287                   ((f64vector v))
288                   "cairo_matrix_t *m = malloc(sizeof(cairo_matrix_t));
289                    int i=0;
290                    m->xx = v[i++];
291                    m->xy = v[i++];
292                    m->yx = v[i++];
293                    m->yx = v[i++];
294                    m->x0 = v[i++];
295                    m->y0 = v[i++];
296                    C_return(m);"))
297
298(define (cairo-transform/matrix ctx v)
299  (when (not (= (f64vector-length v) 6))
300    (error "Vector size mismatch should be 6, is " (f64vector-length v)))
301  (let ((m (%fill-matrix v)))
302    (cairo-transform ctx m)
303    (free m)))
304
305(define cairo-new-matrix
306  (foreign-lambda* cairo_matrix_t ()
307    "C_return(malloc(sizeof(cairo_matrix_t)));"))
308
309; accessors for each element might be nice, but probably not
310; immediately necessary
311
312; cairo-concat-matrix replaced by cairo-transform
313
314; cairo-matrix-set replaced by cairo-set-matrix
315
316; was cairo-transform-point
317(define cairo-user-to-device (foreign-lambda void "cairo_user_to_device" cairo_t f64vector f64vector))
318
319; was cairo-transform-distance
320(define cairo-user-to-device-distance (foreign-lambda void "cairo_user_to_device" cairo_t f64vector f64vector))
321
322; was cairo-inverse-transform-point
323(define cairo-device-to-user (foreign-lambda void "cairo_device_to_user" cairo_t f64vector f64vector))
324
325; was cairo-inverse-transform-distance
326(define cairo-device-to-user-distance (foreign-lambda void "cairo_device_to_user_distance" cairo_t f64vector f64vector))
327
328; ------------------------------------------------
329
330; Path creation
331; ------------------------------------------------
332
333;; Note that actually drawing paths is destructive;
334;; it will erase the current path.  Use cairo_save
335;; and cairo_restore if you want to use a path for
336;; more than one drawing operation.  Clipping is
337;; _not_ destructive.
338
339(define cairo-new-path (foreign-lambda void "cairo_new_path" cairo_t))
340
341(define cairo-move-to (foreign-lambda void "cairo_move_to" cairo_t double double))
342
343(define cairo-line-to (foreign-lambda void "cairo_line_to" cairo_t double double))
344
345(define cairo-curve-to (foreign-lambda void "cairo_curve_to" cairo_t double double double double double double))
346
347(define cairo-arc (foreign-lambda void "cairo_arc" cairo_t double double double double double))
348
349(define cairo-arc-negative (foreign-lambda void "cairo_arc_negative" cairo_t double double double double double))
350
351;; there's some relative move_to etc. things here .. mneh
352
353(define cairo-rectangle (foreign-lambda void "cairo_rectangle" cairo_t double double double double))
354
355;; Finish the current shape so you can draw another disjoint one
356(define cairo-close-path (foreign-lambda void "cairo_close_path" cairo_t))
357
358; ------------------------------------------------
359
360; Drawing operations
361; ------------------------------------------------
362
363(define cairo-stroke (foreign-lambda void "cairo_stroke" cairo_t))
364
365(define cairo-fill (foreign-lambda void "cairo_fill" cairo_t))
366
367; ------------------------------------------------
368
369; Insideness testing ... mneh
370; ------------------------------------------------
371
372(define-foreign-variable sizeof-cairo-text-extents int "sizeof(cairo_text_extents_t)")
373
374;; We want a garbage-collectable type here; wrap a record type around a byte vector buffer, and make
375;; chicken type-pun the buffer to the C struct.  We only ever construct these to hand to a function
376;; for filling in, so no initialisation needed aside from the buffer.
377(define-record cairo-text-extents-type buffer)
378(let ((maker make-cairo-text-extents-type))
379  (set! make-cairo-text-extents-type
380    (lambda () (maker (make-blob sizeof-cairo-text-extents)))))
381
382(define-record-printer (cairo-text-extents-type te out)
383  (for-each (lambda (x) (display x out))
384                    (list "#<cairo-text-extents "
385                          (cairo-text-extents-x-bearing te)" "
386                          (cairo-text-extents-y-bearing te)" "
387                          (cairo-text-extents-width te)" "
388                          (cairo-text-extents-height te)" "
389                          (cairo-text-extents-x-advance te)" "
390                          (cairo-text-extents-y-advance te)">")))
391
392(define-foreign-type cairo_text_extents_t scheme-pointer cairo-text-extents-type-buffer)
393
394(define cairo-text-extents-x-bearing (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->x_bearing);"))
395(define cairo-text-extents-y-bearing (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->y_bearing);"))
396(define cairo-text-extents-width (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->width);"))
397(define cairo-text-extents-height (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->height);"))
398(define cairo-text-extents-x-advance (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->x_advance);"))
399(define cairo-text-extents-y-advance (foreign-lambda* double ((cairo_text_extents_t te)) "C_return(((cairo_text_extents_t*)te)->y_advance);"))
400
401(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;"))
402(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;"))
403(define cairo-text-extents-width-set! (foreign-lambda* double ((cairo_text_extents_t te) (double v)) "((cairo_text_extents_t*)te)->width = v;"))
404(define cairo-text-extents-height-set! (foreign-lambda* double ((cairo_text_extents_t te) (double v)) "((cairo_text_extents_t*)te)->height = v;"))
405(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;"))
406(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;"))
407
408(define-foreign-variable sizeof-cairo-font-extents int "sizeof(cairo_font_extents_t)")
409
410(define-record cairo-font-extents-type buffer)
411(let ((maker make-cairo-font-extents-type))
412  (set! make-cairo-font-extents-type
413    (lambda () (maker (make-blob sizeof-cairo-font-extents)))))
414
415(define-record-printer (cairo-font-extents-type e out)
416  (for-each (lambda (x) (display x out))
417                    (list "#<cairo-font-extents "
418                          (cairo-font-extents-ascent e)" "
419                          (cairo-font-extents-descent e)" "
420                          (cairo-font-extents-height e)" "
421                          (cairo-font-extents-max-x-advance e)" "
422                          (cairo-font-extents-max-y-advance e)">")))
423
424(define-foreign-type cairo_font_extents_t scheme-pointer cairo-font-extents-type-buffer)
425
426(define cairo-font-extents-ascent (foreign-lambda* double ((cairo_font_extents_t e)) "C_return(((cairo_font_extents_t*)e)->ascent);"))
427(define cairo-font-extents-descent (foreign-lambda* double ((cairo_font_extents_t e)) "C_return(((cairo_font_extents_t*)e)->descent);"))
428(define cairo-font-extents-height (foreign-lambda* double ((cairo_font_extents_t e)) "C_return(((cairo_font_extents_t*)e)->height);"))
429(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);"))
430(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);"))
431
432(define cairo-font-extents-ascent-set! (foreign-lambda* double ((cairo_font_extents_t e) (double v)) "((cairo_font_extents_t*)e)->ascent = v;"))
433(define cairo-font-extents-descent-set! (foreign-lambda* double ((cairo_font_extents_t e) (double v)) "((cairo_font_extents_t*)e)->descent = v;"))
434(define cairo-font-extents-height-set! (foreign-lambda* double ((cairo_font_extents_t e) (double v)) "((cairo_font_extents_t*)e)->height = v;"))
435(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;"))
436(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;"))
437
438(define cairo-text-extents (foreign-lambda void "cairo_text_extents" cairo_t c-string cairo_text_extents_t))
439
440; was cairo-current-font-extents
441(define cairo-font-extents (foreign-lambda void "cairo_font_extents" cairo_t cairo_font_extents_t))
442
443; Clipping
444; ------------------------------------------------
445
446;; Clipping does reset the path, unless you use the
447;; -preserve functions
448
449; was cairo-init-clip
450(define cairo-reset-clip (foreign-lambda void "cairo_reset_clip" cairo_t))
451
452;; Intersect the current path with the clipping region
453;; for the new clipping region
454(define cairo-clip (foreign-lambda void "cairo_clip" cairo_t))
455
456(define cairo-clip-extents (foreign-lambda void "cairo_clip_extents"
457                                           cairo_t
458                                           (c-pointer double)
459                                           (c-pointer double)
460                                           (c-pointer double)
461                                           (c-pointer double)))
462
463; ------------------------------------------------
464;
465; Fonts and text
466; ------------------------------------------------
467
468(--cairo-flags
469; font weight
470 "CAIRO_FONT_WEIGHT_NORMAL"
471 "CAIRO_FONT_WEIGHT_BOLD"
472 ; and slant
473 "CAIRO_FONT_SLANT_NORMAL"
474 "CAIRO_FONT_SLANT_ITALIC"
475 "CAIRO_FONT_SLANT_OBLIQUE")
476
477; An easy-osy function for choosing a font to use
478; (as usual, affects the context)
479; was cairo-select-font
480(define cairo-select-font-face
481  (foreign-lambda void "cairo_select_font_face"
482                  cairo_t
483                  c-string
484                  integer ; slant
485                  integer ; weight
486                  ))
487
488;; NB regarding font transforms:
489;; cairo_gstate.c has notes regarding font co-ordinate
490;; systems.  I should read them ;-)
491
492; was cairo-scale-font
493(define cairo-set-font-size
494  (foreign-lambda void "cairo_set_font_size" cairo_t double))
495
496; was cairo-transform-font
497(define cairo-set-font-matrix
498  (foreign-lambda void "cairo_set_font_matrix" cairo_t cairo_matrix_t))
499
500(define cairo-show-text
501  (foreign-lambda void "cairo_show_text" cairo_t c-string))
502
503;; There's also cairo_show_glyphs(), which might be useful
504;; if it's worthwhile caching glyphs (I'll look at the cairo
505;; source -- it may well convert text to glyphs every time)
506
507(define-foreign-type cairo_font_t (c-pointer "cairo_font_t")
508  values
509  (cut tag-pointer <> 'cairo-font))
510
511;; Here would be the text extent stuff, certainly useful
512
513;; .. and here, converting fonts to paths
514
515;; .. and some functions for transforming fonts directly
516
517; ------------------------------------------------
518;
519; Context status and query
520; ------------------------------------------------
521
522; All these used to be -current-, now -get-
523
524(define cairo-get-target
525  (foreign-lambda cairo_surface_t "cairo_get_target" cairo_t))
526
527(define cairo-get-operator
528  (foreign-lambda integer "cairo_get_operator" cairo_t))
529
530; cairo-current-rgb-color deprecated
531
532; cairo-current-alpha deprecated
533
534(define cairo-get-matrix
535  (foreign-lambda void "cairo_get_matrix" cairo_t cairo_matrix_t))
536
537;; and some more skipped
538
539;; cairo_status_t
540(--cairo-flags
541  "CAIRO_STATUS_SUCCESS"
542  "CAIRO_STATUS_NO_MEMORY"
543  "CAIRO_STATUS_INVALID_RESTORE"
544  "CAIRO_STATUS_INVALID_POP_GROUP"
545  "CAIRO_STATUS_NO_CURRENT_POINT"
546  "CAIRO_STATUS_INVALID_MATRIX"
547  "CAIRO_STATUS_INVALID_STATUS"
548  "CAIRO_STATUS_NULL_POINTER"
549  "CAIRO_STATUS_INVALID_STRING"
550  "CAIRO_STATUS_INVALID_PATH_DATA"
551  "CAIRO_STATUS_READ_ERROR"
552  "CAIRO_STATUS_WRITE_ERROR"
553  "CAIRO_STATUS_SURFACE_FINISHED"
554  "CAIRO_STATUS_SURFACE_TYPE_MISMATCH"
555  "CAIRO_STATUS_PATTERN_TYPE_MISMATCH"
556  "CAIRO_STATUS_INVALID_CONTENT"
557  "CAIRO_STATUS_INVALID_FORMAT"
558  "CAIRO_STATUS_INVALID_VISUAL"
559  "CAIRO_STATUS_FILE_NOT_FOUND"
560  "CAIRO_STATUS_INVALID_DASH")
561
562
563
564; ------------------------------------------------
565
566; Matrix operations
567; ------------------------------------------------
568
569; (cairo_matrix_t defined earlier)
570
571; NB: These may be renamed to cairo_transform_* in future
572; versions of Cairo.
573
574(define cairo-matrix-init-identity
575  (foreign-lambda void
576                  "cairo_matrix_init_identity"
577                  cairo_matrix_t))
578
579(define cairo-matrix-init
580  (foreign-lambda void
581                  "cairo_matrix_init"
582                  cairo_matrix_t
583                  double double ;; a, b
584                  double double ;; c, d
585                  double double ;; tx, ty
586                  ))
587
588(define cairo-matrix-translate
589  (foreign-lambda void
590                  "cairo_matrix_translate"
591                  cairo_matrix_t
592                  double double ;; x, y
593                  ))
594
595(define cairo-matrix-scale
596  (foreign-lambda void
597                  "cairo_matrix_scale"
598                  cairo_matrix_t
599                  double double ;; x, y
600                  ))
601
602(define cairo-matrix-rotate
603  (foreign-lambda void
604                  "cairo_matrix_rotate"
605                  cairo_matrix_t
606                  double ;; radians
607                  ))
608
609(define cairo-matrix-invert
610  (foreign-lambda integer ;; cairo_status_t
611                  "cairo_matrix_invert"
612                  cairo_matrix_t))
613
614(define cairo-matrix-multiply
615  (foreign-lambda void
616                  "cairo_matrix_multiply"
617                  cairo_matrix_t ;; dest
618                  cairo_matrix_t
619                  cairo_matrix_t))
620
621(define cairo-matrix-transform-distance
622  (foreign-lambda void
623                  "cairo_matrix_transform_distance"
624                  cairo_matrix_t
625                  f64vector f64vector))
626
627(define cairo-matrix-transform-point
628  (foreign-lambda void
629                  "cairo_matrix_transform_point"
630                  cairo_matrix_t
631                  f64vector f64vector))
632
633; PNG Support
634(define cairo-image-surface-create-from-png (foreign-lambda cairo_surface_t
635                                                            "cairo_image_surface_create_from_png"
636                                                            c-string
637                                                            ))
638
639(define cairo-surface-write-to-png (foreign-lambda integer
640                                                   "cairo_surface_write_to_png"
641                                                   cairo_surface_t
642                                                   c-string
643                                                   ))
644
645; Auxiliary
646(define cairo-image-surface-create (foreign-lambda cairo_surface_t
647                                                   "cairo_image_surface_create"
648                                                   integer
649                                                   integer
650                                                   integer
651                                     ))
652
653(define cairo-image-surface-get-width (foreign-lambda int
654                                                      "cairo_image_surface_get_width"
655                                                      cairo_surface_t))
656
657(define cairo-image-surface-get-height (foreign-lambda int
658                                                       "cairo_image_surface_get_height"
659                                                       cairo_surface_t))
660
661(define cairo-mask-surface  (foreign-lambda void
662                                            "cairo_mask_surface"
663                                            cairo_t
664                                            cairo_surface_t
665                                            double
666                                            double))
667
668
669
670(define cairo-paint (foreign-lambda void
671                                    "cairo_paint"
672                                    cairo_t
673                                    ))
674
675(define cairo-paint-with-alpha  (foreign-lambda void
676                                                "cairo_paint_with_alpha"
677                                                cairo_t
678                                                double
679                                                ))
680
681(define cairo-surface-destroy (foreign-lambda void
682                                              "cairo_surface_destroy"
683                                              cairo_surface_t
684                                              ))
685
686(define cairo-surface-flush (foreign-lambda void
687                                            "cairo_surface_flush"
688                                            cairo_surface_t
689                                            ))
690
691(define cairo-surface-finish (foreign-lambda void
692                                             "cairo_surface_finish"
693                                             cairo_surface_t))
694
695(define cairo-surface-show-page (foreign-lambda void
696                                                "cairo_surface_show_page"
697                                                cairo_surface_t))
698
699(define cairo-mask-surface (foreign-lambda void
700                                           "cairo_mask_surface"
701                                           cairo_t
702                                           cairo_surface_t
703                                           double
704                                           double)))
Note: See TracBrowser for help on using the repository browser.