diff options
author | Bart Massey <bart@cs.pdx.edu> | 2007-12-07 00:34:23 -0800 |
---|---|---|
committer | Arnaud Fontaine <arnau@debian.org> | 2010-11-14 20:03:27 +0900 |
commit | faf8581a48f1a12ee7287a66d0433a28aa394eef (patch) | |
tree | 01deb0d53a1740226e0a8873e167e83f172be7bd | |
parent | 394cc33cba2ff9f03422f4fb969cb7e91031c648 (diff) |
out with the old image library...
-rw-r--r-- | image/.gitignore | 3 | ||||
-rw-r--r-- | image/Makefile.am | 33 | ||||
-rw-r--r-- | image/test_formats.c | 146 | ||||
-rw-r--r-- | image/test_xcb_image.c | 229 | ||||
-rw-r--r-- | image/test_xcb_image_shm.c | 166 | ||||
-rw-r--r-- | image/xcb-image.pc.in | 11 | ||||
-rw-r--r-- | image/xcb_image.c | 634 | ||||
-rw-r--r-- | image/xcb_image.h | 376 |
8 files changed, 0 insertions, 1598 deletions
diff --git a/image/.gitignore b/image/.gitignore deleted file mode 100644 index f72f791..0000000 --- a/image/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -test_xcb_image -test_xcb_image_shm -test_formats diff --git a/image/Makefile.am b/image/Makefile.am deleted file mode 100644 index 6e4a59f..0000000 --- a/image/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ - -MAINTAINERCLEANFILES = Makefile.in - -lib_LTLIBRARIES = libxcb-image.la - -xcbinclude_HEADERS = xcb_image.h - -AM_CFLAGS = $(CWARNFLAGS) - -XCB_IMAGE_LIBS = libxcb-image.la - -libxcb_image_la_SOURCES = xcb_image.c -libxcb_image_la_CPPFLAGS = $(XCB_CFLAGS) $(XCB_SHM_CFLAGS) $(XCB_AUX_CFLAGS) -libxcb_image_la_LIBADD = $(XCB_LIBS) $(XCB_SHM_LIBS) $(XCB_AUX_LIBS) - -pkgconfig_DATA = xcb-image.pc - -EXTRA_DIST=xcb-image.pc.in - -noinst_PROGRAMS = test_xcb_image test_xcb_image_shm test_formats - -test_xcb_image_SOURCES = test_xcb_image.c -test_xcb_image_CPPFLAGS = $(XCB_CFLAGS) $(XCB_SHM_CFLAGS) $(XCB_AUX_CFLAGS) -test_xcb_image_LDADD = $(XCB_LIBS) $(XCB_AUX_LIBS) $(XCB_IMAGE_LIBS) - -test_xcb_image_shm_SOURCES = test_xcb_image_shm.c -test_xcb_image_shm_CPPFLAGS = $(XCB_CFLAGS) $(XCB_SHM_CFLAGS) $(XCB_AUX_CFLAGS) -test_xcb_image_shm_LDADD = $(XCB_LIBS) $(XCB_SHM_LIBS) \ - $(XCB_AUX_LIBS) $(XCB_IMAGE_LIBS) - -test_formats_SOURCES = test_formats.c -test_formats_CPPFLAGS = $(XCB_CFLAGS) $(XCB_SHM_CFLAGS) $(XCB_AUX_CFLAGS) -test_formats_LDADD = $(XCB_LIBS) $(XCB_AUX_LIBS) $(XCB_IMAGE_LIBS) diff --git a/image/test_formats.c b/image/test_formats.c deleted file mode 100644 index b7a01ed..0000000 --- a/image/test_formats.c +++ /dev/null @@ -1,146 +0,0 @@ -#include <xcb/xcb.h> -#include "xcb_image.h" -#include "xcb_aux.h" -#include <stdio.h> -#include <stdlib.h> - -#define WIDTH 50 -#define HEIGHT 50 - -#if 0 -static int xpad(int depth) -{ - if(depth <= 8) - return 8; - if(depth <= 16) - return 16; - return 32; -} -#endif - -/* FIXME: this function doesn't work correctly for XYPixmaps yet. */ -static xcb_image_t *create_image(xcb_connection_t *c, int depth, int format) -{ -#if 0 - int pad = (format == ZPixmap ? xpad(depth) : 8); -#endif - xcb_image_t *im; - int x, y; - uint32_t i = 0; - printf("Image depth %d, format %d\n", depth, format); - im = xcb_image_create(c, depth, format, 0, 0, WIDTH, HEIGHT, 32, 0); - if(!im) - { - printf("ImageCreate failed.\n"); - return 0; - } - im->data = malloc(im->bytes_per_line * HEIGHT * (format == XCB_IMAGE_FORMAT_Z_PIXMAP ? 1 : depth)); - if(!im->data) - { - xcb_image_destroy(im); - return 0; - } - for(x = 0; x < WIDTH; ++x) - for(y = 0; y < HEIGHT; ++y) - { - xcb_image_put_pixel(im, x, y, i); - ++i; - i &= (1 << depth) - 1; - } - return im; -} - -static xcb_window_t create_window(xcb_connection_t *c, xcb_screen_t *root) -{ - static const uint32_t mask = XCB_CW_EVENT_MASK; - static const uint32_t values[] = { XCB_EVENT_MASK_EXPOSURE }; - unsigned int seq; - xcb_window_t w = xcb_generate_id(c); - seq = xcb_create_window(c, root->root_depth, w, root->root, 30, 30, WIDTH, HEIGHT, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, root->root_visual, mask, values).sequence; - printf("CreateWindow sequence %d, depth %d\n", seq, root->root_depth); - seq = xcb_map_window(c, w).sequence; - printf("MapWindow sequence %d\n", seq); - return w; -} - -static xcb_pixmap_t create_pixmap(xcb_connection_t *c, xcb_drawable_t d, uint8_t depth) -{ - xcb_pixmap_t p = xcb_generate_id(c); - unsigned int seq; - seq = xcb_create_pixmap(c, depth, p, d, WIDTH, HEIGHT).sequence; - printf("CreatePixmap sequence %d, depth %d\n", seq, depth); - return p; -} - -static xcb_gcontext_t create_gcontext(xcb_connection_t *c, xcb_screen_t *root) -{ - static const uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND; - const uint32_t values[] = { root->black_pixel, root->white_pixel }; - const xcb_drawable_t d = { root->root }; - unsigned int seq; - xcb_gcontext_t gc = xcb_generate_id(c); - seq = xcb_create_gc(c, gc, d, mask, values).sequence; - printf("CreateGC sequence %d\n", seq); - return gc; -} - -int main(int argc, char **argv) -{ - int screen, depth, format = XCB_IMAGE_FORMAT_Z_PIXMAP; - xcb_screen_t *root; - xcb_image_t *im; - xcb_drawable_t d, w = XCB_NONE; - xcb_gcontext_t gc; - xcb_generic_event_t *ev; - xcb_connection_t *c = xcb_connect(0, &screen); - if(!c) - { - printf("Connection failed.\n"); - exit(1); - } - root = xcb_aux_get_screen(c, screen); - if(argc > 1) - format = atoi(argv[1]); - if(format == XCB_IMAGE_FORMAT_XY_BITMAP || argc > 2) - depth = 1; - else - depth = root->root_depth; - - im = create_image(c, depth, format); - d = create_window(c, root); - if(depth != root->root_depth) - { - w = d; - d = create_pixmap(c, w, depth); - } - gc = create_gcontext(c, root); - xcb_flush(c); - - if(im) - { - while((ev = xcb_wait_for_event(c))) - { - if(ev->response_type == XCB_EXPOSE && ((xcb_expose_event_t *) ev)->count == 0) - { - xcb_image_put(c, d, gc, im, 0, 0, 0, 0, WIDTH, HEIGHT); - if(w) - { - unsigned int seq; - seq = xcb_copy_plane(c, d, w, gc, 0, 0, WIDTH, HEIGHT, 0, 0, 1).sequence; - printf("CopyPlane sequence %d\n", seq); - } - xcb_flush(c); - } - else if(ev->response_type == 0) - { - xcb_generic_error_t *err = (xcb_generic_error_t *) ev; - printf("Error: %d after sequence %d\n", err->error_code, (unsigned int) err->full_sequence); - } - free(ev); - } - xcb_image_destroy(im); - } - - xcb_disconnect(c); - exit(0); -} diff --git a/image/test_xcb_image.c b/image/test_xcb_image.c deleted file mode 100644 index f459489..0000000 --- a/image/test_xcb_image.c +++ /dev/null @@ -1,229 +0,0 @@ -/* gcc -g -O2 -Wall `pkg-config --cflags --libs xcb` -o test xcb_image.o test_xcb_image.c */ - -#include <stdlib.h> -#include <stdio.h> - -#include <xcb/xcb.h> - -#include "xcb_aux.h" -#include "xcb_image.h" - -#define W_W 4 -#define W_H 4 - -void -reflect_window (xcb_connection_t *c, - xcb_drawable_t win, - xcb_drawable_t new_win, - xcb_gcontext_t gc, - uint16_t width, - uint16_t height) -{ - xcb_image_t *image; - uint32_t pixel1; - uint32_t pixel2; - int32_t left_x; - int32_t right_x; - int32_t y; - - int i, j; - int format; - - format = XCB_IMAGE_FORMAT_Z_PIXMAP; - - printf ("get_image %d %d\n", width, height); - image = xcb_image_get (c, win, - 0, 0, width, height, - XCB_ALL_PLANES, - format); - - printf ("Create image summary:\n"); - printf (" * format..........: %d\n", image->format); - printf (" * byte order......: %d\n", image->image_byte_order); - printf (" * bitmap unit.....: %d\n", image->bitmap_format_scanline_unit); - printf (" * bitmap order....: %d\n", image->bitmap_format_bit_order); - printf (" * bitmap pad......: %d\n", image->bitmap_format_scanline_pad); - printf (" * depth...........: %d\n", image->depth); - printf (" * bytes/line......: %d\n", image->bytes_per_line); - printf (" * bits/pixel......: %d\n", image->bits_per_pixel); - - printf ("bpl %d %d\n", image->bytes_per_line, image->height); - - for (j = 0 ; j < image->height ; j++) - { - for (i = 0 ; i < image->width ; i++) - { - pixel1 = xcb_image_get_pixel (image, i, j); - printf ("%6d ", pixel1); - } - printf ("\n"); - } - - printf("calculating reflection -- this may take awhile...\n"); - - for (left_x = 0 ; left_x < width/2 ; left_x++) - { - for (y = 0 ; y < height ; y++) - { - pixel1 = xcb_image_get_pixel (image, left_x, y); - right_x = width - left_x-1; - if (left_x != right_x) - { - pixel2 = xcb_image_get_pixel (image, right_x, y); - xcb_image_put_pixel (image, left_x, y, pixel2); - } - xcb_image_put_pixel (image, right_x, y, pixel1); - } - printf ("\n"); - } - printf("putting image\n"); - for (j = 0 ; j < image->height ; j++) - { - for (i = 0 ; i < image->width ; i++) - { - pixel1 = xcb_image_get_pixel (image, i, j); - printf ("%6d ", pixel1); - } - printf ("\n"); - } - xcb_image_put (c, new_win, gc, image, - 0, 0, 0, 0, width, height); - image = xcb_image_get (c, new_win, - 0, 0, width, height, - XCB_ALL_PLANES, - format); - printf ("New : \n"); - for (j = 0 ; j < image->height ; j++) - { - for (i = 0 ; i < image->width ; i++) - { - pixel1 = xcb_image_get_pixel (image, i, j); - printf ("%6d ", pixel1); - } - printf ("\n"); - } - printf ("done\n"); -} - -int -main (int argc, char *argv[]) -{ - xcb_connection_t *c; - xcb_screen_t *screen; - xcb_drawable_t win; - xcb_drawable_t new_win; - xcb_drawable_t rect; - xcb_rectangle_t rect_coord = { 0, 0, W_W, W_H}; - xcb_gcontext_t bgcolor, fgcolor; - xcb_point_t points[2]; - uint32_t mask; - uint32_t valgc[2]; - uint32_t valwin[3]; - int depth; - int screen_nbr; - xcb_generic_event_t *e; - - /* Open the connexion to the X server and get the first screen */ - c = xcb_connect (NULL, &screen_nbr); - screen = xcb_aux_get_screen (c, screen_nbr); - depth = xcb_aux_get_depth (c, screen); - - /* Create a black graphic context for drawing in the foreground */ - win = screen->root; - - fgcolor = xcb_generate_id(c); - mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; - valgc[0] = screen->black_pixel; - valgc[1] = 0; /* no graphics exposures */ - xcb_create_gc(c, fgcolor, win, mask, valgc); - - bgcolor = xcb_generate_id(c); - mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; - valgc[0] = screen->white_pixel; - valgc[1] = 0; /* no graphics exposures */ - xcb_create_gc(c, bgcolor, win, mask, valgc); - - /* Ask for our window's Id */ - win = xcb_generate_id(c); - - /* Create the window */ - mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE; - valwin[0] = screen->white_pixel; - valwin[1] = XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE; - valwin[2] = XCB_EVENT_MASK_BUTTON_PRESS; - xcb_create_window (c, /* Connection */ - 0, /* depth */ - win, /* window Id */ - screen->root, /* parent window */ - 0, 0, /* x, y */ - W_W, W_H, /* width, height */ - 10, /* border_width */ - XCB_WINDOW_CLASS_INPUT_OUTPUT,/* class */ - screen->root_visual, /* visual */ - mask, valwin); /* masks, not used yet */ - - /* Map the window on the screen */ - xcb_map_window (c, win); - - /* Create a Pixmap that will fill the window */ - rect = xcb_generate_id (c); - xcb_create_pixmap(c, depth, rect, win, W_W, W_H); - xcb_poly_fill_rectangle(c, rect, bgcolor, 1, &rect_coord); - points[0].x = 0; - points[0].y = 0; - points[1].x = 1; - points[1].y = 1; - xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, rect, fgcolor, 2, points); -/* points[0].x = 10; */ -/* points[0].y = 10; */ -/* points[1].x = 10; */ -/* points[1].y = 40; */ -/* xcb_poly_line(c, CoordModeOrigin, rect, fgcolor, 2, points); */ - - /* Ask for our window's Id */ - new_win = xcb_generate_id(c); - - /* Create the window */ - mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE; - valwin[0] = screen->white_pixel; - valwin[1] = XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE; - valwin[2] = XCB_EVENT_MASK_BUTTON_PRESS; - xcb_create_window (c, /* Connection */ - 0, /* depth */ - new_win, /* window Id */ - screen->root, /* parent window */ - 0, 0, /* x, y */ - W_W, W_H, /* width, height */ - 10, /* border_width */ - XCB_WINDOW_CLASS_INPUT_OUTPUT,/* class */ - screen->root_visual, /* visual */ - mask, valwin); /* masks, not used yet */ - - - - /* Map the window on the screen */ - xcb_map_window (c, new_win); - - - xcb_flush (c); - - while ((e = xcb_wait_for_event(c))) - { - switch (e->response_type) - { - case XCB_EXPOSE: - { - xcb_copy_area(c, rect, win, bgcolor, - 0, 0, 0, 0, W_W, W_H); - reflect_window (c, win, new_win, - fgcolor, - W_W, W_H); - xcb_flush (c); - break; - } - } - free (e); - } - - return 1; -} diff --git a/image/test_xcb_image_shm.c b/image/test_xcb_image_shm.c deleted file mode 100644 index ca5cd03..0000000 --- a/image/test_xcb_image_shm.c +++ /dev/null @@ -1,166 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> - -#include <sys/ipc.h> -#include <sys/shm.h> - -#include <xcb/xcb.h> -#include <xcb/shm.h> - -#include "xcb_aux.h" -#include "xcb_image.h" - -#define W_W 40 -#define W_H 40 - - - -int -main (int argc, char *argv[]) -{ - xcb_connection_t *c; - xcb_screen_t *screen; - xcb_drawable_t win; - xcb_drawable_t rect; - xcb_rectangle_t rect_coord = { 0, 0, W_W, W_H}; - xcb_gcontext_t bgcolor, fgcolor; - xcb_point_t points[2]; - uint32_t mask; - uint32_t valgc[2]; - uint32_t valwin[3]; - int depth; - int screen_nbr; - xcb_generic_event_t *e; - - /* Open the connexion to the X server and get the first screen */ - c = xcb_connect (NULL, &screen_nbr); - screen = xcb_aux_get_screen (c, screen_nbr); - depth = xcb_aux_get_depth (c, screen); - - /* Create a black graphic context for drawing in the foreground */ - win = screen->root; - - fgcolor = xcb_generate_id(c); - mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; - valgc[0] = screen->black_pixel; - valgc[1] = 0; /* no graphics exposures */ - xcb_create_gc(c, fgcolor, win, mask, valgc); - - bgcolor = xcb_generate_id(c); - mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; - valgc[0] = screen->white_pixel; - valgc[1] = 0; /* no graphics exposures */ - xcb_create_gc(c, bgcolor, win, mask, valgc); - - /* Shm test */ - printf ("shm test begin\n"); - xcb_image_t *img = 0; - xcb_shm_query_version_reply_t *rep; - xcb_shm_segment_info_t shminfo; - - rep = xcb_shm_query_version_reply (c, - xcb_shm_query_version (c), - NULL); - if (rep) - { - uint8_t format; - - if (rep->shared_pixmaps && - (rep->major_version > 1 || rep->minor_version > 0)) - format = rep->pixmap_format; - else - format = 0; - img = xcb_image_shm_create (c, depth, format, NULL, W_W, W_H); - - printf ("Create image summary:\n"); - printf (" * format..........: %d\n", img->format); - printf (" * byte order......: %d\n", img->image_byte_order); - printf (" * bitmap unit.....: %d\n", img->bitmap_format_scanline_unit); - printf (" * bitmap order....: %d\n", img->bitmap_format_bit_order); - printf (" * bitmap pad......: %d\n", img->bitmap_format_scanline_pad); - - shminfo.shmid = shmget (IPC_PRIVATE, - img->bytes_per_line*img->height, - IPC_CREAT|0777); - shminfo.shmaddr = shmat(shminfo.shmid, 0, 0); - img->data = shminfo.shmaddr; - - shminfo.shmseg = xcb_generate_id (c); - xcb_shm_attach(c, shminfo.shmseg, - shminfo.shmid, 0); - shmctl(shminfo.shmid, IPC_RMID, 0); - } - - if (!img) - { - printf ("Can't use shm...\n"); - exit (0); - } - - /* Draw in the image */ - printf ("put the pixel\n"); - xcb_image_put_pixel (img, 20, 20, 65535); - printf ("fin put pixel\n"); - - /* Ask for our window's Id */ - win = xcb_generate_id(c); - - /* Create the window */ - mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE; - valwin[0] = screen->white_pixel; - valwin[1] = XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE; - valwin[2] = XCB_EVENT_MASK_BUTTON_PRESS; - xcb_create_window (c, /* Connection */ - 0, /* depth */ - win, /* window Id */ - screen->root, /* parent window */ - 0, 0, /* x, y */ - W_W, W_H, /* width, height */ - 10, /* border_width */ - XCB_WINDOW_CLASS_INPUT_OUTPUT,/* class */ - screen->root_visual, /* visual */ - mask, valwin); /* masks, not used yet */ - - /* Map the window on the screen */ - xcb_map_window (c, win); - - /* Create a Pixmap that will fill the window */ - rect = xcb_generate_id (c); - xcb_create_pixmap(c, depth, rect, win, W_W, W_H); - xcb_poly_fill_rectangle(c, rect, bgcolor, 1, &rect_coord); - points[0].x = 0; - points[0].y = 0; - points[1].x = 1; - points[1].y = 1; - xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, rect, fgcolor, 2, points); -/* points[0].x = 10; */ -/* points[0].y = 10; */ -/* points[1].x = 10; */ -/* points[1].y = 40; */ -/* xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, rect, fgcolor, 2, points); */ - - - xcb_flush (c); - - while ((e = xcb_wait_for_event(c))) - { - switch (e->response_type) - { - case XCB_EXPOSE: - { - xcb_copy_area(c, rect, win, bgcolor, - 0, 0, 0, 0, W_W, W_H); - printf ("put image\n"); - xcb_image_shm_put (c, win, fgcolor, - img, shminfo, - 0, 0, 0, 0, W_W,W_H, - 0); - xcb_flush (c); - break; - } - } - free (e); - } - - return 1; -} diff --git a/image/xcb-image.pc.in b/image/xcb-image.pc.in deleted file mode 100644 index 403fdd0..0000000 --- a/image/xcb-image.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: XCB Image library -Description: XCB image convenience library -Version: @PACKAGE_VERSION@ -Requires: xcb xcb-shm -Libs: -L${libdir} -lxcb-image @LIBS@ -Cflags: -I${includedir} diff --git a/image/xcb_image.c b/image/xcb_image.c deleted file mode 100644 index dc30e27..0000000 --- a/image/xcb_image.c +++ /dev/null @@ -1,634 +0,0 @@ -/* gcc -g -O2 -Wall -c `pkg-config --cflags xcb` -o xcb_image.o xcb_image.c */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include <xcb/xcb.h> -#include <xcb/shm.h> - -#include "xcb_image.h" - -/* Convenient */ -static uint8_t xcb_bits_per_pixel (xcb_connection_t *c, uint8_t depth); -static uint32_t xcb_bytes_per_line (uint8_t pad, uint16_t width, uint8_t bpp); -static uint8_t xcb_scanline_pad_get (xcb_connection_t *conn, - uint8_t depth); - -static inline uint32_t _lomask(int n) -{ - return (1 << n) - 1; -} - -static unsigned int Ones( /* HAKMEM 169 */ - uint32_t mask) -{ - register uint32_t y; - - y = (mask >> 1) &033333333333; - y = mask - y - ((y >>1) & 033333333333); - return ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); -} - - -/* Convenient functions */ - -static uint8_t -xcb_bits_per_pixel (xcb_connection_t *c, uint8_t depth) -{ - xcb_format_t *fmt = xcb_setup_pixmap_formats(xcb_get_setup(c)); - xcb_format_t *fmtend = fmt + xcb_setup_pixmap_formats_length(xcb_get_setup(c)); - - for(; fmt != fmtend; ++fmt) - if(fmt->depth == depth) - return fmt->bits_per_pixel; - - if(depth <= 4) - return 4; - if(depth <= 8) - return 8; - if(depth <= 16) - return 16; - return 32; -} - -static uint32_t -xcb_bytes_per_line (uint8_t pad, uint16_t width, uint8_t bpp) -{ - return ((bpp * width + pad - 1) & -pad) >> 3; -} - -static uint8_t -xcb_scanline_pad_get (xcb_connection_t *conn, - uint8_t depth) -{ - xcb_format_t *fmt = xcb_setup_pixmap_formats(xcb_get_setup(conn)); - xcb_format_t *fmtend = fmt + xcb_setup_pixmap_formats_length(xcb_get_setup(conn)); - - for(; fmt != fmtend; ++fmt) - if(fmt->depth == depth) - { - return fmt->scanline_pad; - } - - return xcb_get_setup (conn)->bitmap_format_scanline_pad; - -/* xcb_format_iterator_t iter; */ -/* int cur; */ - -/* iter = xcb_setup_pixmap_formats_iterator (conn->setup); */ -/* for (cur = 0 ; cur < iter.rem ; cur++, xcb_format_next (&iter)) */ -/* if (iter.data->depth == depth) */ -/* return iter.data->scanline_pad; */ - -/* return xcb_get_setup (conn)->bitmap_format_scanline_pad; */ -} - -static int format_invalid(uint8_t depth, uint8_t format, uint8_t xpad) -{ - return (depth == 0 || depth > 32 || - (format != XCB_IMAGE_FORMAT_XY_BITMAP && - format != XCB_IMAGE_FORMAT_XY_PIXMAP && - format != XCB_IMAGE_FORMAT_Z_PIXMAP) || - (format == XCB_IMAGE_FORMAT_XY_BITMAP && depth != 1) || - (xpad != 8 && xpad != 16 && xpad != 32)); -} - -xcb_image_t * -xcb_image_create (xcb_connection_t *conn, - uint8_t depth, - uint8_t format, - unsigned int offset, - uint8_t *data, - uint16_t width, - uint16_t height, - uint8_t xpad, - uint32_t bytes_per_line) -{ - xcb_image_t *image; - const xcb_setup_t *rep; - uint8_t bpp = 1; /* bits per pixel */ - - if (format_invalid(depth, format, xpad)) - return (xcb_image_t *) NULL; - - image = (xcb_image_t *)malloc (sizeof (xcb_image_t)); - if (image == NULL) - return NULL; - - rep = xcb_get_setup (conn); - - image->width = width; - image->height = height; - image->format = format; - image->image_byte_order = rep->image_byte_order; - image->bitmap_format_scanline_unit = rep->bitmap_format_scanline_unit; - image->bitmap_format_bit_order = rep->bitmap_format_bit_order; - image->bitmap_format_scanline_pad = xpad; - - if (format == XCB_IMAGE_FORMAT_Z_PIXMAP) - { - bpp = xcb_bits_per_pixel (conn, depth); - } - - image->xoffset = offset; - image->depth = depth; - image->data = data; - - /* - * compute per line accelerator. - */ - if (bytes_per_line == 0) - { - if (format == XCB_IMAGE_FORMAT_Z_PIXMAP) - image->bytes_per_line = - xcb_bytes_per_line (image->bitmap_format_scanline_pad, - width, bpp); - else - image->bytes_per_line = - xcb_bytes_per_line (image->bitmap_format_scanline_pad, - width + offset, 1); - } - else - image->bytes_per_line = bytes_per_line; - - image->bits_per_pixel = bpp; - - return image; -} - -int -xcb_image_init (xcb_image_t *image) -{ - if (format_invalid(image->depth, image->format, image->bitmap_format_scanline_pad)) - return 0; - - /* - * compute per line accelerator. - */ - if (image->bytes_per_line == 0) - { - if (image->format == XCB_IMAGE_FORMAT_Z_PIXMAP) - image->bytes_per_line = - xcb_bytes_per_line (image->bitmap_format_scanline_pad, - image->width, - image->bits_per_pixel); - else - image->bytes_per_line = - xcb_bytes_per_line (image->bitmap_format_scanline_pad, - image->width + image->xoffset, - 1); - } - - return 1; -} - -int -xcb_image_destroy (xcb_image_t *image) -{ - if (image->data != NULL) - free (image->data); - free (image); - - return 1; -} - -xcb_image_t * -xcb_image_get (xcb_connection_t *conn, - xcb_drawable_t draw, - int16_t x, - int16_t y, - uint16_t width, - uint16_t height, - uint32_t plane_mask, - uint8_t format) -{ - xcb_image_t *image; - xcb_get_image_reply_t *rep; - uint8_t *data; - - rep = xcb_get_image_reply (conn, - xcb_get_image (conn, - format, - draw, - x, y, - width, height, - plane_mask), - NULL); - if (!rep) - return NULL; - - data = malloc(xcb_get_image_data_length(rep)); - if (!data) - return NULL; - memcpy(data, xcb_get_image_data (rep), xcb_get_image_data_length (rep)); - - if (format == XCB_IMAGE_FORMAT_XY_PIXMAP) - { - image = xcb_image_create (conn, - Ones (plane_mask & _lomask(rep->depth)), - format, - 0, - data, - width, height, - xcb_scanline_pad_get (conn, rep->depth), - 0); - } - else /* format == XCB_IMAGE_FORMAT_Z_PIXMAP */ - { - image = xcb_image_create (conn, - rep->depth, - XCB_IMAGE_FORMAT_Z_PIXMAP, - 0, - data, - width, height, - xcb_scanline_pad_get (conn, rep->depth), - 0); - } - if (!image) - free (data); - - free (rep); - - return image; -} - -int -xcb_image_put (xcb_connection_t *conn, - xcb_drawable_t draw, - xcb_gcontext_t gc, - xcb_image_t *image, - int16_t x_offset, - int16_t y_offset, - int16_t x, - int16_t y, - uint16_t width, - uint16_t height) -{ - int32_t w; - int32_t h; - int dest_bits_per_pixel; - int dest_scanline_pad; - int left_pad; - - w = width; - h = height; - - if (x_offset < 0) - { - w += x_offset; - x_offset = 0; - } - - if (y_offset < 0) - { - h += y_offset; - y_offset = 0; - } - - if ((w + x_offset) > image->width) - w = image->width - x_offset; - - if ((h + y_offset) > image->height) - h = image->height - y_offset; - - if ((w <= 0) || (h <= 0)) - return 0; - - if ((image->bits_per_pixel == 1) || (image->format != XCB_IMAGE_FORMAT_Z_PIXMAP)) - { - dest_bits_per_pixel = 1; - dest_scanline_pad = xcb_get_setup (conn)->bitmap_format_scanline_pad; - left_pad = image->xoffset & (xcb_get_setup (conn)->bitmap_format_scanline_unit- 1); - } - else - { - xcb_format_iterator_t iter; - - dest_bits_per_pixel = image->bits_per_pixel; - dest_scanline_pad = image->bitmap_format_scanline_pad; - left_pad = 0; - iter = xcb_setup_pixmap_formats_iterator (xcb_get_setup (conn)); - for (; iter.rem ; xcb_format_next (&iter)) - if (iter.data->depth == image->depth) - { - dest_bits_per_pixel = iter.data->bits_per_pixel; - dest_scanline_pad = iter.data->scanline_pad; - } - - if (dest_bits_per_pixel != image->bits_per_pixel) { - xcb_image_t img; - register int32_t i, j; - const xcb_setup_t *rep; - - /* XXX slow, but works */ - rep = xcb_get_setup (conn); - img.width = width; - img.height = height; - img.xoffset = 0; - img.format = XCB_IMAGE_FORMAT_Z_PIXMAP; - img.image_byte_order = rep->image_byte_order; - img.bitmap_format_scanline_unit = rep->bitmap_format_scanline_unit; - img.bitmap_format_bit_order = rep->bitmap_format_bit_order; - img.bitmap_format_scanline_pad = dest_scanline_pad; - img.depth = image->depth; - img.bits_per_pixel = dest_bits_per_pixel; - img.bytes_per_line = xcb_bytes_per_line (dest_scanline_pad, - width, - dest_bits_per_pixel); - img.data = malloc((uint8_t) (img.bytes_per_line * height)); - - if (img.data == NULL) - return 0; - - for (j = height; --j >= 0; ) - for (i = width; --i >= 0; ) - xcb_image_put_pixel(&img, - i, j, - xcb_image_get_pixel(image, - x_offset + i, - y_offset + j)); - - xcb_put_image(conn, img.format, draw, gc, - w, h, x, y, - dest_scanline_pad, - img.depth, - img.bytes_per_line * height, - img.data); - - free(img.data); - return 0; - } - } - - xcb_put_image(conn, image->format, draw, gc, - w, h, x, y, - left_pad, - image->depth, image->bytes_per_line * height, - image->data); - - return 1; -} - -/* - * Shm stuff - */ - -xcb_image_t * -xcb_image_shm_create (xcb_connection_t *conn, - uint8_t depth, - uint8_t format, - uint8_t *data, - uint16_t width, - uint16_t height) -{ - xcb_image_t *image; - const xcb_setup_t *rep; - - image = (xcb_image_t *)malloc (sizeof (xcb_image_t)); - if (!image) - return NULL; - - rep = xcb_get_setup (conn); - - image->width = width; - image->height = height; - image->xoffset = 0; - image->format = format; - image->data = data; - image->depth = depth; - - image->image_byte_order = rep->image_byte_order; - image->bitmap_format_scanline_unit = rep->bitmap_format_scanline_unit; - image->bitmap_format_bit_order = rep->bitmap_format_bit_order; - image->bitmap_format_scanline_pad = xcb_scanline_pad_get (conn, depth); - - if (format == XCB_IMAGE_FORMAT_Z_PIXMAP) - image->bits_per_pixel = xcb_bits_per_pixel (conn, depth); - else - image->bits_per_pixel = 1; - - image->bytes_per_line = xcb_bytes_per_line (image->bitmap_format_scanline_pad, - width, - image->bits_per_pixel); - - return image; -} - -int -xcb_image_shm_destroy (xcb_image_t *image) -{ - if (image) - free (image); - - return 1; -} - -int -xcb_image_shm_put (xcb_connection_t *conn, - xcb_drawable_t draw, - xcb_gcontext_t gc, - xcb_image_t *image, - xcb_shm_segment_info_t shminfo, - int16_t src_x, - int16_t src_y, - int16_t dest_x, - int16_t dest_y, - uint16_t src_width, - uint16_t src_height, - uint8_t send_event) -{ - if (!shminfo.shmaddr) - return 0; - - xcb_shm_put_image(conn, draw, gc, - image->width, image->height, - src_x, src_y, src_width, src_height, - dest_x, dest_y, - image->depth, image->format, - send_event, - shminfo.shmseg, - image->data - shminfo.shmaddr); - return 1; -} - -int -xcb_image_shm_get (xcb_connection_t *conn, - xcb_drawable_t draw, - xcb_image_t *image, - xcb_shm_segment_info_t shminfo, - int16_t x, - int16_t y, - uint32_t plane_mask) -{ - xcb_shm_get_image_reply_t *rep; - xcb_shm_get_image_cookie_t cookie; - xcb_generic_error_t *err = NULL; - - if (!shminfo.shmaddr) - return 0; - - cookie = xcb_shm_get_image(conn, draw, - x, y, - image->width, image->height, - plane_mask, - image->format, - shminfo.shmseg, - image->data - shminfo.shmaddr); - rep = xcb_shm_get_image_reply(conn, cookie, &err); - /* rep would be useful to get the visual id */ - /* but i don't use it */ - /* So, should we remove it ? */ - - if (err) { - fprintf(stderr, "ShmGetImageReply error %d\n", (int)err->error_code); - free(err); - } - - if (!rep) - return 0; - else { - free (rep); - return 1; - } -} - -/* GetPixel/PutPixel */ - -static inline int XYINDEX (int x, xcb_image_t *img, int *bitp) -{ - int mask = img->bitmap_format_scanline_unit - 1; - int unit = (x + img->xoffset) & ~mask; - int byte = (x + img->xoffset) & mask; - if (img->bitmap_format_bit_order == XCB_IMAGE_ORDER_MSB_FIRST) - byte = img->bitmap_format_scanline_unit - byte; - *bitp = byte & 7; - if (img->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST) - byte = img->bitmap_format_scanline_unit - byte; - return (unit + byte) >> 3; -} - -static inline int ZINDEX (int x, xcb_image_t *img) -{ - return (x * img->bits_per_pixel) >> 3; -} - -static inline void set_bit (uint8_t *byte, int bit, int value) -{ - if (value) - *byte |= 1 << bit; - else - *byte &= ~(1 << bit); -} - -int -xcb_image_put_pixel (xcb_image_t *image, int x, int y, uint32_t pixel) -{ - register uint8_t *src = image->data + (y * image->bytes_per_line); - - if (image->format == XCB_IMAGE_FORMAT_XY_PIXMAP || (image->bits_per_pixel | image->depth) == 1) - { - int plane, bit; - /* do least signif plane 1st */ - src += XYINDEX(x, image, &bit) + image->bytes_per_line * image->height * image->depth; - for (plane = image->depth; --plane >= 0; pixel >>= 1) - { - src -= image->bytes_per_line * image->height; - set_bit (src, bit, pixel & 1); - } - } - else - if (image->format == XCB_IMAGE_FORMAT_Z_PIXMAP) - { - src += ZINDEX(x, image); - if (image->bits_per_pixel == 4) - { - uint8_t mask = ~_lomask(4); - pixel &= _lomask(image->depth); - /* if x is odd and byte order is LSB, or - * if x is even and byte order is MSB, then - * want high nibble; else want low nibble. */ - if ((x & 1) == (image->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST)) - { - mask = ~mask; - pixel <<= 4; - } - *src = (*src & mask) | pixel; - } - else - { - int nbytes = image->bits_per_pixel >> 3; - int rev = image->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST; - if(rev) - src += nbytes - 1; - while (--nbytes >= 0) - { - *src = pixel; - pixel >>= 8; - if(rev) - --src; - else - ++src; - } - } - } - else - { - return 0; /* bad image */ - } - return 1; -} - -uint32_t -xcb_image_get_pixel (xcb_image_t *image, int x, int y) -{ - uint32_t pixel = 0; - register uint8_t *src = image->data + (y * image->bytes_per_line); - - if (image->format == XCB_IMAGE_FORMAT_XY_PIXMAP || (image->bits_per_pixel | image->depth) == 1) - { - int plane, bit; - src += XYINDEX(x, image, &bit); - for (plane = image->depth; --plane >= 0; ) - { - pixel <<= 1; - pixel |= (*src >> bit) & 1; - src += image->bytes_per_line * image->height; - } - } - else - if (image->format == XCB_IMAGE_FORMAT_Z_PIXMAP) - { - src += ZINDEX(x, image); - if (image->bits_per_pixel == 4) - { - pixel = *src; - /* if x is odd and byte order is LSB, or - * if x is even and byte order is MSB, then - * want high nibble; else want low nibble. */ - if ((x & 1) == (image->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST)) - pixel >>= 4; - } - else - { - int nbytes = image->bits_per_pixel >> 3; - int rev = image->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST; - if(rev) - src += nbytes - 1; - while (--nbytes >= 0) - { - pixel <<= 8; - pixel = *src; - if(rev) - --src; - else - ++src; - } - } - } - else - { - return 0; /* bad image */ - } - return pixel & _lomask(image->depth); -} diff --git a/image/xcb_image.h b/image/xcb_image.h deleted file mode 100644 index 26bfbc5..0000000 --- a/image/xcb_image.h +++ /dev/null @@ -1,376 +0,0 @@ -#ifndef __XCB_IMAGE_H__ -#define __XCB_IMAGE_H__ - -#include <xcb/xcb.h> -#include <xcb/shm.h> - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @defgroup xcb__image_t XCB Image Functions - * - * Functions used to create and manipulate images. - * - * @{ - */ - - -typedef struct xcb_image_t xcb_image_t; - -/** - * @struct xcb_image_t - * A structure that describes an xcb_image_t. - */ -struct xcb_image_t -{ - uint16_t width; - uint16_t height; - unsigned int xoffset; - uint8_t format; - uint8_t *data; - uint8_t image_byte_order; - uint8_t bitmap_format_scanline_unit; - uint8_t bitmap_format_bit_order; - uint8_t bitmap_format_scanline_pad; - uint8_t depth; - uint32_t bytes_per_line; - uint8_t bits_per_pixel; -}; - -typedef struct xcb_shm_segment_info_t xcb_shm_segment_info_t; - -/** - * @struct xcb_shm_segment_info_t - * A structure that stores the informations needed by the MIT Shm - * Extension. - */ -struct xcb_shm_segment_info_t -{ - xcb_shm_seg_t shmseg; - uint32_t shmid; - uint8_t *shmaddr; -}; - -/** - * Create a new Image. - * @param conn The connection to the X server. - * @param depth The depth of the image. - * @param format The format of the image. You can pass XYBitmap, - * XYPixmap, or ZPixmap. - * @param offset The number of pixels to ignore at the beginning of - * the scanline. - * @param data The image data. - * @param width The width of the image, in pixels. - * @param height The height of the image, in pixels. - * @param xpad The quantum of a scanline (8, 16, or 32). - * @param bytes_per_line The number of bytes in the client image - * between the start of one scanline and the start of the next. - * @return The new image. - * - * This function allocates the memory needed for an xcb_image_t structure - * for the specified connection but does not allocate space for the image - * itself. It initializes the structure byte-order, bit-order, and - * bitmap-unit values from the connection and returns a pointer to the - * xcb_image_t structure. - * - * The @p offset parameter permits the rapid displaying of the image - * without requiring each scanline to be shifted into position. - * - * The image must be destroyed with @ref xcb_image_destroy_t. - * @ingroup xcb__image_t - */ -xcb_image_t *xcb_image_create (xcb_connection_t *conn, - uint8_t depth, - uint8_t format, - unsigned int offset, - uint8_t *data, - uint16_t width, - uint16_t height, - uint8_t xpad, - uint32_t bytes_per_line); - -/** - * Initialize an Image. - * @param image The image to be destroyed. - * @return 1 if the operation has succeeded. - * - * This function initializes the image structure. - * @ingroup xcb__image_t - */ -int xcb_image_init (xcb_image_t *image); - -/** - * Destroy an Image. - * @param image The image to be destroyed. - * @return 1 if the operation has succeeded. - * - * This function deallocates both the memory associated with the @p image - * parameter and its data. - * @ingroup xcb__image_t - */ -int xcb_image_destroy (xcb_image_t *image); - -#define XCB_ALL_PLANES ((uint32_t)~0L) - -/** - * Return a pointer to a xcb_image_t. - * @param conn The connection to the X server. - * @param draw The draw you get the image from. - * @param x The x coordinate, which are relative to the origin of the - * drawable and define the upper-left corner of the rectangle. - * @param y The y coordinate, which are relative to the origin of the - * drawable and define the upper-left corner of the rectangle. - * @param width The width of the subimage, in pixels. - * @param height The height of the subimage, in pixels. - * @param plane_mask The plane mask (can be xcb_all_planes_t). - * @param format The format of the image. You can pass XYBitmap, - * XYPixmap, or ZPixmap. - * @return The subimage of @p draw defined by @p x, @p y, @p w, @p h. - * - * This function returns a subimage of @p draw defined by @p x, @p y, - * @p w, @p h. The depth of the image is the one of the drawable @p - * draw, except when getting a subset of the plane in @c XYPixmap - * format. - * - * If a problem occurs, the functons returns @c NULL. - * @ingroup xcb__image_t - */ -xcb_image_t *xcb_image_get (xcb_connection_t *conn, - xcb_drawable_t draw, - int16_t x, - int16_t y, - uint16_t width, - uint16_t height, - uint32_t plane_mask, - uint8_t format); - -/* Not implemented. Should be ? */ -xcb_image_t xcb_image_subimage_get (xcb_connection_t *conn, - xcb_drawable_t draw, - int x, - int y, - unsigned int width, - unsigned int height, - unsigned long plane_mask, - uint8_t format, - xcb_image_t *dest_im, - int dest_x, - int dest_y); - -/** - * Put the data of an xcb_image_t onto a drawable. - * @param conn The connection to the X server. - * @param draw The draw you get the image from. - * @param gc The graphic context. - * @param image The image you want to combine with the rectangle. - * @param x_offset The offset in x from the left edge of the image - * defined by the xcb_image_t structure. - * @param y_offset The offset in y from the left edge of the image - * defined by the xcb_image_t structure. - * @param x The x coordinate, which is relative to the origin of the - * drawable and defines the x coordinate of the upper-left corner of the - * rectangle. - * @param y The y coordinate, which is relative to the origin of the - * drawable and defines the x coordinate of the upper-left corner of - * the rectangle. - * @param width The width of the subimage, in pixels. - * @param height The height of the subimage, in pixels. - * @return 1 is no problems occurs. - * - * This function combines an image with a rectangle of the specified - * drawable. The section of the image defined by the @p x, @p y, - * @p width, and @p height arguments is drawn on the specified part of - * the drawable. The foreground pixel in @p gc defines the source for - * the one bits in the image, and the background pixel defines the - * source for the zero bits. For XYPixmap and ZPixmap formats, the - * depth of the image must match the depth of the drawable. - * - * If a problem occurs, the functons returns @c NULL. - * @ingroup xcb__image_t - */ -int xcb_image_put (xcb_connection_t *conn, - xcb_drawable_t draw, - xcb_gcontext_t gc, - xcb_image_t *image, - int16_t x_offset, - int16_t y_offset, - int16_t x, - int16_t y, - uint16_t width, - uint16_t height); - -/** - * Put a pixel in a image - * @param image The image. - * @param x The x coordinate of the pixel. - * @param y The y coordinate of the pixel. - * @param pixel The new pixel value. - * @return 1 if the operation has succeeded. - * - * This function overwrites the pixel in the named image with the - * specified @p pixel value. The input pixel value must be in normalized - * format (that is, the least-significant byte of the long is the - * least-significant byte of the pixel). The image must contain the @p x - * and @p y coordinates. - * @ingroup xcb__image_t - */ -int xcb_image_put_pixel (xcb_image_t *image, - int x, - int y, - uint32_t pixel); - -/** - * Get a pixel in a image - * @param image The image. - * @param x The x coordinate of the pixel. - * @param y The y coordinate of the pixel. - * @return The pixel value. - * - * This function returns the specified pixel from the named image. The - * pixel value is returned in normalized format (that is, the - * least-significant byte of the long is the least-significant byte of - * the pixel). The image must contain the @p x and @p y coordinates. - * @ingroup xcb__image_t - */ -uint32_t xcb_image_get_pixel (xcb_image_t *image, - int x, - int y); - -/* - * Shm stuff - */ - -/** - * Create an xcb_image_t to be used with the MIT Shm Extension - * @param conn The connection to the X server. - * @param depth The depth of the image. - * @param format The format of the image. You can pass XYBitmap, - * XYPixmap, or ZPixmap. - * @param data The image data. - * @param width The width of the image, in pixels. - * @param height The height of the image, in pixels. - * @return The new image. - * - * This function allocates the memory needed for an xcb_image_t structure - * for the specified display but does not allocate space for the image - * itself. - * - * The image must be destroyed with @ref xcb_image_shm_destroy_t. - * - * @ingroup xcb__image_t - */ -xcb_image_t *xcb_image_shm_create (xcb_connection_t *conn, - uint8_t depth, - uint8_t format, - uint8_t *data, - uint16_t width, - uint16_t height); - -/** - * Destroy an Image created by xcb_image_shm_create_t. - * @param image The image to be destroyed. - * @return 1 if the operation has succeeded. - * - * This function deallocates both the memory associated with the @p image - * parameter and its data. - * @ingroup xcb__image_t - */ -int xcb_image_shm_destroy (xcb_image_t *image); - -/** - * Put the data of an xcb_image_t onto a drawable using the MIT Shm - * Extension. - * @param conn The connection to the X server. - * @param draw The draw you get the image from. - * @param gc The graphic context. - * @param image The image you want to combine with the rectangle. - * @param shminfo A @ref xcb_shm_segment_info_t structure. - * @param x The offset in x from the left edge of the image - * defined by the xcb_image_t structure. - * @param y The offset in y from the left edge of the image - * defined by the xcb_image_t structure. - * @param dest_x The x coordinate, which is relative to the origin of the - * drawable and defines the x coordinate of the upper-left corner of the - * rectangle. - * @param dest_y The y coordinate, which is relative to the origin of the - * drawable and defines the x coordinate of the upper-left corner of - * the rectangle. - * @param width The width of the subimage, in pixels. - * @param height The height of the subimage, in pixels. - * @param send_event Indicates whether or not a completion event - * should occur when the image write is complete. - * @return 1 is no problems occurs. - * - * This function combines an image in memory with a shape of the - * specified drawable. The section of the image defined by the @p x, @p y, - * @p width, and @p height arguments is drawn on the specified part of - * the drawable. If XYBitmap format is used, the depth must be - * one, or a``BadMatch'' error results. The foreground pixel in the - * Graphic Context @p gc defines the source for the one bits in the - * image, and the background pixel defines the source for the zero - * bits. For XYPixmap and ZPixmap, the depth must match the depth of - * the drawable, or a ``BadMatch'' error results. - * - * If a problem occurs, the functons returns @c 0. Otherwise, it - * returns @c 1. - * @ingroup xcb__image_t - */ -int xcb_image_shm_put (xcb_connection_t *conn, - xcb_drawable_t draw, - xcb_gcontext_t gc, - xcb_image_t *image, - xcb_shm_segment_info_t shminfo, - int16_t x, - int16_t y, - int16_t dest_x, - int16_t dest_y, - uint16_t width, - uint16_t height, - uint8_t send_event); - -/** - * Read image data into a shared memory xcb_image_t. - * @param conn The connection to the X server. - * @param draw The draw you get the image from. - * @param image The image you want to combine with the rectangle. - * @param shminfo A @ref xcb_shm_segment_info_t structure. - * @param x The x coordinate, which are relative to the origin of the - * drawable and define the upper-left corner of the rectangle. - * @param y The y coordinate, which are relative to the origin of the - * drawable and define the upper-left corner of the rectangle. - * @param plane_mask The plane mask. - * @return The subimage of @p draw defined by @p x, @p y, @p w, @p h. - * - * This function reads image data into a shared memory xcb_image_t where - * @p conn is the connection to the X server, @p draw is the source - * drawable, @p image is the destination xcb_image_t, @p x and @p y are offsets - * within the drawable, and @p plane_mask defines which planes are to be - * read. - * - * If a problem occurs, the functons returns @c 0. It returns 1 - * otherwise. - * @ingroup xcb__image_t - */ -int xcb_image_shm_get (xcb_connection_t *conn, - xcb_drawable_t draw, - xcb_image_t *image, - xcb_shm_segment_info_t shminfo, - int16_t x, - int16_t y, - uint32_t plane_mask); - -/** - * @} - */ - - -#ifdef __cplusplus -} -#endif - - -#endif /* __XCB_IMAGE_H__ */ |