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, int col)
22 Image *allocimagemix(Display *d, ulong one, ulong three)
25 void 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 given by its arguments.
107 Convenient pixel channels like
116 All the new image's pixels will have initial value
122 no initialization is done.
123 Representative useful values of color are predefined:
128 Colors are specified by 32-bit numbers comprising,
129 from most to least significant byte,
130 8-bit values for red, green, blue, and alpha.
131 The values correspond to illumination, so 0 is black and 255 is white.
132 Similarly, for alpha 0 is transparent and 255 is opaque.
135 field will have been set to the identifying number used by
144 is true, the clip rectangle is set to a very large region; if false, it is set to
148 field will be set to the number of bits per pixel specified
149 by the channel descriptor
153 returns 0 if the server has run out of image memory.
156 is used to allocate background colors.
157 On 8-bit color-mapped displays, it
158 returns a 2×2 replicated image with one pixel colored
161 and the other three with
163 (This simulates a wider range of tones than can be represented by a single pixel
164 value on a color-mapped display.)
165 On true color displays, it returns a 1×1 replicated image
166 whose pixel is the result of mixing the two colors in
167 a one to three ratio.
170 frees the resources used by its argument image.
173 publishes in the server the image
179 is non-zero, the image is published; otherwise
181 must be already named
183 and it is withdrawn from publication.
185 returns a reference to the image published under the given
190 These routines permit unrelated applications sharing a display to share an image;
191 for example they provide the mechanism behind
196 The RGB values in a color are
198 by the alpha value; for example, a 50% red is
204 performs the alpha computation on a given
206 ignoring its initial alpha value, multiplying the components by the supplied
208 For example, to make a 50% red color value, one could execute
212 The remaining functions deal with moving groups of pixel
213 values between image and user space or external files.
214 There is a fixed format for the exchange and storage of
220 reads a rectangle of pixels from image
224 whose length is specified by
228 is too small to accommodate the pixels.
231 replaces the specified rectangle in image
238 The pixels are presented one horizontal line at a time,
239 starting with the top-left pixel of
241 In the data processed by these routines, each scan line starts with a new byte in the array,
242 leaving the last byte of the previous line partially empty, if necessary.
243 Pixels are packed as tightly as possible within
245 regardless of the rectangle being extracted.
246 Bytes are filled from most to least significant bit order,
249 coordinate increases, aligned so
251 would appear as the leftmost pixel of its byte.
256 offset 165 within the rectangle will be in a
260 regardless of the overall
261 rectangle: 165 mod 8 equals 5, and
271 bytes of compressed image
279 must be at the beginning of a compressed data block, in particular,
280 it should start with the
282 coordinate and data length for the block.
288 return the number of bytes copied.
291 creates an image from data contained in an external file (see
293 for the file format);
295 is a file descriptor obtained by opening such a file for reading.
296 The returned image is allocated using
300 flag specifies whether the
302 should be synchronized for multithreaded access; single-threaded
303 programs can leave it zero.
310 which should be open for writing.
311 The format is as described for
323 return the number of bytes or words occupied in memory by one scan line of rectangle
329 To allocate a single-pixel replicated image that may be used to paint a region red,
331 red = allocimage(display, Rect(0, 0, 1, 1), RGB24, 1, DRed);
334 .B /usr/local/plan9/src/libdraw
341 These functions return pointer 0 or integer \-1 on failure, usually due to insufficient
348 must be a divisor or multiple of 8.