From: Dmitry Kalyanov Date: Sat, 7 Nov 2009 03:36:06 +0000 (+0300) Subject: Add Gdk/Pixbufs X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=402600a5af7e5ed830a4313eeb9cfb9c8fc4b0d3;p=cl-gtk2.git Add Gdk/Pixbufs --- diff --git a/gdk/cl-gtk2-gdk.asd b/gdk/cl-gtk2-gdk.asd index b7cd1ad..d511314 100644 --- a/gdk/cl-gtk2-gdk.asd +++ b/gdk/cl-gtk2-gdk.asd @@ -15,5 +15,6 @@ (:file "gdk.drawing-primitives") (:file "gdk.bitmaps") (:file "gdk.rgb") - (:file "gdk.images")) + (:file "gdk.images") + (:file "gdk.pixbufs")) :depends-on (:cl-gtk2-glib :cffi :cl-gtk2-pango)) \ No newline at end of file diff --git a/gdk/gdk.functions.lisp b/gdk/gdk.functions.lisp index 922f841..810a0a2 100644 --- a/gdk/gdk.functions.lisp +++ b/gdk/gdk.functions.lisp @@ -25,22 +25,6 @@ (name :string) (only-if-exists :boolean)) -(defcfun gdk-pixbuf-get-from-drawable (g-object pixbuf :already-referenced) - (dest (g-object pixbuf)) - (src (g-object drawable)) - (colormap :pointer) - (src-x :int) - (src-y :int) - (dest-x :int) - (dest-y :int) - (width :int) - (height :int)) - -(defun pixbuf-get-from-drawable (pixbuf drawable &key (src-x 0) (src-y 0) (dest-x 0) (dest-y 0) (width -1) (height -1)) - (gdk-pixbuf-get-from-drawable pixbuf drawable (null-pointer) src-x src-y dest-x dest-y width height)) - -(export 'pixbuf-get-from-drawable) - (defcfun gdk-pixbuf-savev :boolean (pixbuf (g-object pixbuf)) (filename :string) diff --git a/gdk/gdk.objects.lisp b/gdk/gdk.objects.lisp index 884b339..aa2c59c 100644 --- a/gdk/gdk.objects.lisp +++ b/gdk/gdk.objects.lisp @@ -671,3 +671,9 @@ (:shared 1) (:fastest 2)) +(define-g-enum "GdkPixbufAlphaMode" + pixbuf-alpha-mode + (:export t :type-initializer "gdk_pixbuf_alpha_mode_get_type") + (:bilevel 0) + (:full 1)) + diff --git a/gdk/gdk.pixbufs.lisp b/gdk/gdk.pixbufs.lisp new file mode 100644 index 0000000..91c7427 --- /dev/null +++ b/gdk/gdk.pixbufs.lisp @@ -0,0 +1,108 @@ +(in-package :gdk) + +(defcfun (pixbuf-render-threshold-alpha "gdk_pixbuf_render_threshold_alpha") :void + (pixbuf (g-object pixbuf)) + (bitmap (g-object bitmap)) + (src-x :int) + (src-y :int) + (dest-x :int) + (dest-y :int) + (width :int) + (height :int) + (alpha-threshold :int)) + +(export 'pixbuf-render-threshold-alpha) + +(defcfun (pixbuf-render-to-drawable "gdk_pixbuf_render_to_drawable") :void + (pixbuf (g-object pixbuf)) + (drawable (g-object drawable)) + (gc (g-object graphics-context)) + (src-x :int) + (src-y :int) + (dest-x :int) + (dest-y :int) + (width :int) + (height :int) + (dither rgb-dither) + (x-dither :int) + (y-dither :int)) + +(export 'pixbuf-render-to-drawable) + +(defcfun (pixbuf-render-to-drawable-alpha "gdk_pixbuf_render_to_drawable_alpha") :void + (pixbuf (g-object pixbuf)) + (drawable (g-object drawable)) + (src-x :int) + (src-y :int) + (dest-x :int) + (dest-y :int) + (width :int) + (height :int) + (alpha-mode pixbuf-alpha-mode) + (alpha-threshold :int) + (dither rgb-dither) + (x-dither :int) + (y-dither :int)) + +(export 'pixbuf-render-to-drawable-alpha) + +(defcfun gdk-pixbuf-render-pixmap-and-mask :void + (pixbuf (g-object pixbuf)) + (pixmap-return :pointer) + (mask-return :pointer) + (alpha-threshold :int)) + +(defun pixbuf-render-pixmap-and-mask (pixbuf alpha-threshold) + (with-foreign-objects ((pixmap-return :pointer) (mask-return :pointer)) + (gdk-pixbuf-render-pixmap-and-mask pixbuf pixmap-return mask-return alpha-threshold) + (values (convert-from-foreign (mem-ref pixmap-return :pointer) '(g-object pixmap :already-referenced)) + (convert-from-foreign (mem-ref mask-return :pointer) '(g-object pixmap :already-referenced))))) + +(export 'pixbuf-render-pixmap-and-mask) + +(defcfun gdk-pixbuf-render-pixmap-and-mask-for-colormap :void + (pixbuf (g-object pixbuf)) + (colormap (g-object colormap)) + (pixmap-return :pointer) + (mask-return :pointer) + (alpha-threshold :int)) + +(defun pixbuf-render-pixmap-and-mask-for-colormap (pixbuf colormap alpha-threshold) + (with-foreign-objects ((pixmap-return :pointer) (mask-return :pointer)) + (gdk-pixbuf-render-pixmap-and-mask-for-colormap pixbuf colormap pixmap-return mask-return alpha-threshold) + (values (convert-from-foreign (mem-ref pixmap-return :pointer) '(g-object pixmap :already-referenced)) + (convert-from-foreign (mem-ref mask-return :pointer) '(g-object pixmap :already-referenced))))) + +(export 'pixbuf-render-pixmap-and-mask-for-colormap) + +(defcfun gdk-pixbuf-get-from-drawable (g-object pixbuf :already-referenced) + (dest (g-object pixbuf)) + (src (g-object drawable)) + (colormap :pointer) + (src-x :int) + (src-y :int) + (dest-x :int) + (dest-y :int) + (width :int) + (height :int)) + +(defun pixbuf-get-from-drawable (pixbuf drawable &key (src-x 0) (src-y 0) (dest-x 0) (dest-y 0) (width -1) (height -1)) + (gdk-pixbuf-get-from-drawable pixbuf drawable (null-pointer) src-x src-y dest-x dest-y width height)) + +(export 'pixbuf-get-from-drawable) + +(defcfun gdk-pixbuf-get-from-image (g-object pixbuf :already-referenced) + (dest (g-object pixbuf)) + (src (g-object gdk-image)) + (colormap :pointer) + (src-x :int) + (src-y :int) + (dest-x :int) + (dest-y :int) + (width :int) + (height :int)) + +(defun pixbuf-get-from-image (pixbuf image &key (src-x 0) (src-y 0) (dest-x 0) (dest-y 0) (width -1) (height -1)) + (gdk-pixbuf-get-from-image pixbuf image (null-pointer) src-x src-y dest-x dest-y width height)) + +(export 'pixbuf-get-from-image)