1 #include "imexttypes.h"
5 DON'T ADD CASTS TO THESE
7 im_ext_funcs imager_function_table =
100 /* IMAGER_API_LEVEL 2 functions */
101 i_set_image_file_limits,
102 i_get_image_file_limits,
103 i_int_check_image_file_limits,
106 i_flood_cfill_border,
109 /* in general these functions aren't called by Imager internally, but
110 only via the pointers above, since faster macros that call the
111 image vtable pointers are used.
113 () are used around the function names to prevent macro replacement
114 on the function names.
118 =item i_ppix(im, x, y, color)
122 Sets the pixel at (x,y) to I<color>.
124 Returns 0 if the pixel was drawn, or -1 if not.
126 Does no alpha blending, just copies the channels from the supplied
133 (i_ppix)(i_img *im, int x, int y, const i_color *val) {
134 return i_ppix(im, x, y, val);
138 =item i_gpix(im, x, y, color)
142 Retrieves the I<color> of the pixel (x,y).
144 Returns 0 if the pixel was retrieved, or -1 if not.
150 (i_gpix)(i_img *im,int x,int y,i_color *val) {
151 return i_gpix(im, x, y, val);
155 =item i_ppixf(im, x, y, fcolor)
159 Sets the pixel at (x,y) to the floating point color I<fcolor>.
161 Returns 0 if the pixel was drawn, or -1 if not.
163 Does no alpha blending, just copies the channels from the supplied
169 (i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
170 return i_ppixf(im, x, y, val);
174 =item i_gpixf(im, x, y, fcolor)
178 Retrieves the color of the pixel (x,y) as a floating point color into
181 Returns 0 if the pixel was retrieved, or -1 if not.
187 (i_gpixf)(i_img *im,int x,int y,i_fcolor *val) {
188 return i_gpixf(im, x, y, val);
192 =item i_plin(im, l, r, y, colors)
196 Sets (r-l) pixels starting from (l,y) using (r-l) values from
199 Returns the number of pixels set.
205 (i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
206 return i_plin(im, l, r, y, vals);
210 =item i_glin(im, l, r, y, colors)
214 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
216 Returns the number of pixels retrieved.
222 (i_glin)(i_img *im, int l, int r, int y, i_color *vals) {
223 return i_glin(im, l, r, y, vals);
227 =item i_plinf(im, l, r, fcolors)
231 Sets (r-l) pixels starting from (l,y) using (r-l) floating point
232 colors from I<colors>.
234 Returns the number of pixels set.
240 (i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
241 return i_plinf(im, l, r, y, vals);
245 =item i_glinf(im, l, r, y, colors)
249 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
252 Returns the number of pixels retrieved.
258 (i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
259 return i_glinf(im, l, r, y, vals);
263 =item i_gsamp(im, l, r, y, samp, chans, chan_count)
267 Reads sample values from im for the horizontal line (l, y) to (r-1,y)
268 for the channels specified by chans, an array of int with chan_count
271 If chans is NULL then the first chan_count channels are retrieved for
274 Returns the number of samples read (which should be (r-l) *
280 (i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp,
281 const int *chans, int chan_count) {
282 return i_gsamp(im, l, r, y, samp, chans, chan_count);
286 =item i_gsampf(im, l, r, y, samp, chans, chan_count)
290 Reads floating point sample values from im for the horizontal line (l,
291 y) to (r-1,y) for the channels specified by chans, an array of int
292 with chan_count elements.
294 If chans is NULL then the first chan_count channels are retrieved for
297 Returns the number of samples read (which should be (r-l) *
303 (i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp,
304 const int *chans, int chan_count) {
305 return i_gsampf(im, l, r, y, samp, chans, chan_count);
309 =item i_gpal(im, x, r, y, indexes)
313 Reads palette indexes for the horizontal line (x, y) to (r-1, y) into
316 Returns the number of indexes read.
318 Always returns 0 for direct color images.
323 (i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals) {
324 return i_gpal(im, x, r, y, vals);
328 =item i_ppal(im, x, r, y, indexes)
332 Writes palette indexes for the horizontal line (x, y) to (r-1, y) from
335 Returns the number of indexes written.
337 Always returns 0 for direct color images.
342 (i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
343 return i_ppal(im, x, r, y, vals);
347 =item i_addcolors(im, colors, count)
349 =category Paletted images
351 Adds colors to the image's palette.
353 On success returns the index of the lowest color added.
355 On failure returns -1.
357 Always fails for direct color images.
363 (i_addcolors)(i_img *im, const i_color *colors, int count) {
364 return i_addcolors(im, colors, count);
368 =item i_getcolors(im, index, colors, count)
370 =category Paletted images
372 Retrieves I<count> colors starting from I<index> in the image's
375 On success stores the colors into I<colors> and returns true.
377 On failure returns false.
379 Always fails for direct color images.
381 Fails if there are less than I<index>+I<count> colors in the image's
388 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
389 return i_getcolors(im, i, colors, count);
393 =item i_colorcount(im)
395 =category Paletted images
397 Returns the number of colors in the image's palette.
399 Returns -1 for direct images.
405 (i_colorcount)(i_img *im) {
406 return i_colorcount(im);
410 =item i_maxcolors(im)
412 =category Paletted images
414 Returns the maximum number of colors the palette can hold for the
417 Returns -1 for direct color images.
423 (i_maxcolors)(i_img *im) {
424 return i_maxcolors(im);
428 =item i_findcolor(im, color, &entry)
430 =category Paletted images
432 Searches the images palette for the given color.
434 On success sets *I<entry> to the index of the color, and returns true.
436 On failure returns false.
438 Always fails on direct color images.
443 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
444 return i_findcolor(im, color, entry);
448 =item i_setcolors(im, index, colors, count)
450 =category Paletted images
452 Sets I<count> colors starting from I<index> in the image's palette.
454 On sucess returns true.
456 On failure returns false.
458 The image must have at least I<index>+I<count> colors in it's palette
461 Always fails on direct color images.
466 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
467 return i_setcolors(im, index, colors, count);