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 /* in general these functions aren't called by Imager internally, but
126 only via the pointers above, since faster macros that call the
127 image vtable pointers are used.
129 () are used around the function names to prevent macro replacement
130 on the function names.
134 =item i_ppix(im, x, y, color)
138 Sets the pixel at (x,y) to I<color>.
140 Returns 0 if the pixel was drawn, or -1 if not.
142 Does no alpha blending, just copies the channels from the supplied
149 (i_ppix)(i_img *im, int x, int y, const i_color *val) {
150 return i_ppix(im, x, y, val);
154 =item i_gpix(im, C<x>, C<y>, C<color>)
158 Retrieves the C<color> of the pixel (x,y).
160 Returns 0 if the pixel was retrieved, or -1 if not.
166 (i_gpix)(i_img *im,int x,int y,i_color *val) {
167 return i_gpix(im, x, y, val);
171 =item i_ppixf(im, C<x>, C<y>, C<fcolor>)
175 Sets the pixel at (C<x>,C<y>) to the floating point color C<fcolor>.
177 Returns 0 if the pixel was drawn, or -1 if not.
179 Does no alpha blending, just copies the channels from the supplied
185 (i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
186 return i_ppixf(im, x, y, val);
190 =item i_gpixf(im, C<x>, C<y>, C<fcolor>)
194 Retrieves the color of the pixel (x,y) as a floating point color into
197 Returns 0 if the pixel was retrieved, or -1 if not.
203 (i_gpixf)(i_img *im,int x,int y,i_fcolor *val) {
204 return i_gpixf(im, x, y, val);
208 =item i_plin(im, l, r, y, colors)
212 Sets (r-l) pixels starting from (l,y) using (r-l) values from
215 Returns the number of pixels set.
221 (i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
222 return i_plin(im, l, r, y, vals);
226 =item i_glin(im, l, r, y, colors)
230 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
232 Returns the number of pixels retrieved.
238 (i_glin)(i_img *im, int l, int r, int y, i_color *vals) {
239 return i_glin(im, l, r, y, vals);
243 =item i_plinf(im, C<left>, C<right>, C<fcolors>)
247 Sets (right-left) pixels starting from (left,y) using (right-left)
248 floating point colors from C<fcolors>.
250 Returns the number of pixels set.
256 (i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
257 return i_plinf(im, l, r, y, vals);
261 =item i_glinf(im, l, r, y, colors)
265 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
268 Returns the number of pixels retrieved.
274 (i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
275 return i_glinf(im, l, r, y, vals);
279 =item i_gsamp(im, left, right, y, samples, channels, channel_count)
283 Reads sample values from C<im> for the horizontal line (left, y) to
284 (right-1,y) for the channels specified by C<channels>, an array of int
285 with C<channel_count> elements.
287 If channels is NULL then the first channels_count channels are retrieved for
290 Returns the number of samples read (which should be (right-left) *
296 (i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp,
297 const int *chans, int chan_count) {
298 return i_gsamp(im, l, r, y, samp, chans, chan_count);
302 =item i_gsampf(im, left, right, y, samples, channels, channel_count)
306 Reads floating point sample values from C<im> for the horizontal line
307 (left, y) to (right-1,y) for the channels specified by C<channels>, an
308 array of int with channel_count elements.
310 If C<channels> is NULL then the first C<channel_count> channels are
311 retrieved for each pixel.
313 Returns the number of samples read (which should be (C<right>-C<left>)
319 (i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp,
320 const int *chans, int chan_count) {
321 return i_gsampf(im, l, r, y, samp, chans, chan_count);
325 =item i_gpal(im, left, right, y, indexes)
329 Reads palette indexes for the horizontal line (left, y) to (right-1,
332 Returns the number of indexes read.
334 Always returns 0 for direct color images.
339 (i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals) {
340 return i_gpal(im, x, r, y, vals);
344 =item i_ppal(im, left, right, y, indexes)
348 Writes palette indexes for the horizontal line (left, y) to (right-1,
351 Returns the number of indexes written.
353 Always returns 0 for direct color images.
358 (i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
359 return i_ppal(im, x, r, y, vals);
363 =item i_addcolors(im, colors, count)
365 =category Paletted images
367 Adds colors to the image's palette.
369 On success returns the index of the lowest color added.
371 On failure returns -1.
373 Always fails for direct color images.
379 (i_addcolors)(i_img *im, const i_color *colors, int count) {
380 return i_addcolors(im, colors, count);
384 =item i_getcolors(im, index, colors, count)
386 =category Paletted images
388 Retrieves I<count> colors starting from I<index> in the image's
391 On success stores the colors into I<colors> and returns true.
393 On failure returns false.
395 Always fails for direct color images.
397 Fails if there are less than I<index>+I<count> colors in the image's
404 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
405 return i_getcolors(im, i, colors, count);
409 =item i_colorcount(im)
411 =category Paletted images
413 Returns the number of colors in the image's palette.
415 Returns -1 for direct images.
421 (i_colorcount)(i_img *im) {
422 return i_colorcount(im);
426 =item i_maxcolors(im)
428 =category Paletted images
430 Returns the maximum number of colors the palette can hold for the
433 Returns -1 for direct color images.
439 (i_maxcolors)(i_img *im) {
440 return i_maxcolors(im);
444 =item i_findcolor(im, color, &entry)
446 =category Paletted images
448 Searches the images palette for the given color.
450 On success sets *I<entry> to the index of the color, and returns true.
452 On failure returns false.
454 Always fails on direct color images.
459 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
460 return i_findcolor(im, color, entry);
464 =item i_setcolors(im, index, colors, count)
466 =category Paletted images
468 Sets I<count> colors starting from I<index> in the image's palette.
470 On success returns true.
472 On failure returns false.
474 The image must have at least I<index>+I<count> colors in it's palette
477 Always fails on direct color images.
482 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
483 return i_setcolors(im, index, colors, count);