3 allocimage, allocimagemix, freeimage, nameimage, namedimage, setalpha, loadimage, cloadimage, unloadimage, readimage, writeimage, bytesperline, wordsperline \- allocating, freeing, reading, writing images
16 Image *allocimage(Display *d, Rectangle r,
19 ulong chan, int repl, ulong col)
22 Image *allocimagemix(Display *d, ulong one, ulong three)
25 int freeimage(Image *i)
28 int nameimage(Image *i, char *name, int in)
31 Image *namedimage(Display *d, char *name)
34 ulong setalpha(ulong color, uchar alpha)
37 int loadimage(Image *i, Rectangle r, uchar *data, int ndata)
40 int cloadimage(Image *i, Rectangle r, uchar *data, int ndata)
43 int unloadimage(Image *i, Rectangle r, uchar *data, int ndata)
46 Image *readimage(Display *d, int fd, int dolock)
49 int writeimage(int fd, Image *i, int dolock)
52 int bytesperline(Rectangle r, int d)
55 int wordsperline(Rectangle r, int d)
65 DTransparent = 0x00000000,
72 DMagenta = 0xFF00FFFF,
74 DPaleyellow = 0xFFFFAAFF,
75 DDarkyellow = 0xEEEE9EFF,
76 DDarkgreen = 0x448844FF,
77 DPalegreen = 0xAAFFAAFF,
78 DMedgreen = 0x88CC88FF,
79 DDarkblue = 0x000055FF,
80 DPalebluegreen = 0xAAFFFFFF,
81 DPaleblue = 0x0000BBFF,
82 DBluegreen = 0x008888FF,
83 DGreygreen = 0x55AAAAFF,
84 DPalegreygreen = 0x9EEEEEFF,
85 DYellowgreen = 0x99994CFF,
86 DMedblue = 0x000099FF,
87 DGreyblue = 0x005DBBFF,
88 DPalegreyblue = 0x4993DDFF,
89 DPurpleblue = 0x8888CCFF,
91 DNotacolor = 0xFFFFFF00,
104 it will have the rectangle, pixel channel format,
106 and initial fill color
107 given by its arguments.
108 Convenient pixel channels like
117 All the new image's pixels will have initial value
123 no initialization is done.
124 Representative useful values of color are predefined:
129 Colors are specified by 32-bit numbers comprising,
130 from most to least significant byte,
131 8-bit values for red, green, blue, and alpha.
132 The values correspond to illumination, so 0 is black and 255 is white.
133 Similarly, for alpha 0 is transparent and 255 is opaque.
136 field will have been set to the identifying number used by
145 is true, the clip rectangle is set to a very large region; if false, it is set to
149 field will be set to the number of bits per pixel specified
150 by the channel descriptor
154 returns 0 if the server has run out of image memory.
157 is used to allocate background colors.
158 On 8-bit color-mapped displays, it
159 returns a 2×2 replicated image with one pixel colored
162 and the other three with
164 (This simulates a wider range of tones than can be represented by a single pixel
165 value on a color-mapped display.)
166 On true color displays, it returns a 1×1 replicated image
167 whose pixel is the result of mixing the two colors in
168 a one to three ratio.
171 frees the resources used by its argument image.
174 publishes in the server the image
180 is non-zero, the image is published; otherwise
182 must be already named
184 and it is withdrawn from publication.
186 returns a reference to the image published under the given
191 These routines permit unrelated applications sharing a display to share an image;
192 for example they provide the mechanism behind
197 The RGB values in a color are
199 by the alpha value; for example, a 50% red is
205 performs the alpha computation on a given
207 ignoring its initial alpha value, multiplying the components by the supplied
209 For example, to make a 50% red color value, one could execute
213 The remaining functions deal with moving groups of pixel
214 values between image and user space or external files.
215 There is a fixed format for the exchange and storage of
221 reads a rectangle of pixels from image
225 whose length is specified by
229 is too small to accommodate the pixels.
232 replaces the specified rectangle in image
239 The pixels are presented one horizontal line at a time,
240 starting with the top-left pixel of
242 In the data processed by these routines, each scan line starts with a new byte in the array,
243 leaving the last byte of the previous line partially empty, if necessary.
244 Pixels are packed as tightly as possible within
246 regardless of the rectangle being extracted.
247 Bytes are filled from most to least significant bit order,
250 coordinate increases, aligned so
252 would appear as the leftmost pixel of its byte.
257 offset 165 within the rectangle will be in a
261 regardless of the overall
262 rectangle: 165 mod 8 equals 5, and
272 bytes of compressed image
280 must be at the beginning of a compressed data block, in particular,
281 it should start with the
283 coordinate and data length for the block.
289 return the number of bytes copied.
292 creates an image from data contained in an external file (see
294 for the file format);
296 is a file descriptor obtained by opening such a file for reading.
297 The returned image is allocated using
301 flag specifies whether the
303 should be synchronized for multithreaded access; single-threaded
304 programs can leave it zero.
311 which should be open for writing.
312 The format is as described for
324 return the number of bytes or words occupied in memory by one scan line of rectangle
330 To allocate a single-pixel replicated image that may be used to paint a region red,
332 red = allocimage(display, Rect(0, 0, 1, 1), RGB24, 1, DRed);
342 These functions return pointer 0 or integer \-1 on failure, usually due to insufficient
349 must be a divisor or multiple of 8.