1XShm(3) X FUNCTIONS XShm(3)
2
3
4
6 XShmQueryExtension, XShmQueryVersion, XShmPixmapFormat, XShmAttach,
7 XShmDetach XShmCreateImage, XShmPutImage, XShmGetImage, XShmCre‐
8 atePixmap, XShmGetEventBase - X Shared Memory extension functions
9
11 #include <X11/Xlib.h>
12 #include <sys/ipc.h>
13 #include <sys/shm.h>
14 #include <X11/extensions/XShm.h>
15
16 Bool XShmQueryExtension(
17 Display *display);
18
19 Bool XShmQueryVersion(
20 Display *display;
21 int *major, *minor;
22 Bool *pixmaps);
23
24 int XShmPixmapFormat(
25 Display *display);
26
27 Bool XShmAttach(
28 Display *display;
29 XShmSegmentInfo *shminfo);
30
31 Bool XShmDetach(
32 Display *display;
33 XShmSegmentInfo *shminfo);
34
35
36 XImage *XShmCreateImage (
37 Display *display;
38 Visual *visual;
39 unsigned int depth;
40 int format;
41 char *data;
42 XShmSegmentInfo *shminfo;
43 unsigned int width, height);
44
45 Bool XShmPutImage(
46 Display *display;
47 Drawable d;
48 GC gc;
49 XImage *image;
50 int src_x, src_y, dest_x, dest_y;
51 unsigned int width, height;
52 bool send_event);
53
54 Bool XShmGetImage (
55 Display *display;
56 Drawable d;
57 XImage *image;
58 int x, y;
59 unsigned long plane_mask);
60
61 Pixmap XShmCreatePixmap(
62 Display *display;
63 Drawable d;
64 char *data;
65 XShmSegmentInfo *shminfo;
66 unsigned int width, height, depth);
67
68 Status XShmGetEventBase(
69 Display *display);
70
72 Events:
73 typedef struct {
74 int type; /* of event */
75 unsigned long serial; /* # of last request processed by server*/
76 Bool send_event; /* true if this came from a SendEvent request*/
77 Display *display; /* Display the event was read from */
78 Drawable drawable; /* drawable of request */
79 int major_code; /* ShmReqCode */
80 int minor_code; /* X_ShmPutImage */
81 ShmSeg shmseg; /* the ShmSeg used in the request*/
82 unsigned long offset; /* the offset into ShmSeg used in the request*/
83 } XShmCompletionEvent;
84
85 a structure of type XShmSegmentInfo :
86
87 typedef struct {
88 ShmSeg shmseg; /* resource id */
89 int shmid; /* kernel id */
90 char *shmaddr; /* address in client */
91 Bool readOnly; /* how the server should attach it */
92 } XShmSegmentInfo;
93
94
96 XShmQueryExtension checks to see if the shared memory extensions are
97 available for the specified display.
98
99 XShmQueryVersion returns the version numbers of the extension implemen‐
100 tation. Shared memory pixmaps are supported if the pixmaps argument re‐
101 turns true.
102
103 XShmAttach tells the server to attach to your shared memory segment. If
104 all goes well, you will get a non-zero status, back and your XImage is
105 ready for use.
106
107 XShmDetach tells the server to detach from your shared memory segment.
108
109 XShmPutImage combines an image in memory with a shape of the specified
110 drawable. If XYBitmap format is used, the depth must be one, or a
111 ``BadMatch'' error results. The foreground pixel in the GC defines the
112 source for the one bits in the image, and the background pixel defines
113 the source for the zero bits. For XYPixmap and ZPixmap, the depth must
114 match the depth of the drawable, or a ``BadMatch'' error results.
115
116 XShmGetImage reads image data into a shared memory XImage where display
117 is the display of interest, drawable is the source drawable, image is
118 the destination XImage, x and y are offsets within the drawable, and
119 plane_mask defines which planes are to be read.
120
121 XShmCreateImage allocates the memory needed for an XImage structure for
122 the specified display but does not allocate space for the image itself.
123
124 XShmPixmapFormat gets the format for the server. If your application
125 can deal with the server pixmap data format, a shared memory segment
126 and shminfo structure are created.
127
128 XShmCreatePixmap points to a pixmap which you can manipulate in all of
129 the usual ways, with the added bonus of being able to edit its contents
130 directly through the shared memory segment.
131
132 XShmGetEventBase gets the completion event value.
133
135 MIT-SHM - The MIT Shared Memory Extension
136
137
138
139X Version 11 libXext 1.3.5 XShm(3)