;; cairo-rn.ffi				-*- Scheme -*-

;; Copyright (C) 2018,2024 Matthew Wette
;;
;; Copying and distribution of this file, with or without modification,
;; are permitted in any medium without royalty provided the copyright
;; notice and this notice are preserved.  This file is offered as-is,
;; without any warranty.

(define-ffi-module (ffi cairo-rn)
  #:pkg-config "cairo"
  #:include '("cairo.h")
  #:renamer (lambda (name ctxt)
              (define (cnvt name) 
                (string-map (lambda (c) (if (char=? c #\_) #\- c)) name))
              (case ctxt
                ((enum) name)
                ((field) (cnvt name))
                ((function) (cnvt name))
                ((type) name)
                (else name)))
  #:export (M_PI M_2PI make-cairo-unit-matrix))

(define (make-cairo-unit-matrix)
  (make-cdata cairo_matrix_t
              `((xx 1.0) (yx 0.0) (xy 0.0) (yy 1.0) (x0 0.0) (y0 0.0))))

(define M_PI 3.14159265358979323846)
(define M_2PI 6.28318530717958647692)

;; --- last line ---
