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,
149 /* in general these functions aren't called by Imager internally, but
150 only via the pointers above, since faster macros that call the
151 image vtable pointers are used.
153 () are used around the function names to prevent macro replacement
154 on the function names.
158 =item i_ppix(im, x, y, color)
162 Sets the pixel at (x,y) to I<color>.
164 Returns 0 if the pixel was drawn, or -1 if not.
166 Does no alpha blending, just copies the channels from the supplied
173 (i_ppix)(i_img *im, i_img_dim x, i_img_dim y, const i_color *val) {
174 return i_ppix(im, x, y, val);
178 =item i_gpix(im, C<x>, C<y>, C<color>)
182 Retrieves the C<color> of the pixel (x,y).
184 Returns 0 if the pixel was retrieved, or -1 if not.
190 (i_gpix)(i_img *im,i_img_dim x,i_img_dim y,i_color *val) {
191 return i_gpix(im, x, y, val);
195 =item i_ppixf(im, C<x>, C<y>, C<fcolor>)
199 Sets the pixel at (C<x>,C<y>) to the floating point color C<fcolor>.
201 Returns 0 if the pixel was drawn, or -1 if not.
203 Does no alpha blending, just copies the channels from the supplied
209 (i_ppixf)(i_img *im, i_img_dim x, i_img_dim y, const i_fcolor *val) {
210 return i_ppixf(im, x, y, val);
214 =item i_gpixf(im, C<x>, C<y>, C<fcolor>)
218 Retrieves the color of the pixel (x,y) as a floating point color into
221 Returns 0 if the pixel was retrieved, or -1 if not.
227 (i_gpixf)(i_img *im,i_img_dim x,i_img_dim y,i_fcolor *val) {
228 return i_gpixf(im, x, y, val);
232 =item i_plin(im, l, r, y, colors)
236 Sets (r-l) pixels starting from (l,y) using (r-l) values from
239 Returns the number of pixels set.
245 (i_plin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, const i_color *vals) {
246 return i_plin(im, l, r, y, vals);
250 =item i_glin(im, l, r, y, colors)
254 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
256 Returns the number of pixels retrieved.
262 (i_glin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_color *vals) {
263 return i_glin(im, l, r, y, vals);
267 =item i_plinf(im, C<left>, C<right>, C<fcolors>)
271 Sets (right-left) pixels starting from (left,y) using (right-left)
272 floating point colors from C<fcolors>.
274 Returns the number of pixels set.
280 (i_plinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, const i_fcolor *vals) {
281 return i_plinf(im, l, r, y, vals);
285 =item i_glinf(im, l, r, y, colors)
289 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
292 Returns the number of pixels retrieved.
298 (i_glinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fcolor *vals) {
299 return i_glinf(im, l, r, y, vals);
303 =item i_gsamp(im, left, right, y, samples, channels, channel_count)
307 Reads sample values from C<im> for the horizontal line (left, y) to
308 (right-1,y) for the channels specified by C<channels>, an array of int
309 with C<channel_count> elements.
311 If channels is NULL then the first channels_count channels are retrieved for
314 Returns the number of samples read (which should be (right-left) *
320 (i_gsamp)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samp,
321 const int *chans, int chan_count) {
322 return i_gsamp(im, l, r, y, samp, chans, chan_count);
326 =item i_gsampf(im, left, right, y, samples, channels, channel_count)
330 Reads floating point sample values from C<im> for the horizontal line
331 (left, y) to (right-1,y) for the channels specified by C<channels>, an
332 array of int with channel_count elements.
334 If C<channels> is NULL then the first C<channel_count> channels are
335 retrieved for each pixel.
337 Returns the number of samples read (which should be (C<right>-C<left>)
343 (i_gsampf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samp,
344 const int *chans, int chan_count) {
345 return i_gsampf(im, l, r, y, samp, chans, chan_count);
349 =item i_gpal(im, left, right, y, indexes)
353 Reads palette indexes for the horizontal line (left, y) to (right-1,
356 Returns the number of indexes read.
358 Always returns 0 for direct color images.
363 (i_gpal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, i_palidx *vals) {
364 return i_gpal(im, x, r, y, vals);
368 =item i_ppal(im, left, right, y, indexes)
372 Writes palette indexes for the horizontal line (left, y) to (right-1,
375 Returns the number of indexes written.
377 Always returns 0 for direct color images.
382 (i_ppal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, const i_palidx *vals) {
383 return i_ppal(im, x, r, y, vals);
387 =item i_addcolors(im, colors, count)
389 =category Paletted images
391 Adds colors to the image's palette.
393 On success returns the index of the lowest color added.
395 On failure returns -1.
397 Always fails for direct color images.
403 (i_addcolors)(i_img *im, const i_color *colors, int count) {
404 return i_addcolors(im, colors, count);
408 =item i_getcolors(im, index, colors, count)
410 =category Paletted images
412 Retrieves I<count> colors starting from I<index> in the image's
415 On success stores the colors into I<colors> and returns true.
417 On failure returns false.
419 Always fails for direct color images.
421 Fails if there are less than I<index>+I<count> colors in the image's
428 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
429 return i_getcolors(im, i, colors, count);
433 =item i_colorcount(im)
435 =category Paletted images
437 Returns the number of colors in the image's palette.
439 Returns -1 for direct images.
445 (i_colorcount)(i_img *im) {
446 return i_colorcount(im);
450 =item i_maxcolors(im)
452 =category Paletted images
454 Returns the maximum number of colors the palette can hold for the
457 Returns -1 for direct color images.
463 (i_maxcolors)(i_img *im) {
464 return i_maxcolors(im);
468 =item i_findcolor(im, color, &entry)
470 =category Paletted images
472 Searches the images palette for the given color.
474 On success sets *I<entry> to the index of the color, and returns true.
476 On failure returns false.
478 Always fails on direct color images.
483 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
484 return i_findcolor(im, color, entry);
488 =item i_setcolors(im, index, colors, count)
490 =category Paletted images
492 Sets I<count> colors starting from I<index> in the image's palette.
494 On success returns true.
496 On failure returns false.
498 The image must have at least I<index>+I<count> colors in it's palette
501 Always fails on direct color images.
506 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
507 return i_setcolors(im, index, colors, count);