1 #include "imexttypes.h"
5 DON'T ADD CASTS TO THESE
7 im_ext_funcs imager_function_table =
94 /* in general these functions aren't called by Imager internally, but
95 only via the pointers above, since faster macros that call the
96 image vtable pointers are used.
98 () are used around the function names to prevent macro replacement
99 on the function names.
103 =item i_ppix(im, x, y, color)
107 Sets the pixel at (x,y) to I<color>.
109 Returns 0 if the pixel was drawn, or -1 if not.
111 Does no alpha blending, just copies the channels from the supplied
118 (i_ppix)(i_img *im, int x, int y, const i_color *val) {
119 return i_ppix(im, x, y, val);
123 =item i_gpix(im, x, y, color)
127 Retrieves the I<color> of the pixel (x,y).
129 Returns 0 if the pixel was retrieved, or -1 if not.
135 (i_gpix)(i_img *im,int x,int y,i_color *val) {
136 return i_gpix(im, x, y, val);
140 =item i_ppixf(im, x, y, fcolor)
144 Sets the pixel at (x,y) to the floating point color I<fcolor>.
146 Returns 0 if the pixel was drawn, or -1 if not.
148 Does no alpha blending, just copies the channels from the supplied
154 (i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
155 return i_ppixf(im, x, y, val);
159 =item i_gpixf(im, x, y, fcolor)
163 Retrieves the color of the pixel (x,y) as a floating point color into
166 Returns 0 if the pixel was retrieved, or -1 if not.
172 (i_gpixf)(i_img *im,int x,int y,i_fcolor *val) {
173 return i_gpixf(im, x, y, val);
177 =item i_plin(im, l, r, y, colors)
181 Sets (r-l) pixels starting from (l,y) using (r-l) values from
184 Returns the number of pixels set.
190 (i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
191 return i_plin(im, l, r, y, vals);
195 =item i_glin(im, l, r, y, colors)
199 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
201 Returns the number of pixels retrieved.
207 (i_glin)(i_img *im, int l, int r, int y, i_color *vals) {
208 return i_glin(im, l, r, y, vals);
212 =item i_plinf(im, l, r, fcolors)
216 Sets (r-l) pixels starting from (l,y) using (r-l) floating point
217 colors from I<colors>.
219 Returns the number of pixels set.
225 (i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
226 return i_plinf(im, l, r, y, vals);
230 =item i_glinf(im, l, r, y, colors)
234 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
237 Returns the number of pixels retrieved.
243 (i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
244 return i_glinf(im, l, r, y, vals);
248 =item i_gsamp(im, l, r, y, samp, chans, chan_count)
252 Reads sample values from im for the horizontal line (l, y) to (r-1,y)
253 for the channels specified by chans, an array of int with chan_count
256 If chans is NULL then the first chan_count channels are retrieved for
259 Returns the number of samples read (which should be (r-l) *
265 (i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp,
266 const int *chans, int chan_count) {
267 return i_gsamp(im, l, r, y, samp, chans, chan_count);
271 =item i_gsampf(im, l, r, y, samp, chans, chan_count)
275 Reads floating point sample values from im for the horizontal line (l,
276 y) to (r-1,y) for the channels specified by chans, an array of int
277 with chan_count elements.
279 If chans is NULL then the first chan_count channels are retrieved for
282 Returns the number of samples read (which should be (r-l) *
288 (i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp,
289 const int *chans, int chan_count) {
290 return i_gsampf(im, l, r, y, samp, chans, chan_count);
294 =item i_gpal(im, x, r, y, indexes)
298 Reads palette indexes for the horizontal line (x, y) to (r-1, y) into
301 Returns the number of indexes read.
303 Always returns 0 for direct color images.
308 (i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals) {
309 return i_gpal(im, x, r, y, vals);
313 =item i_ppal(im, x, r, y, indexes)
317 Writes palette indexes for the horizontal line (x, y) to (r-1, y) from
320 Returns the number of indexes written.
322 Always returns 0 for direct color images.
327 (i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
328 return i_ppal(im, x, r, y, vals);
332 =item i_addcolors(im, colors, count)
334 =category Paletted images
336 Adds colors to the image's palette.
338 On success returns the index of the lowest color added.
340 On failure returns -1.
342 Always fails for direct color images.
348 (i_addcolors)(i_img *im, const i_color *colors, int count) {
349 return i_addcolors(im, colors, count);
353 =item i_getcolors(im, index, colors, count)
355 =category Paletted images
357 Retrieves I<count> colors starting from I<index> in the image's
360 On success stores the colors into I<colors> and returns true.
362 On failure returns false.
364 Always fails for direct color images.
366 Fails if there are less than I<index>+I<count> colors in the image's
373 (i_getcolors)(i_img *im, int i, i_color *colors, int count) {
374 return i_getcolors(im, i, colors, count);
378 =item i_colorcount(im)
380 =category Paletted images
382 Returns the number of colors in the image's palette.
384 Returns -1 for direct images.
390 (i_colorcount)(i_img *im) {
391 return i_colorcount(im);
395 =item i_maxcolors(im)
397 =category Paletted images
399 Returns the maximum number of colors the palette can hold for the
402 Returns -1 for direct color images.
408 (i_maxcolors)(i_img *im) {
409 return i_maxcolors(im);
413 =item i_findcolor(im, color, &entry)
415 =category Paletted images
417 Searches the images palette for the given color.
419 On success sets *I<entry> to the index of the color, and returns true.
421 On failure returns false.
423 Always fails on direct color images.
428 (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
429 return i_findcolor(im, color, entry);
433 =item i_setcolors(im, index, colors, count)
435 =category Paletted images
437 Sets I<count> colors starting from I<index> in the image's palette.
439 On sucess returns true.
441 On failure returns false.
443 The image must have at least I<index>+I<count> colors in it's palette
446 Always fails on direct color images.
451 (i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
452 return i_setcolors(im, index, colors, count);