1XPutImage(3) XLIB FUNCTIONS XPutImage(3)
2
3
4
6 XPutImage, XGetImage, XGetSubImage - transfer images
7
9 int XPutImage(Display *display, Drawable d, GC gc, XImage *image, int
10 src_x, int src_y, int dest_x, int dest_y, unsigned int width,
11 unsigned int height);
12
13 XImage *XGetImage(Display *display, Drawable d, int x, int y, unsigned
14 int width, unsigned int height, unsigned long plane_mask, int
15 format);
16
17 XImage *XGetSubImage(Display *display, Drawable d, int x, int y, un‐
18 signed int width, unsigned int height, unsigned long plane_mask,
19 int format, XImage *dest_image, int dest_x, dest_y);
20
22 d Specifies the drawable.
23
24 dest_image
25 Specifies the destination image.
26
27 dest_x
28 dest_y Specify the x and y coordinates, which are relative to the
29 origin of the drawable and are the coordinates of the subim‐
30 age or which are relative to the origin of the destination
31 rectangle, specify its upper-left corner, and determine where
32 the subimage is placed in the destination image.
33
34 display Specifies the connection to the X server.
35
36 format Specifies the format for the image. You can pass XYPixmap or
37 ZPixmap.
38
39 gc Specifies the GC.
40
41 image Specifies the image you want combined with the rectangle.
42
43 plane_mask
44 Specifies the plane mask.
45
46 src_x Specifies the offset in X from the left edge of the image de‐
47 fined by the XImage structure.
48
49 src_y Specifies the offset in Y from the top edge of the image de‐
50 fined by the XImage structure.
51
52 width
53 height Specify the width and height of the subimage, which define
54 the dimensions of the rectangle.
55
56 x
57 y Specify the x and y coordinates, which are relative to the
58 origin of the drawable and define the upper-left corner of
59 the rectangle.
60
62 The XPutImage function combines an image with a rectangle of the speci‐
63 fied drawable. The section of the image defined by the src_x, src_y,
64 width, and height arguments is drawn on the specified part of the draw‐
65 able. If XYBitmap format is used, the depth of the image must be one,
66 or a BadMatch error results. The foreground pixel in the GC defines
67 the source for the one bits in the image, and the background pixel de‐
68 fines the source for the zero bits. For XYPixmap and ZPixmap, the
69 depth of the image must match the depth of the drawable, or a BadMatch
70 error results.
71
72 If the characteristics of the image (for example, byte_order and bit‐
73 map_unit) differ from what the server requires, XPutImage automatically
74 makes the appropriate conversions.
75
76 This function uses these GC components: function, plane-mask, subwin‐
77 dow-mode, clip-x-origin, clip-y-origin, and clip-mask. It also uses
78 these GC mode-dependent components: foreground and background.
79
80 XPutImage can generate BadDrawable, BadGC, BadMatch, and BadValue er‐
81 rors.
82
83 The XGetImage function returns a pointer to an XImage structure. This
84 structure provides you with the contents of the specified rectangle of
85 the drawable in the format you specify. If the format argument is XYP‐
86 ixmap, the image contains only the bit planes you passed to the
87 plane_mask argument. If the plane_mask argument only requests a subset
88 of the planes of the display, the depth of the returned image will be
89 the number of planes requested. If the format argument is ZPixmap,
90 XGetImage returns as zero the bits in all planes not specified in the
91 plane_mask argument. The function performs no range checking on the
92 values in plane_mask and ignores extraneous bits.
93
94 XGetImage returns the depth of the image to the depth member of the
95 XImage structure. The depth of the image is as specified when the
96 drawable was created, except when getting a subset of the planes in
97 XYPixmap format, when the depth is given by the number of bits set to 1
98 in plane_mask.
99
100 If the drawable is a pixmap, the given rectangle must be wholly con‐
101 tained within the pixmap, or a BadMatch error results. If the drawable
102 is a window, the window must be viewable, and it must be the case that
103 if there were no inferiors or overlapping windows, the specified rec‐
104 tangle of the window would be fully visible on the screen and wholly
105 contained within the outside edges of the window, or a BadMatch error
106 results. Note that the borders of the window can be included and read
107 with this request. If the window has backing-store, the backing-store
108 contents are returned for regions of the window that are obscured by
109 noninferior windows. If the window does not have backing-store, the
110 returned contents of such obscured regions are undefined. The returned
111 contents of visible regions of inferiors of a different depth than the
112 specified window's depth are also undefined. The pointer cursor image
113 is not included in the returned contents. If a problem occurs, XGetIm‐
114 age returns NULL.
115
116 XGetImage can generate BadDrawable, BadMatch, and BadValue errors.
117
118 The XGetSubImage function updates dest_image with the specified subim‐
119 age in the same manner as XGetImage. If the format argument is XYP‐
120 ixmap, the image contains only the bit planes you passed to the
121 plane_mask argument. If the format argument is ZPixmap, XGetSubImage
122 returns as zero the bits in all planes not specified in the plane_mask
123 argument. The function performs no range checking on the values in
124 plane_mask and ignores extraneous bits. As a convenience, XGetSubImage
125 returns a pointer to the same XImage structure specified by dest_image.
126
127 The depth of the destination XImage structure must be the same as that
128 of the drawable. If the specified subimage does not fit at the speci‐
129 fied location on the destination image, the right and bottom edges are
130 clipped. If the drawable is a pixmap, the given rectangle must be
131 wholly contained within the pixmap, or a BadMatch error results. If
132 the drawable is a window, the window must be viewable, and it must be
133 the case that if there were no inferiors or overlapping windows, the
134 specified rectangle of the window would be fully visible on the screen
135 and wholly contained within the outside edges of the window, or a Bad‐
136 Match error results. If the window has backing-store, then the back‐
137 ing-store contents are returned for regions of the window that are ob‐
138 scured by noninferior windows. If the window does not have backing-
139 store, the returned contents of such obscured regions are undefined.
140 The returned contents of visible regions of inferiors of a different
141 depth than the specified window's depth are also undefined. If a prob‐
142 lem occurs, XGetSubImage returns NULL.
143
144 XGetSubImage can generate BadDrawable, BadGC, BadMatch, and BadValue
145 errors.
146
148 BadDrawable
149 A value for a Drawable argument does not name a defined Win‐
150 dow or Pixmap.
151
152 BadGC A value for a GContext argument does not name a defined GCon‐
153 text.
154
155 BadMatch An InputOnly window is used as a Drawable.
156
157 BadMatch Some argument or pair of arguments has the correct type and
158 range but fails to match in some other way required by the
159 request.
160
161 BadValue Some numeric value falls outside the range of values accepted
162 by the request. Unless a specific range is specified for an
163 argument, the full range defined by the argument's type is
164 accepted. Any argument defined as a set of alternatives can
165 generate this error.
166
168 Xlib - C Language X Interface
169
170
171
172X Version 11 libX11 1.8.1 XPutImage(3)