Commitb26f455aRecorded3 Mar 2026Repositorysigil-cairo
Add cairo-image-surface-create-from-png to cairo bindings
Changed
src/cairo.sgl | 12 ++++++++++++
1 file changed, 12 insertions(+)Diff
src/cairo.sglmodified
@@ -97,6 +97,7 @@
97
98
;; Surfaces 99
cairo-image-surface-create+100
cairo-image-surface-create-from-png 101
cairo-surface-destroy 102
cairo-surface-write-to-png 103
cairo-surface-flush@@ -349,6 +350,10 @@
350
(c-function cairo-lib "cairo_image_surface_create" 351
(list ffi/int ffi/int ffi/int) ffi/pointer)) 352
+353
(define %image-surface-create-from-png+354
(c-function cairo-lib "cairo_image_surface_create_from_png"+355
(list ffi/string) ffi/pointer))+356
357
(define %surface-destroy 358
(c-function cairo-lib "cairo_surface_destroy" 359
(list ffi/pointer) ffi/void))@@ -697,6 +702,13 @@
702
(set-pointer-finalizer! surface %surface-destroy-ptr) 703
surface)) 704
+705
;;; Create an image surface from a PNG file.+706
(define (cairo-image-surface-create-from-png filename)+707
(: string? -> pointer?)+708
(let ((surface (%image-surface-create-from-png filename)))+709
(set-pointer-finalizer! surface %surface-destroy-ptr)+710
surface))+711
712
;;; Destroy a surface, freeing its resources. 713
(define (cairo-surface-destroy surface) 714
(: pointer? -> void?)