From: Heiher Date: Mon, 20 Aug 2012 09:37:34 +0000 (+0200) Subject: x11: Add XImage bindings X-Git-Tag: 0.17.5~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9cc8cc447b7088ddd668035992ff82505191f6e8;p=thirdparty%2Fvala.git x11: Add XImage bindings Fixes bug 681961. --- diff --git a/vapi/x11.vapi b/vapi/x11.vapi index e056224f2..5eae3c159 100644 --- a/vapi/x11.vapi +++ b/vapi/x11.vapi @@ -319,6 +319,13 @@ namespace X { public uchar[] modifiermap; } + public const ulong AllPlanes; + + [SimpleType] + [CCode (cname = "XPointer")] + public struct Pointer { + } + [SimpleType] [IntegerType (rank = 9)] [CCode (cname = "Atom", type_id = "G_TYPE_LONG", @@ -430,6 +437,27 @@ namespace X { public struct KeyCode { } + [Compact] + [CCode (cname = "XImage", free_function = "XDestroyImage")] + public class Image { + public int width; + public int height; + public int xoffset; + public int format; + public char *data; + public int byte_order; + public int bitmap_unit; + public int bitmap_bit_order; + public int bitmap_pad; + public int depth; + public int bytes_per_line; + public int bits_per_pixel; + public ulong red_mask; + public ulong green_mask; + public ulong blue_mask; + public Pointer obdata; + } + [CCode (ref_function = "", unref_function = "")] [Compact] public class Visual { @@ -452,9 +480,43 @@ namespace X { public int height; } + [CCode (cprefix = "", cname = "int")] + public enum ImageFormat { + XYBitmap, + XYPixmap, + ZPixmap; + } + [CCode (cname = "XCreateWindow")] public Window create_window (Display display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint @class, Visual? visual, X.CW valuemask, ref SetWindowAttributes attributes); + [CCode (cname = "XCreateImage")] + public unowned Image create_image (Display display, Visual u, uint depth, int format, int offset, char *data, uint width, uint height, int bitmap_pad, int bytes_per_line); + + [CCode (cname = "XInitImage")] + public Status init_image (Image img); + + [CCode (cname = "XGetImage")] + public Image get_image (Display display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format); + + [CCode (cname = "XGetSubImage")] + public Image get_sub_image (Display display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format, Image img, int dest_x, int dest_y); + + [CCode (cname = "XPutImage")] + public int put_image (Display display, Drawable d, GC gc, Image img, int src_x, int src_y, int dest_x, int dest_y, uint width, uint height); + + [CCode (cname = "XGetPixel")] + public ulong get_pixel (Image img, int x, int y); + + [CCode (cname = "XPutPixel")] + public int put_pixel (Image img, int x, int y, ulong pixel); + + [CCode (cname = "XSubImage")] + public Image sub_image (Image img, int x, int y, uint width, uint height); + + [CCode (cname = "XAddPixel")] + public int add_pixel (Image img, long @value); + [CCode (cname = "XSetWindowAttributes")] public struct SetWindowAttributes { public Pixmap background_pixmap; /* background or None or ParentRelative */