# The "xi" Package

These routines are meant to provide a more generic interface to the X Windows System XImage structures. These routines allow simple creation of standard and shared-memory XImage data structures, as well as the transmission of these to the X server.

Library: karmaX11
Link With: -lkarmaX11

#### Functions

xi_check_shared_images_available | Test if shared memory XImages may be use with an X server.
xi_create_image | Create an XImage structure for a window.
xi_create_shm_image | Create a shared-memory XImage structure.
xi_destroy_image | Destroy all the memory allocated for an XImage structure.
xi_put_image | Write an XImage structure to a drawable.

## Functions

flag xi_check_shared_images_available (Display *display)

Test if shared memory XImages may be use with an X server.

Parameters:

- display : The X server.

Returns: TRUE if shared images are available, else FALSE.
Multithreading Level: Unsafe

XImage * xi_create_image (Display *display, Window window, unsigned int image_width, unsigned int image_height, flag *share)

Create an XImage structure for a window.

Parameters:

- display : The X display.
- window : The X window ID.
- image_width : The width of the desired image in pixels.
- image_height : The height of the desired image in pixels.
- share : If this points to the value TRUE, the routine will attempt to use a shared memory segment for the image data (as per the MIT-Shared Memory Extension to the X Protocol). If the routine did in fact allocate a shared memory segment, the value of TRUE will be written here, else FALSE will be written here.

Returns: A pointer to the image structure on success, else NULL.
Multithreading Level: Unsafe
Note:

- Do NOT request a shared image if the routine xi_check_shared_images_available did not return TRUE.

XImage * xi_create_shm_image (Display *display, Visual *visual, int depth, unsigned int width, unsigned int height, flag quiet)

Create a shared-memory XImage structure.

Parameters:

- display : The X11 display handle.
- visual : The Visual pointer.
- depth : The depth.
- width : The width of the image.
- height : The height of the image.
- quiet : If TRUE, no error messages are displayed if no shared memory XImage could be created.

Returns: An XImage pointer on success, else NULL.
Multithreading Level: Unsafe

void xi_destroy_image (Display *display, XImage *ximage, flag shared_memory)

Destroy all the memory allocated for an XImage structure.

Parameters:

- display : The X display.
- ximage : A pointer to the XImage structure.
- shared_memory : If TRUE, then the routine assumes the XImage data is a shared memory segment, and will attempt to remove it.

Returns: Nothing.
Multithreading Level: Unsafe

void xi_put_image (Display *display, Drawable drawable, GC gc, XImage *ximage, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height, flag shared_memory, flag wait)

Write an XImage structure to a drawable.

Parameters:

- display : The X display.
- drawable : The ID of the drawable.
- gc : The graphics context.
- ximage : The image structure.
- src_x : The horizontal position of the upper left corner of the subimage.
- src_y : The vertical position of the upper left corner of the subimage.
- dest_x : The horizontal position in the drawable where the upper left corner will be drawn.
- dest_y : The vertical position in the drawable where the upper left corner will be drawn.
- width : The width of the subimage.
- height : The height of the subimage.
- shared_memory : If TRUE the routine assmumes the XImage structure resides in a shared memory segment.
- wait : If TRUE and the XImage structure resides in a shared memory segment the routine will wait for the X server to copy the contents from the segment.

Returns: Nothing.
Multithreading Level: Unsafe

Back to Karma Home Page