summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Massey <bart@cs.pdx.edu>2007-12-08 16:45:26 -0800
committerArnaud Fontaine <arnau@debian.org>2010-11-14 20:03:27 +0900
commit9486c56b780b8b62641f552ada5059f7208d7320 (patch)
treed827cf482c0246ca00cdebe88ced9f8ea4f9e167
parentc699affc7de4946c1f9cb8856b83936e53d72bb6 (diff)
downloadutil-image-9486c56b780b8b62641f552ada5059f7208d7320.tar.gz
added create_image_from_bitmap_data(), adapted create_pixmap_from_bitmap_data() to use
-rw-r--r--image/xcb_image.c24
-rw-r--r--image/xcb_image.h17
2 files changed, 33 insertions, 8 deletions
diff --git a/image/xcb_image.c b/image/xcb_image.c
index 6f532a2..f8e1bde 100644
--- a/image/xcb_image.c
+++ b/image/xcb_image.c
@@ -745,6 +745,19 @@ xcb_image_get_pixel (xcb_image_t *image,
}
+xcb_image_t *
+xcb_image_create_from_bitmap_data (uint8_t * data,
+ uint32_t width,
+ uint32_t height)
+{
+ return xcb_image_create(width, height, XCB_IMAGE_FORMAT_XY_PIXMAP,
+ 8, 1, 1, 8,
+ XCB_IMAGE_ORDER_LSB_FIRST,
+ XCB_IMAGE_ORDER_LSB_FIRST,
+ 0, 0, data);
+}
+
+
/*
* (Adapted from libX11.)
*
@@ -775,20 +788,15 @@ xcb_create_pixmap_from_bitmap_data (xcb_connection_t * display,
xcb_pixmap_t pix;
xcb_image_t * image;
xcb_image_t * final_image;
- xcb_image_format_t format = XCB_IMAGE_FORMAT_XY_PIXMAP;
xcb_gcontext_t gc;
uint32_t mask = 0;
xcb_params_gc_t gcv;
- if (depth > 1)
- format = XCB_IMAGE_FORMAT_XY_BITMAP;
- image = xcb_image_create(width, height, format,
- 8, 1, 1, 8,
- XCB_IMAGE_ORDER_LSB_FIRST,
- XCB_IMAGE_ORDER_LSB_FIRST,
- 0, 0, data);
+ image = xcb_image_create_from_bitmap_data(data, width, height);
if (!image)
return 0;
+ if (depth > 1)
+ image->format = XCB_IMAGE_FORMAT_XY_BITMAP;
final_image = xcb_image_native(display, image, 1);
if (!final_image) {
xcb_image_destroy(image);
diff --git a/image/xcb_image.h b/image/xcb_image.h
index 595cd8e..16ac154 100644
--- a/image/xcb_image.h
+++ b/image/xcb_image.h
@@ -574,6 +574,23 @@ int xcb_image_shm_get (xcb_connection_t * conn,
/**
+ * Create an image from user-supplied bitmap data.
+ * @param data Image data in packed bitmap format.
+ * @param width Width in bits of image data.
+ * @param height Height in bits of image data.
+ * @return The image constructed from the image data, or 0 on error.
+ *
+ * This function creates an image from the user-supplied
+ * bitmap @p data. The bitmap data is assumed to be in
+ * xbm format (i.e., 8-bit scanline unit, LSB-first, 8-bit pad).
+ * @ingroup xcb__image_t
+ */
+xcb_image_t *
+xcb_image_create_from_bitmap_data (uint8_t * data,
+ uint32_t width,
+ uint32_t height);
+
+/**
* Create a pixmap from user-supplied bitmap data.
* @param display The connection to the X server.
* @param d The parent drawable for the pixmap.