;(include "pangocairo")
+(typedef cairo_content_t
+ (enum _cairo_content
+ (CAIRO_CONTENT_COLOR)
+ (CAIRO_CONTENT_ALPHA)
+ (CAIRO_CONTENT_COLOR_ALPHA)))
+
+(typedef cairo_format_t
+ (enum _cairo_format
+ (CAIRO_FORMAT_ARGB32)
+ (CAIRO_FORMAT_RGB24)
+ (CAIRO_FORMAT_A8)
+ (CAIRO_FORMAT_A1)))
+
(extern void gdk_cairo_set_source_pixbuf
(cr (* cairo_t))
(pixbuf (* (const GdkPixbuf)))
(window (* GdkWindow))
(x gint) (y gint) (width gint) (height gint))
+(extern gint gdk_window_get_scale_factor
+ (window (* GdkWindow)))
+
#;(extern (* GdkWindow) gdk_window_get_pointer
(window (* GdkWindow))
(x (* gint))
(window (* GdkWindow))
(cursor (* GdkCursor)))
+(extern (* cairo_surface_t)
+ gdk_window_create_similar_surface
+ (window (* GdkWindow))
+ (content cairo_content_t)
+ (width int)
+ (height int))
+
+(extern (* cairo_surface_t)
+ gdk_window_create_similar_image_surface
+ (window (* GdkWindow))
+ (format cairo_format_t)
+ (width int)
+ (height int)
+ (scale int))
+
(extern void
gdk_window_invalidate_rect
(window (* GdkWindow))
(define-integrable-operator (guarantee-gdk-window object operator)
(if (not (and (alien? object) (eq? '|GdkWindow| (alien/ctype object))))
(error:wrong-type-argument object "a GdkWindow address" operator)))
+
+(define (gdk-window-create-similar-surface window width height)
+ (let ((surface (make-alien '|cairo_surface_t|))
+ (copy (make-alien '|cairo_surface_t|)))
+ (add-glib-cleanup surface (make-cairo-surface-cleanup copy))
+ (C-call "gdk_window_create_similar_surface" copy
+ window (C-enum "CAIRO_CONTENT_COLOR") width height)
+ (copy-alien-address! surface copy)
+ (check-cairo-surface-status surface)
+ surface))
+
+(define (gdk-window-create-similar-image-surface window width height scale)
+ (let ((surface (make-alien '|cairo_surface_t|))
+ (copy (make-alien '|cairo_surface_t|)))
+ (add-glib-cleanup surface (make-cairo-surface-cleanup copy))
+ (C-call "gdk_window_create_similar_image_surface" copy
+ window (C-enum "CAIRO_FORMAT_RGB24") width height scale)
+ (copy-alien-address! surface copy)
+ (check-cairo-surface-status surface)
+ surface))
\f
;;; GdkPixbufLoaders
(files "gdk")
;;(depends-on "gtk-const.bin")
(import (cairo)
- make-cairo-cleanup check-cairo-status)
+ check-cairo-status
+ check-cairo-surface-status
+ make-cairo-cleanup
+ make-cairo-surface-cleanup)
(import (runtime ffi)
alien/address)
(import (glib main)
maybe-yield-glib)
(export (gtk)
+ gdk-window-create-similar-surface
+ gdk-window-create-similar-image-surface
<pixbuf-loader> make-pixbuf-loader
load-pixbuf-from-port load-pixbuf-from-file
pixbuf-loader-size-hook set-pixbuf-loader-size-hook!