| 1 |
.\" Copyright (c) 1991 X Consortium |
| 2 |
.\" |
| 3 |
.\" Permission is hereby granted, free of charge, to any person obtaining a |
| 4 |
.\" copy of this software and associated documentation files (the "Software"), |
| 5 |
.\" to deal in the Software without restriction, including without limitation |
| 6 |
.\" the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 7 |
.\" and/or sell copies of the Software, and to permit persons to whom the |
| 8 |
.\" Software furnished to do so, subject to the following conditions: |
| 9 |
.\" |
| 10 |
.\" The above copyright notice and this permission notice shall be included in |
| 11 |
.\" all copies or substantial portions of the Software. |
| 12 |
.\" |
| 13 |
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 |
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 |
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 16 |
.\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 17 |
.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF |
| 18 |
.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 |
.\" SOFTWARE. |
| 20 |
.\" |
| 21 |
.\" Except as contained in this notice, the name of the X Consortium shall not |
| 22 |
.\" be used in advertising or otherwise to promote the sale, use or other |
| 23 |
.\" dealing in this Software without prior written authorization from the |
| 24 |
.\" X Consortium. |
| 25 |
.\" |
| 26 |
.\" Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. |
| 27 |
.\" |
| 28 |
.\" Permission is hereby granted, free of charge, to any person obtaining a |
| 29 |
.\" copy of this software and associated documentation files (the "Software"), |
| 30 |
.\" to deal in the Software without restriction, including without limitation |
| 31 |
.\" the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 32 |
.\" and/or sell copies of the Software, and to permit persons to whom the |
| 33 |
.\" Software is furnished to do so, subject to the following conditions: |
| 34 |
.\" |
| 35 |
.\" The above copyright notice and this permission notice (including the next |
| 36 |
.\" paragraph) shall be included in all copies or substantial portions of the |
| 37 |
.\" Software. |
| 38 |
.\" |
| 39 |
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 40 |
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 41 |
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 42 |
.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 43 |
.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 44 |
.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 45 |
.\" DEALINGS IN THE SOFTWARE. |
| 46 |
.\" |
| 47 |
.\" X Window System is a trademark of The Open Group. |
| 48 |
.\" |
| 49 |
.de ZN |
| 50 |
.ie t \fB\^\\$1\^\fR\\$2 |
| 51 |
.el \fI\^\\$1\^\fP\\$2 |
| 52 |
.. |
| 53 |
.TH XShm __libmansuffix__ __xorgversion__ "X FUNCTIONS" |
| 54 |
.SH NAME |
| 55 |
XShmQueryExtension, XShmQueryVersion, XShmPixmapFormat, XShmAttach, XShmDetach |
| 56 |
XShmCreateImage, XShmPutImage, XShmGetImage, XShmCreatePixmap, XShmGetEventBase - X Shared Memory extension functions |
| 57 |
.SH SYNTAX |
| 58 |
.nf |
| 59 |
.LP |
| 60 |
\&#include <X11/Xlib.h> |
| 61 |
\&#include <sys/ipc.h> |
| 62 |
\&#include <sys/shm.h> |
| 63 |
\&#include <X11/extensions/XShm.h> |
| 64 |
.LP |
| 65 |
Bool XShmQueryExtension( |
| 66 |
Display *display); |
| 67 |
.LP |
| 68 |
Bool XShmQueryVersion( |
| 69 |
Display *display; |
| 70 |
int *major, *minor; |
| 71 |
Bool *pixmaps); |
| 72 |
.LP |
| 73 |
int XShmPixmapFormat( |
| 74 |
Display *display); |
| 75 |
.LP |
| 76 |
Bool XShmAttach( |
| 77 |
Display *display; |
| 78 |
XShmSegmentInfo *shminfo); |
| 79 |
.LP |
| 80 |
Bool XShmDetach( |
| 81 |
Display *display; |
| 82 |
XShmSegmentInfo *shminfo); |
| 83 |
|
| 84 |
.LP |
| 85 |
XImage *XShmCreateImage ( |
| 86 |
Display *display; |
| 87 |
Visual *visual; |
| 88 |
unsigned int depth; |
| 89 |
int format; |
| 90 |
char *data; |
| 91 |
XShmSegmentInfo *shminfo; |
| 92 |
unsigned int width, height); |
| 93 |
.LP |
| 94 |
Bool XShmPutImage( |
| 95 |
Display *display; |
| 96 |
Drawable d; |
| 97 |
GC gc; |
| 98 |
XImage *image; |
| 99 |
int src_x, src_y, dest_x, dest_y; |
| 100 |
unsigned int width, height; |
| 101 |
bool send_event); |
| 102 |
.LP |
| 103 |
Bool XShmGetImage ( |
| 104 |
Display *display; |
| 105 |
Drawable d; |
| 106 |
XImage *image; |
| 107 |
int x, y; |
| 108 |
unsigned long plane_mask); |
| 109 |
.LP |
| 110 |
Pixmap XShmCreatePixmap( |
| 111 |
Display *display; |
| 112 |
Drawable d; |
| 113 |
char *data; |
| 114 |
XShmSegmentInfo *shminfo; |
| 115 |
unsigned int width, height, depth); |
| 116 |
.LP |
| 117 |
Status XShmGetEventBase( |
| 118 |
Display *display); |
| 119 |
.LP |
| 120 |
|
| 121 |
.fi |
| 122 |
.SH STRUCTURES |
| 123 |
.nf |
| 124 |
.ta 3i |
| 125 |
\fIEvents:\fP |
| 126 |
typedef struct { |
| 127 |
int type; /\&* of event */ |
| 128 |
unsigned long serial; /\&* # of last request processed by server*/ |
| 129 |
Bool send_event; /\&* true if this came from a SendEvent request*/ |
| 130 |
Display *display; /\&* Display the event was read from */ |
| 131 |
Drawable drawable; /\&* drawable of request */ |
| 132 |
int major_code; /\&* ShmReqCode */ |
| 133 |
int minor_code; /\&* X_ShmPutImage */ |
| 134 |
ShmSeg shmseg; /\&* the ShmSeg used in the request*/ |
| 135 |
unsigned long offset; /\&* the offset into ShmSeg used in the request*/ |
| 136 |
} XShmCompletionEvent; |
| 137 |
.LP |
| 138 |
\fIa structure of type XShmSegmentInfo :\fP |
| 139 |
|
| 140 |
typedef struct { |
| 141 |
ShmSeg shmseg; /\&* resource id */ |
| 142 |
int shmid; /\&* kernel id */ |
| 143 |
char *shmaddr; /\&* address in client */ |
| 144 |
Bool readOnly; /\&* how the server should attach it */ |
| 145 |
} XShmSegmentInfo; |
| 146 |
|
| 147 |
.SH DESCRIPTION |
| 148 |
.PP |
| 149 |
.PP |
| 150 |
.ZN XShmQueryExtension |
| 151 |
checks to see if the shared memory extensions are available for the |
| 152 |
specified display. |
| 153 |
.PP |
| 154 |
.ZN XShmQueryVersion |
| 155 |
returns the version numbers of the extension implementation. Shared |
| 156 |
memory pixmaps are supported if the pixmaps argument returns true. |
| 157 |
.PP |
| 158 |
.ZN XShmAttach |
| 159 |
tells the server to attach to your shared memory segment. If all goes |
| 160 |
well, you will get a non-zero status, back and your XImage is ready |
| 161 |
for use. |
| 162 |
.PP |
| 163 |
.ZN XShmDetach |
| 164 |
tells the server to detach from your shared memory segment. |
| 165 |
.PP |
| 166 |
.ZN XShmPutImage |
| 167 |
combines an image in memory with a shape of the specified drawable. If |
| 168 |
XYBitmap format is used, the depth must be one, or a ``BadMatch'' |
| 169 |
error results. The foreground pixel in the GC defines the source for |
| 170 |
the one bits in the image, and the background pixel defines the source |
| 171 |
for the zero bits. For XYPixmap and ZPixmap, the depth must match the |
| 172 |
depth of the drawable, or a ``BadMatch'' error results. |
| 173 |
.PP |
| 174 |
.ZN XShmGetImage |
| 175 |
reads image data into a shared memory XImage where display is the |
| 176 |
display of interest, drawable is the source drawable, image is the |
| 177 |
destination XImage, x and y are offsets within the drawable, and |
| 178 |
plane_mask defines which planes are to be read. |
| 179 |
.PP |
| 180 |
.ZN XShmCreateImage |
| 181 |
allocates the memory needed for an XImage structure for the specified |
| 182 |
display but does not allocate space for the image itself. |
| 183 |
.PP |
| 184 |
.ZN XShmPixmapFormat |
| 185 |
gets the format for the server. If your application can deal with the |
| 186 |
server pixmap data format, a shared memory segment and shminfo |
| 187 |
structure are created. |
| 188 |
.PP |
| 189 |
.ZN XShmCreatePixmap |
| 190 |
points to a pixmap which you can manipulate in all of the usual ways, |
| 191 |
with the added bonus of being able to edit its contents directly |
| 192 |
through the shared memory segment. |
| 193 |
.PP |
| 194 |
.ZN XShmGetEventBase |
| 195 |
gets the completion event value. |
| 196 |
.PP |
| 197 |
.SH SEE ALSO |
| 198 |
\fIMIT-SHM - The MIT Shared Memory Extension \fP |