|
|
#include <X11/Xlib.h> #include <sys/ipc.h> #include <sys/shm.h> #include <X11/extensions/XShm.h>Status XShmAttach (display, shminfo) Display *display; XShmSegmentInfo *shminfo;
XImage XShmCreateImage (display, visual, depth, format, data, shminfo, width, height) Display *display; Visual *visual; int format; char *data; XShmSegmentInfo *shminfo; unsigned int width, height, depth;
Pixmap XShmCreatePixmap (display, drawable, data, shminfo, width, height, depth) Display *display; Drawable drawable; char *data; XShmSegmentInfo *shminfo; unsigned int width, height, depth;
Status XShmDetach (display, shminfo) Display *display; XShmSegmentInfo *shminfo;
int XShmGetEventBase (display) Display *display;
Status XShmGetImage (display, drawable, image, x, y, plane_mask) Display *display; Drawable drawable; XImage *image; int x, y; unsigned long plane_mask;
int XShmPixmapFormat (display) Display *display;
Status XShmPutImage (display, drawable, gc, image, src_x, src_y, dest_x, dest_y, width, height, send_event) Display *display; Drawable drawable; GC gc; XImage *image; int src_x, src_y, dest_x, dest_y; unsigned int width, height; Boolean send_event;Status XShmQueryExtension (display) Display *display;
Status XShmQueryVersion (display, major, minor, pixmaps) Display *display; int *major, *minor; Boolean *pixmaps;
The XShmCreateImage function allocates the memory needed for an XImage structure for the specified display but does not allocate space for the image itself.
The XShmGetImage function reads image data into a shared memory XImage where display is the display of interest, drawable is the source drawable, image is the destination XImage, x and y are offsets within the drawable, and plane_mask defines which planes are to be read.
The XShmQueryExtension function checks to see if the shared memory extensions are available for the specified display.
The XShmQueryVersion function returns the version numbers of the extension implementation. Shared memory pixmaps are supported if the pixmaps argument returns true.
The XShmAttach function tells the server to attach to your shared memory segment. If all goes well, you will get a non-zero status, back and your XImage is ready for use.
The XShmDetach function tells the server to detach from your shared memory segment.
The XShmPixmapFormat function gets the format for the server. If your application can deal with the server pixmap data format, a shared memory segment and shminfo structure are created.
The XShmCreatePixmap function points to a pixmap which you can manipulate in all of the usual ways, with the added bonus of being able to edit its contents directly through the shared memory segment.
The XShmGetEventBase function gets the completion event value.
typedef struct { int type; /* type of event */ unsigned long serial; /* number of last request processed by server */ Boolean send_event; /* True if event came from a SendEvent request */ Display *display; /* Display the event was read from */ Drawable drawable; /* drawable of request */ int major_code; /* ShmReqCode */ int minor_code; /* X_ShmPutImage */ ShmSeg shmseg; /* the ShmSeg used in the request */ unsigned long offset; /* the offset into ShmSeg used */ } XShmCompletionEvent;