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 i_get_file_background,
126 i_get_file_backgroundf
129 /* in general these functions aren't called by Imager internally, but
130 only via the pointers above, since faster macros that call the
131 image vtable pointers are used.
133 () are used around the function names to prevent macro replacement
134 on the function names.
138 =item i_ppix(im, x, y, color)
142 Sets the pixel at (x,y) to I<color>.
144 Returns 0 if the pixel was drawn, or -1 if not.
146 Does no alpha blending, just copies the channels from the supplied
153 (i_ppix)(i_img *im, int x, int y, const i_color *val) {
154 return i_ppix(im, x, y, val);
158 =item i_gpix(im, C<x>, C<y>, C<color>)
162 Retrieves the C<color> of the pixel (x,y).
164 Returns 0 if the pixel was retrieved, or -1 if not.
170 (i_gpix)(i_img *im,int x,int y,i_color *val) {
171 return i_gpix(im, x, y, val);
175 =item i_ppixf(im, C<x>, C<y>, C<fcolor>)
179 Sets the pixel at (C<x>,C<y>) to the floating point color C<fcolor>.
181 Returns 0 if the pixel was drawn, or -1 if not.
183 Does no alpha blending, just copies the channels from the supplied
189 (i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
190 return i_ppixf(im, x, y, val);
194 =item i_gpixf(im, C<x>, C<y>, C<fcolor>)
198 Retrieves the color of the pixel (x,y) as a floating point color into
201 Returns 0 if the pixel was retrieved, or -1 if not.
207 (i_gpixf)(i_img *im,int x,int y,i_fcolor *val) {
208 return i_gpixf(im, x, y, val);
212 =item i_plin(im, l, r, y, colors)
216 Sets (r-l) pixels starting from (l,y) using (r-l) values from
219 Returns the number of pixels set.
225 (i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
226 return i_plin(im, l, r, y, vals);
230 =item i_glin(im, l, r, y, colors)
234 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
236 Returns the number of pixels retrieved.
242 (i_glin)(i_img *im, int l, int r, int y, i_color *vals) {
243 return i_glin(im, l, r, y, vals);
247 =item i_plinf(im, C<left>, C<right>, C<fcolors>)
251 Sets (right-left) pixels starting from (left,y) using (right-left)
252 floating point colors from C<fcolors>.
254 Returns the number of pixels set.
260 (i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
261 return i_plinf(im, l, r, y, vals);
265 =item i_glinf(im, l, r, y, colors)
269 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
272 Returns the number of pixels retrieved.
278 (i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
279 return i_glinf(im, l, r, y, vals);
283 =item i_gsamp(im, left, right, y, samples, channels, channel_count)
287 Reads sample values from C<im> for the horizontal line (left, y) to
288 (right-1,y) for the channels specified by C<channels>, an array of int
289 with C<channel_count> elements.
291 If channels is NULL then the first channels_count channels are retrieved for
294 Returns the number of samples read (which should be (right-left) *
300 (i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp,
301 const int *chans, int chan_count) {
302 return i_gsamp(im, l, r, y, samp, chans, chan_count);
306 =item i_gsampf(im, left, right, y, samples, channels, channel_count)
310 Reads floating point sample values from C<im> for the horizontal line
311 (left, y) to (right-1,y) for the channels specified by C<channels>, an
312 array of int with channel_count elements.
314 If C<channels> is NULL then the first C<channel_count> channels are
315 retrieved for each pixel.
317 Returns the number of samples read (which should be (C<right>-C<left>)
323 (i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp,
324 const int *chans, int chan_count) {
325 return i_gsampf(im, l, r, y, samp, chans, chan_count);
329 =item i_gpal(im, left, right, y, indexes)
333 Reads palette indexes for the horizontal line (left, y) to (right-1,
336 Returns the number of indexes read.
338 Always returns 0 for direct color images.
343 (i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals) {
344 return i_gpal(im, x, r, y, vals);
348 =item i_ppal(im, left, right, y, indexes)
352 Writes palette indexes for the horizontal line (left, y) to (right-1,
355 Returns the number of indexes written.
357 Always returns 0 for direct color images.
362 (i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
363 return i_ppal(im, x, r, y, vals);
367 =item i_addcolors(im, colors, count)
369 =category Paletted images
371 Adds colors to the image's palette.
373 On success returns the index of the lowest color added.
375 On failure returns -1.
377 Always fails for direct color images.
383 (i_addcolors)(i_img *im, const i_color *colors, int count) {
384 return i_addcolors(im, colors, count);
388 =item i_getcolors(im, index, colors, count)
390 =category Paletted images
392 Retrieves I<count> colors starting from I<index> in the image's
395 On success stores the colors into I<colors> and returns true.
397 On failure returns false.
399 Always fails for direct color images.
401 Fails if there are less than I<index>+I<count> colors in the image's
408 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
409 return i_getcolors(im, i, colors, count);
413 =item i_colorcount(im)
415 =category Paletted images
417 Returns the number of colors in the image's palette.
419 Returns -1 for direct images.
425 (i_colorcount)(i_img *im) {
426 return i_colorcount(im);
430 =item i_maxcolors(im)
432 =category Paletted images
434 Returns the maximum number of colors the palette can hold for the
437 Returns -1 for direct color images.
443 (i_maxcolors)(i_img *im) {
444 return i_maxcolors(im);
448 =item i_findcolor(im, color, &entry)
450 =category Paletted images
452 Searches the images palette for the given color.
454 On success sets *I<entry> to the index of the color, and returns true.
456 On failure returns false.
458 Always fails on direct color images.
463 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
464 return i_findcolor(im, color, entry);
468 =item i_setcolors(im, index, colors, count)
470 =category Paletted images
472 Sets I<count> colors starting from I<index> in the image's palette.
474 On success returns true.
476 On failure returns false.
478 The image must have at least I<index>+I<count> colors in it's palette
481 Always fails on direct color images.
486 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
487 return i_setcolors(im, index, colors, count);