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_gpal(im, left, right, y, indexes)
360 Reads palette indexes for the horizontal line (left, y) to (right-1,
363 Returns the number of indexes read.
365 Always returns 0 for direct color images.
370 (i_gpal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, i_palidx *vals) {
371 return i_gpal(im, x, r, y, vals);
375 =item i_ppal(im, left, right, y, indexes)
379 Writes palette indexes for the horizontal line (left, y) to (right-1,
382 Returns the number of indexes written.
384 Always returns 0 for direct color images.
389 (i_ppal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, const i_palidx *vals) {
390 return i_ppal(im, x, r, y, vals);
394 =item i_addcolors(im, colors, count)
396 =category Paletted images
398 Adds colors to the image's palette.
400 On success returns the index of the lowest color added.
402 On failure returns -1.
404 Always fails for direct color images.
410 (i_addcolors)(i_img *im, const i_color *colors, int count) {
411 return i_addcolors(im, colors, count);
415 =item i_getcolors(im, index, colors, count)
417 =category Paletted images
419 Retrieves I<count> colors starting from I<index> in the image's
422 On success stores the colors into I<colors> and returns true.
424 On failure returns false.
426 Always fails for direct color images.
428 Fails if there are less than I<index>+I<count> colors in the image's
435 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
436 return i_getcolors(im, i, colors, count);
440 =item i_colorcount(im)
442 =category Paletted images
444 Returns the number of colors in the image's palette.
446 Returns -1 for direct images.
452 (i_colorcount)(i_img *im) {
453 return i_colorcount(im);
457 =item i_maxcolors(im)
459 =category Paletted images
461 Returns the maximum number of colors the palette can hold for the
464 Returns -1 for direct color images.
470 (i_maxcolors)(i_img *im) {
471 return i_maxcolors(im);
475 =item i_findcolor(im, color, &entry)
477 =category Paletted images
479 Searches the images palette for the given color.
481 On success sets *I<entry> to the index of the color, and returns true.
483 On failure returns false.
485 Always fails on direct color images.
490 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
491 return i_findcolor(im, color, entry);
495 =item i_setcolors(im, index, colors, count)
497 =category Paletted images
499 Sets I<count> colors starting from I<index> in the image's palette.
501 On success returns true.
503 On failure returns false.
505 The image must have at least I<index>+I<count> colors in it's palette
508 Always fails on direct color images.
513 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
514 return i_setcolors(im, index, colors, count);