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,
108 /* IMAGER_API_LEVEL 3 functions */
118 /* in general these functions aren't called by Imager internally, but
119 only via the pointers above, since faster macros that call the
120 image vtable pointers are used.
122 () are used around the function names to prevent macro replacement
123 on the function names.
127 =item i_ppix(im, x, y, color)
131 Sets the pixel at (x,y) to I<color>.
133 Returns 0 if the pixel was drawn, or -1 if not.
135 Does no alpha blending, just copies the channels from the supplied
142 (i_ppix)(i_img *im, int x, int y, const i_color *val) {
143 return i_ppix(im, x, y, val);
147 =item i_gpix(im, x, y, color)
151 Retrieves the I<color> of the pixel (x,y).
153 Returns 0 if the pixel was retrieved, or -1 if not.
159 (i_gpix)(i_img *im,int x,int y,i_color *val) {
160 return i_gpix(im, x, y, val);
164 =item i_ppixf(im, x, y, fcolor)
168 Sets the pixel at (x,y) to the floating point color I<fcolor>.
170 Returns 0 if the pixel was drawn, or -1 if not.
172 Does no alpha blending, just copies the channels from the supplied
178 (i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
179 return i_ppixf(im, x, y, val);
183 =item i_gpixf(im, x, y, fcolor)
187 Retrieves the color of the pixel (x,y) as a floating point color into
190 Returns 0 if the pixel was retrieved, or -1 if not.
196 (i_gpixf)(i_img *im,int x,int y,i_fcolor *val) {
197 return i_gpixf(im, x, y, val);
201 =item i_plin(im, l, r, y, colors)
205 Sets (r-l) pixels starting from (l,y) using (r-l) values from
208 Returns the number of pixels set.
214 (i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
215 return i_plin(im, l, r, y, vals);
219 =item i_glin(im, l, r, y, colors)
223 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
225 Returns the number of pixels retrieved.
231 (i_glin)(i_img *im, int l, int r, int y, i_color *vals) {
232 return i_glin(im, l, r, y, vals);
236 =item i_plinf(im, l, r, fcolors)
240 Sets (r-l) pixels starting from (l,y) using (r-l) floating point
241 colors from I<colors>.
243 Returns the number of pixels set.
249 (i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
250 return i_plinf(im, l, r, y, vals);
254 =item i_glinf(im, l, r, y, colors)
258 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
261 Returns the number of pixels retrieved.
267 (i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
268 return i_glinf(im, l, r, y, vals);
272 =item i_gsamp(im, l, r, y, samp, chans, chan_count)
276 Reads sample values from im for the horizontal line (l, y) to (r-1,y)
277 for the channels specified by chans, an array of int with chan_count
280 If chans is NULL then the first chan_count channels are retrieved for
283 Returns the number of samples read (which should be (r-l) *
289 (i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp,
290 const int *chans, int chan_count) {
291 return i_gsamp(im, l, r, y, samp, chans, chan_count);
295 =item i_gsampf(im, l, r, y, samp, chans, chan_count)
299 Reads floating point sample values from im for the horizontal line (l,
300 y) to (r-1,y) for the channels specified by chans, an array of int
301 with chan_count elements.
303 If chans is NULL then the first chan_count channels are retrieved for
306 Returns the number of samples read (which should be (r-l) *
312 (i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp,
313 const int *chans, int chan_count) {
314 return i_gsampf(im, l, r, y, samp, chans, chan_count);
318 =item i_gpal(im, x, r, y, indexes)
322 Reads palette indexes for the horizontal line (x, y) to (r-1, y) into
325 Returns the number of indexes read.
327 Always returns 0 for direct color images.
332 (i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals) {
333 return i_gpal(im, x, r, y, vals);
337 =item i_ppal(im, x, r, y, indexes)
341 Writes palette indexes for the horizontal line (x, y) to (r-1, y) from
344 Returns the number of indexes written.
346 Always returns 0 for direct color images.
351 (i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
352 return i_ppal(im, x, r, y, vals);
356 =item i_addcolors(im, colors, count)
358 =category Paletted images
360 Adds colors to the image's palette.
362 On success returns the index of the lowest color added.
364 On failure returns -1.
366 Always fails for direct color images.
372 (i_addcolors)(i_img *im, const i_color *colors, int count) {
373 return i_addcolors(im, colors, count);
377 =item i_getcolors(im, index, colors, count)
379 =category Paletted images
381 Retrieves I<count> colors starting from I<index> in the image's
384 On success stores the colors into I<colors> and returns true.
386 On failure returns false.
388 Always fails for direct color images.
390 Fails if there are less than I<index>+I<count> colors in the image's
397 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
398 return i_getcolors(im, i, colors, count);
402 =item i_colorcount(im)
404 =category Paletted images
406 Returns the number of colors in the image's palette.
408 Returns -1 for direct images.
414 (i_colorcount)(i_img *im) {
415 return i_colorcount(im);
419 =item i_maxcolors(im)
421 =category Paletted images
423 Returns the maximum number of colors the palette can hold for the
426 Returns -1 for direct color images.
432 (i_maxcolors)(i_img *im) {
433 return i_maxcolors(im);
437 =item i_findcolor(im, color, &entry)
439 =category Paletted images
441 Searches the images palette for the given color.
443 On success sets *I<entry> to the index of the color, and returns true.
445 On failure returns false.
447 Always fails on direct color images.
452 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
453 return i_findcolor(im, color, entry);
457 =item i_setcolors(im, index, colors, count)
459 =category Paletted images
461 Sets I<count> colors starting from I<index> in the image's palette.
463 On sucess returns true.
465 On failure returns false.
467 The image must have at least I<index>+I<count> colors in it's palette
470 Always fails on direct color images.
475 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
476 return i_setcolors(im, index, colors, count);