1 #include "imexttypes.h"
5 DON'T ADD CASTS TO THESE
7 im_ext_funcs imager_function_table =
101 /* in general these functions aren't called by Imager internally, but
102 only via the pointers above, since faster macros that call the
103 image vtable pointers are used.
105 () are used around the function names to prevent macro replacement
106 on the function names.
110 =item i_ppix(im, x, y, color)
114 Sets the pixel at (x,y) to I<color>.
116 Returns 0 if the pixel was drawn, or -1 if not.
118 Does no alpha blending, just copies the channels from the supplied
125 (i_ppix)(i_img *im, int x, int y, const i_color *val) {
126 return i_ppix(im, x, y, val);
130 =item i_gpix(im, x, y, color)
134 Retrieves the I<color> of the pixel (x,y).
136 Returns 0 if the pixel was retrieved, or -1 if not.
142 (i_gpix)(i_img *im,int x,int y,i_color *val) {
143 return i_gpix(im, x, y, val);
147 =item i_ppixf(im, x, y, fcolor)
151 Sets the pixel at (x,y) to the floating point color I<fcolor>.
153 Returns 0 if the pixel was drawn, or -1 if not.
155 Does no alpha blending, just copies the channels from the supplied
161 (i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
162 return i_ppixf(im, x, y, val);
166 =item i_gpixf(im, x, y, fcolor)
170 Retrieves the color of the pixel (x,y) as a floating point color into
173 Returns 0 if the pixel was retrieved, or -1 if not.
179 (i_gpixf)(i_img *im,int x,int y,i_fcolor *val) {
180 return i_gpixf(im, x, y, val);
184 =item i_plin(im, l, r, y, colors)
188 Sets (r-l) pixels starting from (l,y) using (r-l) values from
191 Returns the number of pixels set.
197 (i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
198 return i_plin(im, l, r, y, vals);
202 =item i_glin(im, l, r, y, colors)
206 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
208 Returns the number of pixels retrieved.
214 (i_glin)(i_img *im, int l, int r, int y, i_color *vals) {
215 return i_glin(im, l, r, y, vals);
219 =item i_plinf(im, l, r, fcolors)
223 Sets (r-l) pixels starting from (l,y) using (r-l) floating point
224 colors from I<colors>.
226 Returns the number of pixels set.
232 (i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
233 return i_plinf(im, l, r, y, vals);
237 =item i_glinf(im, l, r, y, colors)
241 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
244 Returns the number of pixels retrieved.
250 (i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
251 return i_glinf(im, l, r, y, vals);
255 =item i_gsamp(im, l, r, y, samp, chans, chan_count)
259 Reads sample values from im for the horizontal line (l, y) to (r-1,y)
260 for the channels specified by chans, an array of int with chan_count
263 If chans is NULL then the first chan_count channels are retrieved for
266 Returns the number of samples read (which should be (r-l) *
272 (i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp,
273 const int *chans, int chan_count) {
274 return i_gsamp(im, l, r, y, samp, chans, chan_count);
278 =item i_gsampf(im, l, r, y, samp, chans, chan_count)
282 Reads floating point sample values from im for the horizontal line (l,
283 y) to (r-1,y) for the channels specified by chans, an array of int
284 with chan_count elements.
286 If chans is NULL then the first chan_count channels are retrieved for
289 Returns the number of samples read (which should be (r-l) *
295 (i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp,
296 const int *chans, int chan_count) {
297 return i_gsampf(im, l, r, y, samp, chans, chan_count);
301 =item i_gpal(im, x, r, y, indexes)
305 Reads palette indexes for the horizontal line (x, y) to (r-1, y) into
308 Returns the number of indexes read.
310 Always returns 0 for direct color images.
315 (i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals) {
316 return i_gpal(im, x, r, y, vals);
320 =item i_ppal(im, x, r, y, indexes)
324 Writes palette indexes for the horizontal line (x, y) to (r-1, y) from
327 Returns the number of indexes written.
329 Always returns 0 for direct color images.
334 (i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
335 return i_ppal(im, x, r, y, vals);
339 =item i_addcolors(im, colors, count)
341 =category Paletted images
343 Adds colors to the image's palette.
345 On success returns the index of the lowest color added.
347 On failure returns -1.
349 Always fails for direct color images.
355 (i_addcolors)(i_img *im, const i_color *colors, int count) {
356 return i_addcolors(im, colors, count);
360 =item i_getcolors(im, index, colors, count)
362 =category Paletted images
364 Retrieves I<count> colors starting from I<index> in the image's
367 On success stores the colors into I<colors> and returns true.
369 On failure returns false.
371 Always fails for direct color images.
373 Fails if there are less than I<index>+I<count> colors in the image's
380 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
381 return i_getcolors(im, i, colors, count);
385 =item i_colorcount(im)
387 =category Paletted images
389 Returns the number of colors in the image's palette.
391 Returns -1 for direct images.
397 (i_colorcount)(i_img *im) {
398 return i_colorcount(im);
402 =item i_maxcolors(im)
404 =category Paletted images
406 Returns the maximum number of colors the palette can hold for the
409 Returns -1 for direct color images.
415 (i_maxcolors)(i_img *im) {
416 return i_maxcolors(im);
420 =item i_findcolor(im, color, &entry)
422 =category Paletted images
424 Searches the images palette for the given color.
426 On success sets *I<entry> to the index of the color, and returns true.
428 On failure returns false.
430 Always fails on direct color images.
435 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
436 return i_findcolor(im, color, entry);
440 =item i_setcolors(im, index, colors, count)
442 =category Paletted images
444 Sets I<count> colors starting from I<index> in the image's palette.
446 On sucess returns true.
448 On failure returns false.
450 The image must have at least I<index>+I<count> colors in it's palette
453 Always fails on direct color images.
458 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
459 return i_setcolors(im, index, colors, count);