Ticket #1848: 0003-cairo-Expose-cairo_matrix_t-accessors.patch

File 0003-cairo-Expose-cairo_matrix_t-accessors.patch, 2.7 KB (added by Vasilij Schneidermann, 4 days ago)
  • cairo/0.1.18/cairo.scm

    From 65f614c87aa29ee8fd12db48c92a739b08e137f6 Mon Sep 17 00:00:00 2001
    From: Vasilij Schneidermann <mail@vasilij.de>
    Date: Thu, 2 Jan 2025 19:31:09 +0100
    Subject: [PATCH 3/4] cairo: Expose cairo_matrix_t accessors
    
    ---
     cairo/0.1.18/cairo.scm | 23 +++++++++++++++++++++++
     1 file changed, 23 insertions(+)
    
    diff --git a/cairo/0.1.18/cairo.scm b/cairo/0.1.18/cairo.scm
    index 6f8ff693..2629fe36 100644
    a b EOF 
    283283  (set! make-cairo-matrix-type
    284284    (lambda () (maker (make-blob sizeof-cairo-matrix)))))
    285285
     286(define-record-printer (cairo-matrix-type m out)
     287  (for-each (lambda (x) (display x out))
     288                    (list "#<cairo-matrix "
     289                          (cairo-matrix-xx m)" "
     290                          (cairo-matrix-yx m)" "
     291                          (cairo-matrix-xy m)" "
     292                          (cairo-matrix-yy m)" "
     293                          (cairo-matrix-x0 m)" "
     294                          (cairo-matrix-y0 m)">")))
     295
    286296(define-foreign-type cairo_matrix_t scheme-pointer cairo-matrix-type-buffer)
    287297
    288298(define (cairo-transform/matrix ctx v)
    EOF 
    298308                       (f64vector-ref v 5))
    299309    (cairo-transform ctx matrix)))
    300310
     311(define cairo-matrix-xx (foreign-lambda* double ((cairo_matrix_t m)) "C_return(((cairo_matrix_t *)m)->xx);"))
     312(define cairo-matrix-yx (foreign-lambda* double ((cairo_matrix_t m)) "C_return(((cairo_matrix_t *)m)->yx);"))
     313(define cairo-matrix-xy (foreign-lambda* double ((cairo_matrix_t m)) "C_return(((cairo_matrix_t *)m)->xy);"))
     314(define cairo-matrix-yy (foreign-lambda* double ((cairo_matrix_t m)) "C_return(((cairo_matrix_t *)m)->yy);"))
     315(define cairo-matrix-x0 (foreign-lambda* double ((cairo_matrix_t m)) "C_return(((cairo_matrix_t *)m)->x0);"))
     316(define cairo-matrix-y0 (foreign-lambda* double ((cairo_matrix_t m)) "C_return(((cairo_matrix_t *)m)->y0);"))
     317
     318(define cairo-matrix-xx-set! (foreign-lambda* void ((cairo_matrix_t m) (double v)) "((cairo_matrix_t *)m)->xx = v;"))
     319(define cairo-matrix-yx-set! (foreign-lambda* void ((cairo_matrix_t m) (double v)) "((cairo_matrix_t *)m)->yx = v;"))
     320(define cairo-matrix-xy-set! (foreign-lambda* void ((cairo_matrix_t m) (double v)) "((cairo_matrix_t *)m)->xy = v;"))
     321(define cairo-matrix-yy-set! (foreign-lambda* void ((cairo_matrix_t m) (double v)) "((cairo_matrix_t *)m)->yy = v;"))
     322(define cairo-matrix-x0-set! (foreign-lambda* void ((cairo_matrix_t m) (double v)) "((cairo_matrix_t *)m)->x0 = v;"))
     323(define cairo-matrix-y0-set! (foreign-lambda* void ((cairo_matrix_t m) (double v)) "((cairo_matrix_t *)m)->y0 = v;"))
    301324
    302325; accessors for each element might be nice, but probably not
    303326; immediately necessary