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,
156 /* in general these functions aren't called by Imager internally, but
157 only via the pointers above, since faster macros that call the
158 image vtable pointers are used.
160 () are used around the function names to prevent macro replacement
161 on the function names.
165 =item i_ppix(im, x, y, color)
169 Sets the pixel at (x,y) to I<color>.
171 Returns 0 if the pixel was drawn, or -1 if not.
173 Does no alpha blending, just copies the channels from the supplied
180 (i_ppix)(i_img *im, i_img_dim x, i_img_dim y, const i_color *val) {
181 return i_ppix(im, x, y, val);
185 =item i_gpix(im, C<x>, C<y>, C<color>)
189 Retrieves the C<color> of the pixel (x,y).
191 Returns 0 if the pixel was retrieved, or -1 if not.
197 (i_gpix)(i_img *im,i_img_dim x,i_img_dim y,i_color *val) {
198 return i_gpix(im, x, y, val);
202 =item i_ppixf(im, C<x>, C<y>, C<fcolor>)
206 Sets the pixel at (C<x>,C<y>) to the floating point color C<fcolor>.
208 Returns 0 if the pixel was drawn, or -1 if not.
210 Does no alpha blending, just copies the channels from the supplied
216 (i_ppixf)(i_img *im, i_img_dim x, i_img_dim y, const i_fcolor *val) {
217 return i_ppixf(im, x, y, val);
221 =item i_gpixf(im, C<x>, C<y>, C<fcolor>)
225 Retrieves the color of the pixel (x,y) as a floating point color into
228 Returns 0 if the pixel was retrieved, or -1 if not.
234 (i_gpixf)(i_img *im,i_img_dim x,i_img_dim y,i_fcolor *val) {
235 return i_gpixf(im, x, y, val);
239 =item i_plin(im, l, r, y, colors)
243 Sets (r-l) pixels starting from (l,y) using (r-l) values from
246 Returns the number of pixels set.
252 (i_plin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, const i_color *vals) {
253 return i_plin(im, l, r, y, vals);
257 =item i_glin(im, l, r, y, colors)
261 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
263 Returns the number of pixels retrieved.
269 (i_glin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_color *vals) {
270 return i_glin(im, l, r, y, vals);
274 =item i_plinf(im, C<left>, C<right>, C<fcolors>)
278 Sets (right-left) pixels starting from (left,y) using (right-left)
279 floating point colors from C<fcolors>.
281 Returns the number of pixels set.
287 (i_plinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, const i_fcolor *vals) {
288 return i_plinf(im, l, r, y, vals);
292 =item i_glinf(im, l, r, y, colors)
296 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
299 Returns the number of pixels retrieved.
305 (i_glinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fcolor *vals) {
306 return i_glinf(im, l, r, y, vals);
310 =item i_gsamp(im, left, right, y, samples, channels, channel_count)
314 Reads sample values from C<im> for the horizontal line (left, y) to
315 (right-1,y) for the channels specified by C<channels>, an array of int
316 with C<channel_count> elements.
318 If channels is NULL then the first channels_count channels are retrieved for
321 Returns the number of samples read (which should be (right-left) *
327 (i_gsamp)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samp,
328 const int *chans, int chan_count) {
329 return i_gsamp(im, l, r, y, samp, chans, chan_count);
333 =item i_gsampf(im, left, right, y, samples, channels, channel_count)
337 Reads floating point sample values from C<im> for the horizontal line
338 (left, y) to (right-1,y) for the channels specified by C<channels>, an
339 array of int with channel_count elements.
341 If C<channels> is NULL then the first C<channel_count> channels are
342 retrieved for each pixel.
344 Returns the number of samples read (which should be (C<right>-C<left>)
350 (i_gsampf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samp,
351 const int *chans, int chan_count) {
352 return i_gsampf(im, l, r, y, samp, chans, chan_count);
356 =item i_gsamp_bits(im, left, right, y, samples, channels, channel_count, bits)
359 Reads integer samples scaled to C<bits> bits of precision into the
360 C<unsigned int> array C<samples>.
362 Expect this to be slow unless C<< bits == im->bits >>.
364 Returns the number of samples copied, or -1 on error.
366 Not all image types implement this method.
368 Pushes errors, but does not call C<i_clear_error()>.
374 =item i_psamp_bits(im, left, right, y, samples, channels, channel_count, bits)
377 Writes integer samples scaled to C<bits> bits of precision from the
378 C<unsigned int> array C<samples>.
380 Expect this to be slow unless C<< bits == im->bits >>.
382 Returns the number of samples copied, or -1 on error.
384 Not all image types implement this method.
386 Pushes errors, but does not call C<i_clear_error()>.
392 =item i_gpal(im, left, right, y, indexes)
396 Reads palette indexes for the horizontal line (left, y) to (right-1,
399 Returns the number of indexes read.
401 Always returns 0 for direct color images.
406 (i_gpal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, i_palidx *vals) {
407 return i_gpal(im, x, r, y, vals);
411 =item i_ppal(im, left, right, y, indexes)
415 Writes palette indexes for the horizontal line (left, y) to (right-1,
418 Returns the number of indexes written.
420 Always returns 0 for direct color images.
425 (i_ppal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, const i_palidx *vals) {
426 return i_ppal(im, x, r, y, vals);
430 =item i_addcolors(im, colors, count)
432 =category Paletted images
434 Adds colors to the image's palette.
436 On success returns the index of the lowest color added.
438 On failure returns -1.
440 Always fails for direct color images.
446 (i_addcolors)(i_img *im, const i_color *colors, int count) {
447 return i_addcolors(im, colors, count);
451 =item i_getcolors(im, index, colors, count)
453 =category Paletted images
455 Retrieves I<count> colors starting from I<index> in the image's
458 On success stores the colors into I<colors> and returns true.
460 On failure returns false.
462 Always fails for direct color images.
464 Fails if there are less than I<index>+I<count> colors in the image's
471 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
472 return i_getcolors(im, i, colors, count);
476 =item i_colorcount(im)
478 =category Paletted images
480 Returns the number of colors in the image's palette.
482 Returns -1 for direct images.
488 (i_colorcount)(i_img *im) {
489 return i_colorcount(im);
493 =item i_maxcolors(im)
495 =category Paletted images
497 Returns the maximum number of colors the palette can hold for the
500 Returns -1 for direct color images.
506 (i_maxcolors)(i_img *im) {
507 return i_maxcolors(im);
511 =item i_findcolor(im, color, &entry)
513 =category Paletted images
515 Searches the images palette for the given color.
517 On success sets *I<entry> to the index of the color, and returns true.
519 On failure returns false.
521 Always fails on direct color images.
526 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
527 return i_findcolor(im, color, entry);
531 =item i_setcolors(im, index, colors, count)
533 =category Paletted images
535 Sets I<count> colors starting from I<index> in the image's palette.
537 On success returns true.
539 On failure returns false.
541 The image must have at least I<index>+I<count> colors in it's palette
544 Always fails on direct color images.
549 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
550 return i_setcolors(im, index, colors, count);