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 */
117 /* IMAGER_API_LEVEL 4 functions */
121 /* IMAGER_API_LEVEL 5 functions */
125 i_get_file_background,
126 i_get_file_backgroundf,
130 /* in general these functions aren't called by Imager internally, but
131 only via the pointers above, since faster macros that call the
132 image vtable pointers are used.
134 () are used around the function names to prevent macro replacement
135 on the function names.
139 =item i_ppix(im, x, y, color)
143 Sets the pixel at (x,y) to I<color>.
145 Returns 0 if the pixel was drawn, or -1 if not.
147 Does no alpha blending, just copies the channels from the supplied
154 (i_ppix)(i_img *im, int x, int y, const i_color *val) {
155 return i_ppix(im, x, y, val);
159 =item i_gpix(im, C<x>, C<y>, C<color>)
163 Retrieves the C<color> of the pixel (x,y).
165 Returns 0 if the pixel was retrieved, or -1 if not.
171 (i_gpix)(i_img *im,int x,int y,i_color *val) {
172 return i_gpix(im, x, y, val);
176 =item i_ppixf(im, C<x>, C<y>, C<fcolor>)
180 Sets the pixel at (C<x>,C<y>) to the floating point color C<fcolor>.
182 Returns 0 if the pixel was drawn, or -1 if not.
184 Does no alpha blending, just copies the channels from the supplied
190 (i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
191 return i_ppixf(im, x, y, val);
195 =item i_gpixf(im, C<x>, C<y>, C<fcolor>)
199 Retrieves the color of the pixel (x,y) as a floating point color into
202 Returns 0 if the pixel was retrieved, or -1 if not.
208 (i_gpixf)(i_img *im,int x,int y,i_fcolor *val) {
209 return i_gpixf(im, x, y, val);
213 =item i_plin(im, l, r, y, colors)
217 Sets (r-l) pixels starting from (l,y) using (r-l) values from
220 Returns the number of pixels set.
226 (i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
227 return i_plin(im, l, r, y, vals);
231 =item i_glin(im, l, r, y, colors)
235 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
237 Returns the number of pixels retrieved.
243 (i_glin)(i_img *im, int l, int r, int y, i_color *vals) {
244 return i_glin(im, l, r, y, vals);
248 =item i_plinf(im, C<left>, C<right>, C<fcolors>)
252 Sets (right-left) pixels starting from (left,y) using (right-left)
253 floating point colors from C<fcolors>.
255 Returns the number of pixels set.
261 (i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
262 return i_plinf(im, l, r, y, vals);
266 =item i_glinf(im, l, r, y, colors)
270 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
273 Returns the number of pixels retrieved.
279 (i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
280 return i_glinf(im, l, r, y, vals);
284 =item i_gsamp(im, left, right, y, samples, channels, channel_count)
288 Reads sample values from C<im> for the horizontal line (left, y) to
289 (right-1,y) for the channels specified by C<channels>, an array of int
290 with C<channel_count> elements.
292 If channels is NULL then the first channels_count channels are retrieved for
295 Returns the number of samples read (which should be (right-left) *
301 (i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp,
302 const int *chans, int chan_count) {
303 return i_gsamp(im, l, r, y, samp, chans, chan_count);
307 =item i_gsampf(im, left, right, y, samples, channels, channel_count)
311 Reads floating point sample values from C<im> for the horizontal line
312 (left, y) to (right-1,y) for the channels specified by C<channels>, an
313 array of int with channel_count elements.
315 If C<channels> is NULL then the first C<channel_count> channels are
316 retrieved for each pixel.
318 Returns the number of samples read (which should be (C<right>-C<left>)
324 (i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp,
325 const int *chans, int chan_count) {
326 return i_gsampf(im, l, r, y, samp, chans, chan_count);
330 =item i_gpal(im, left, right, y, indexes)
334 Reads palette indexes for the horizontal line (left, y) to (right-1,
337 Returns the number of indexes read.
339 Always returns 0 for direct color images.
344 (i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals) {
345 return i_gpal(im, x, r, y, vals);
349 =item i_ppal(im, left, right, y, indexes)
353 Writes palette indexes for the horizontal line (left, y) to (right-1,
356 Returns the number of indexes written.
358 Always returns 0 for direct color images.
363 (i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
364 return i_ppal(im, x, r, y, vals);
368 =item i_addcolors(im, colors, count)
370 =category Paletted images
372 Adds colors to the image's palette.
374 On success returns the index of the lowest color added.
376 On failure returns -1.
378 Always fails for direct color images.
384 (i_addcolors)(i_img *im, const i_color *colors, int count) {
385 return i_addcolors(im, colors, count);
389 =item i_getcolors(im, index, colors, count)
391 =category Paletted images
393 Retrieves I<count> colors starting from I<index> in the image's
396 On success stores the colors into I<colors> and returns true.
398 On failure returns false.
400 Always fails for direct color images.
402 Fails if there are less than I<index>+I<count> colors in the image's
409 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
410 return i_getcolors(im, i, colors, count);
414 =item i_colorcount(im)
416 =category Paletted images
418 Returns the number of colors in the image's palette.
420 Returns -1 for direct images.
426 (i_colorcount)(i_img *im) {
427 return i_colorcount(im);
431 =item i_maxcolors(im)
433 =category Paletted images
435 Returns the maximum number of colors the palette can hold for the
438 Returns -1 for direct color images.
444 (i_maxcolors)(i_img *im) {
445 return i_maxcolors(im);
449 =item i_findcolor(im, color, &entry)
451 =category Paletted images
453 Searches the images palette for the given color.
455 On success sets *I<entry> to the index of the color, and returns true.
457 On failure returns false.
459 Always fails on direct color images.
464 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
465 return i_findcolor(im, color, entry);
469 =item i_setcolors(im, index, colors, count)
471 =category Paletted images
473 Sets I<count> colors starting from I<index> in the image's palette.
475 On success returns true.
477 On failure returns false.
479 The image must have at least I<index>+I<count> colors in it's palette
482 Always fails on direct color images.
487 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
488 return i_setcolors(im, index, colors, count);