1 #include "imexttypes.h"
6 DON'T ADD CASTS TO THESE
8 im_ext_funcs imager_function_table =
101 /* IMAGER_API_LEVEL 2 functions */
102 i_set_image_file_limits,
103 i_get_image_file_limits,
104 i_int_check_image_file_limits,
107 i_flood_cfill_border,
109 /* IMAGER_API_LEVEL 3 functions */
118 /* IMAGER_API_LEVEL 4 functions */
122 /* IMAGER_API_LEVEL 5 functions */
126 i_get_file_background,
127 i_get_file_backgroundf,
137 /* in general these functions aren't called by Imager internally, but
138 only via the pointers above, since faster macros that call the
139 image vtable pointers are used.
141 () are used around the function names to prevent macro replacement
142 on the function names.
146 =item i_ppix(im, x, y, color)
150 Sets the pixel at (x,y) to I<color>.
152 Returns 0 if the pixel was drawn, or -1 if not.
154 Does no alpha blending, just copies the channels from the supplied
161 (i_ppix)(i_img *im, int x, int y, const i_color *val) {
162 return i_ppix(im, x, y, val);
166 =item i_gpix(im, C<x>, C<y>, C<color>)
170 Retrieves the C<color> of the pixel (x,y).
172 Returns 0 if the pixel was retrieved, or -1 if not.
178 (i_gpix)(i_img *im,int x,int y,i_color *val) {
179 return i_gpix(im, x, y, val);
183 =item i_ppixf(im, C<x>, C<y>, C<fcolor>)
187 Sets the pixel at (C<x>,C<y>) to the floating point color C<fcolor>.
189 Returns 0 if the pixel was drawn, or -1 if not.
191 Does no alpha blending, just copies the channels from the supplied
197 (i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
198 return i_ppixf(im, x, y, val);
202 =item i_gpixf(im, C<x>, C<y>, C<fcolor>)
206 Retrieves the color of the pixel (x,y) as a floating point color into
209 Returns 0 if the pixel was retrieved, or -1 if not.
215 (i_gpixf)(i_img *im,int x,int y,i_fcolor *val) {
216 return i_gpixf(im, x, y, val);
220 =item i_plin(im, l, r, y, colors)
224 Sets (r-l) pixels starting from (l,y) using (r-l) values from
227 Returns the number of pixels set.
233 (i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
234 return i_plin(im, l, r, y, vals);
238 =item i_glin(im, l, r, y, colors)
242 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
244 Returns the number of pixels retrieved.
250 (i_glin)(i_img *im, int l, int r, int y, i_color *vals) {
251 return i_glin(im, l, r, y, vals);
255 =item i_plinf(im, C<left>, C<right>, C<fcolors>)
259 Sets (right-left) pixels starting from (left,y) using (right-left)
260 floating point colors from C<fcolors>.
262 Returns the number of pixels set.
268 (i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
269 return i_plinf(im, l, r, y, vals);
273 =item i_glinf(im, l, r, y, colors)
277 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
280 Returns the number of pixels retrieved.
286 (i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
287 return i_glinf(im, l, r, y, vals);
291 =item i_gsamp(im, left, right, y, samples, channels, channel_count)
295 Reads sample values from C<im> for the horizontal line (left, y) to
296 (right-1,y) for the channels specified by C<channels>, an array of int
297 with C<channel_count> elements.
299 If channels is NULL then the first channels_count channels are retrieved for
302 Returns the number of samples read (which should be (right-left) *
308 (i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp,
309 const int *chans, int chan_count) {
310 return i_gsamp(im, l, r, y, samp, chans, chan_count);
314 =item i_gsampf(im, left, right, y, samples, channels, channel_count)
318 Reads floating point sample values from C<im> for the horizontal line
319 (left, y) to (right-1,y) for the channels specified by C<channels>, an
320 array of int with channel_count elements.
322 If C<channels> is NULL then the first C<channel_count> channels are
323 retrieved for each pixel.
325 Returns the number of samples read (which should be (C<right>-C<left>)
331 (i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp,
332 const int *chans, int chan_count) {
333 return i_gsampf(im, l, r, y, samp, chans, chan_count);
337 =item i_gpal(im, left, right, y, indexes)
341 Reads palette indexes for the horizontal line (left, y) to (right-1,
344 Returns the number of indexes read.
346 Always returns 0 for direct color images.
351 (i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals) {
352 return i_gpal(im, x, r, y, vals);
356 =item i_ppal(im, left, right, y, indexes)
360 Writes palette indexes for the horizontal line (left, y) to (right-1,
363 Returns the number of indexes written.
365 Always returns 0 for direct color images.
370 (i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
371 return i_ppal(im, x, r, y, vals);
375 =item i_addcolors(im, colors, count)
377 =category Paletted images
379 Adds colors to the image's palette.
381 On success returns the index of the lowest color added.
383 On failure returns -1.
385 Always fails for direct color images.
391 (i_addcolors)(i_img *im, const i_color *colors, int count) {
392 return i_addcolors(im, colors, count);
396 =item i_getcolors(im, index, colors, count)
398 =category Paletted images
400 Retrieves I<count> colors starting from I<index> in the image's
403 On success stores the colors into I<colors> and returns true.
405 On failure returns false.
407 Always fails for direct color images.
409 Fails if there are less than I<index>+I<count> colors in the image's
416 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
417 return i_getcolors(im, i, colors, count);
421 =item i_colorcount(im)
423 =category Paletted images
425 Returns the number of colors in the image's palette.
427 Returns -1 for direct images.
433 (i_colorcount)(i_img *im) {
434 return i_colorcount(im);
438 =item i_maxcolors(im)
440 =category Paletted images
442 Returns the maximum number of colors the palette can hold for the
445 Returns -1 for direct color images.
451 (i_maxcolors)(i_img *im) {
452 return i_maxcolors(im);
456 =item i_findcolor(im, color, &entry)
458 =category Paletted images
460 Searches the images palette for the given color.
462 On success sets *I<entry> to the index of the color, and returns true.
464 On failure returns false.
466 Always fails on direct color images.
471 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
472 return i_findcolor(im, color, entry);
476 =item i_setcolors(im, index, colors, count)
478 =category Paletted images
480 Sets I<count> colors starting from I<index> in the image's palette.
482 On success returns true.
484 On failure returns false.
486 The image must have at least I<index>+I<count> colors in it's palette
489 Always fails on direct color images.
494 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
495 return i_setcolors(im, index, colors, count);