1XCreateImage(3) XLIB FUNCTIONS XCreateImage(3)
2
3
4
6 XInitImage, XCreateImage, XGetPixel, XPutPixel, XSubImage, XAddPixel,
7 XDestroyImage - image utilities
8
10 Status XInitImage(XImage *image);
11
12 XImage *XCreateImage(Display *display, Visual *visual, unsigned int
13 depth, int format, int offset, char *data, unsigned int width,
14 unsigned int height, int bitmap_pad, int bytes_per_line);
15
16 unsigned long XGetPixel(XImage *ximage, int x, int y);
17
18 int XPutPixel(XImage *ximage, int x, int y, unsigned long pixel);
19
20 XImage *XSubImage(XImage *ximage, int x, int y, unsigned int subim‐
21 age_width, unsigned int subimage_height);
22
23 int XAddPixel(XImage *ximage, long value);
24
25 int XDestroyImage(XImage *ximage);
26
28 bitmap_pad
29 Specifies the quantum of a scanline (8, 16, or 32). In other
30 words, the start of one scanline is separated in client mem‐
31 ory from the start of the next scanline by an integer multi‐
32 ple of this many bits.
33
34 bytes_per_line
35 Specifies the number of bytes in the client image between the
36 start of one scanline and the start of the next.
37
38 data Specifies the image data.
39
40 depth Specifies the depth of the image.
41
42 display Specifies the connection to the X server.
43
44 format Specifies the format for the image. You can pass XYBitmap,
45 XYPixmap, or ZPixmap.
46
47 height Specifies the height of the image, in pixels.
48
49 offset Specifies the number of pixels to ignore at the beginning of
50 the scanline.
51
52 pixel Specifies the new pixel value.
53
54 subimage_height
55 Specifies the height of the new subimage, in pixels.
56
57 subimage_width
58 Specifies the width of the new subimage, in pixels.
59
60 value Specifies the constant value that is to be added.
61
62 visual Specifies the Visual structure.
63
64 width Specifies the width of the image, in pixels.
65
66 ximage Specifies the image.
67
68 x
69 y Specify the x and y coordinates.
70
72 The XInitImage function initializes the internal image manipulation
73 routines of an image structure, based on the values of the various
74 structure members. All fields other than the manipulation routines
75 must already be initialized. If the bytes_per_line member is zero,
76 XInitImage will assume the image data is contiguous in memory and set
77 the bytes_per_line member to an appropriate value based on the other
78 members; otherwise, the value of bytes_per_line is not changed. All of
79 the manipulation routines are initialized to functions that other Xlib
80 image manipulation functions need to operate on the type of image spec‐
81 ified by the rest of the structure.
82
83 This function must be called for any image constructed by the client
84 before passing it to any other Xlib function. Image structures created
85 or returned by Xlib do not need to be initialized in this fashion.
86
87 This function returns a nonzero status if initialization of the struc‐
88 ture is successful. It returns zero if it detected some error or in‐
89 consistency in the structure, in which case the image is not changed.
90
91 The XCreateImage function allocates the memory needed for an XImage
92 structure for the specified display but does not allocate space for the
93 image itself. Rather, it initializes the structure byte-order, bit-or‐
94 der, and bitmap-unit values from the display and returns a pointer to
95 the XImage structure. The red, green, and blue mask values are defined
96 for Z format images only and are derived from the Visual structure
97 passed in. Other values also are passed in. The offset permits the
98 rapid displaying of the image without requiring each scanline to be
99 shifted into position. If you pass a zero value in bytes_per_line,
100 Xlib assumes that the scanlines are contiguous in memory and calculates
101 the value of bytes_per_line itself.
102
103 Note that when the image is created using XCreateImage, XGetImage, or
104 XSubImage, the destroy procedure that the XDestroyImage function calls
105 frees both the image structure and the data pointed to by the image
106 structure.
107
108 The basic functions used to get a pixel, set a pixel, create a subim‐
109 age, and add a constant value to an image are defined in the image ob‐
110 ject. The functions in this section are really macro invocations of
111 the functions in the image object and are defined in X11/Xutil.h.
112
113 The XGetPixel function returns the specified pixel from the named im‐
114 age. The pixel value is returned in normalized format (that is, the
115 least significant byte of the long is the least significant byte of the
116 pixel). The image must contain the x and y coordinates.
117
118 The XPutPixel function overwrites the pixel in the named image with the
119 specified pixel value. The input pixel value must be in normalized
120 format (that is, the least significant byte of the long is the least
121 significant byte of the pixel). The image must contain the x and y co‐
122 ordinates.
123
124 The XSubImage function creates a new image that is a subsection of an
125 existing one. It allocates the memory necessary for the new XImage
126 structure and returns a pointer to the new image. The data is copied
127 from the source image, and the image must contain the rectangle defined
128 by x, y, subimage_width, and subimage_height.
129
130 The XAddPixel function adds a constant value to every pixel in an im‐
131 age. It is useful when you have a base pixel value from allocating
132 color resources and need to manipulate the image to that form.
133
134 The XDestroyImage function deallocates the memory associated with the
135 XImage structure.
136
138 XPutImage(3)
139 Xlib - C Language X Interface
140
141
142
143X Version 11 libX11 1.8.7 XCreateImage(3)