1 Do not edit this file, it is generated automatically by apidocs.perl
2 from Imager's source files.
4 Each function description has a comment listing the source file and
5 line number where you can find the documentation.
9 Imager::APIRef - Imager's C API.
14 color.rgba.red = 255; color.rgba.green = 0; color.rgba.blue = 255;
15 i_fill_t *fill = i_new_fill_...(...);
19 i_arc(im, 50, 50, 20, 45, 135, &color);
20 i_arc_aa(im, 50, 50, 35, 90, 135, &color);
21 i_arc_aa_cfill(im, 50, 50, 35, 90, 135, fill);
22 i_arc_cfill(im, 50, 50, 35, 90, 135, fill);
23 i_box(im, 0, 0, im->xsize-1, im->ysize-1, &color).
24 i_box_cfill(im, 0, 0, im->xsize-1, im->ysize-1, fill);
25 i_box_filled(im, 0, 0, im->xsize-1, im->ysize-1, &color);
26 i_circle_aa(im, 50, 50, 45, &color);
27 i_flood_cfill(im, 50, 50, fill);
28 i_flood_fill(im, 50, 50, &color);
33 fill = i_new_fill_fount(0, 0, 100, 100, i_ft_linear, i_ft_linear,
34 i_fr_triangle, 0, i_fts_grid, 9, 1, segs);
54 =item i_arc(im, x, y, rad, d1, d2, color)
57 Fills an arc centered at (x,y) with radius I<rad> covering the range
58 of angles in degrees from d1 to d2, with the color.
62 From: Line 205 in draw.c
64 =item i_arc_aa(im, x, y, rad, d1, d2, color)
67 Antialias fills an arc centered at (x,y) with radius I<rad> covering
68 the range of angles in degrees from d1 to d2, with the color.
72 From: Line 330 in draw.c
74 =item i_arc_aa_cfill(im, x, y, rad, d1, d2, fill)
77 Antialias fills an arc centered at (x,y) with radius I<rad> covering
78 the range of angles in degrees from d1 to d2, with the fill object.
82 From: Line 356 in draw.c
84 =item i_arc_cfill(im, x, y, rad, d1, d2, fill)
87 Fills an arc centered at (x,y) with radius I<rad> covering the range
88 of angles in degrees from d1 to d2, with the fill object.
92 From: Line 230 in draw.c
94 =item i_box(im, x1, y1, x2, y2, color)
97 Outlines the box from (x1,y1) to (x2,y2) inclusive with I<color>.
101 From: Line 516 in draw.c
103 =item i_box_cfill(im, x1, y1, x2, y2, fill)
106 Fills the box from (x1,y1) to (x2,y2) inclusive with fill.
110 From: Line 559 in draw.c
112 =item i_box_filled(im, x1, y1, x2, y2, color)
115 Fills the box from (x1,y1) to (x2,y2) inclusive with color.
119 From: Line 541 in draw.c
121 =item i_circle_aa(im, x, y, rad, color)
124 Antialias fills a circle centered at (x,y) for radius I<rad> with
129 From: Line 462 in draw.c
131 =item i_flood_cfill(im, seedx, seedy, fill)
134 Flood fills the 4-connected region starting from the point (seedx,
137 Returns false if (seedx, seedy) are outside the image.
141 From: Line 1317 in draw.c
143 =item i_flood_fill(im, seedx, seedy, color)
146 Flood fills the 4-connected region starting from the point (seedx,
147 seedy) with I<color>.
149 Returns false if (seedx, seedy) are outside the image.
153 From: Line 1280 in draw.c
155 =item i_glin(im, l, r, y, colors)
158 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
160 Returns the number of pixels retrieved.
164 From: Line 202 in imext.c
166 =item i_glinf(im, l, r, y, colors)
169 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
172 Returns the number of pixels retrieved.
176 From: Line 237 in imext.c
178 =item i_gpal(im, x, r, y, indexes)
181 Reads palette indexes for the horizontal line (x, y) to (r-1, y) into
184 Returns the number of indexes read.
186 Always returns 0 for direct color images.
190 From: Line 301 in imext.c
192 =item i_gpix(im, x, y, color)
195 Retrieves the I<color> of the pixel (x,y).
197 Returns 0 if the pixel was retrieved, or -1 if not.
201 From: Line 130 in imext.c
203 =item i_gpixf(im, x, y, fcolor)
206 Retrieves the color of the pixel (x,y) as a floating point color into
209 Returns 0 if the pixel was retrieved, or -1 if not.
213 From: Line 166 in imext.c
215 =item i_gsamp(im, l, r, y, samp, chans, chan_count)
218 Reads sample values from im for the horizontal line (l, y) to (r-1,y)
219 for the channels specified by chans, an array of int with chan_count
222 If chans is NULL then the first chan_count channels are retrieved for
225 Returns the number of samples read (which should be (r-l) *
230 From: Line 255 in imext.c
232 =item i_gsampf(im, l, r, y, samp, chans, chan_count)
235 Reads floating point sample values from im for the horizontal line (l,
236 y) to (r-1,y) for the channels specified by chans, an array of int
237 with chan_count elements.
239 If chans is NULL then the first chan_count channels are retrieved for
242 Returns the number of samples read (which should be (r-l) *
247 From: Line 278 in imext.c
249 =item i_line(im, x1, y1, x2, y2, val, endp)
252 Draw a line to image using bresenhams linedrawing algorithm
254 im - image to draw to
255 x1 - starting x coordinate
256 y1 - starting x coordinate
257 x2 - starting x coordinate
258 y2 - starting x coordinate
259 val - color to write to image
260 endp - endpoint flag (boolean)
264 From: Line 630 in draw.c
266 =item i_line_aa(im, x1, x2, y1, y2, color, endp)
269 Antialias draws a line from (x1,y1) to (x2, y2) in color.
271 The point (x2, y2) is drawn only if endp is set.
275 From: Line 834 in draw.c
277 =item i_plin(im, l, r, y, colors)
280 Sets (r-l) pixels starting from (l,y) using (r-l) values from
283 Returns the number of pixels set.
287 From: Line 184 in imext.c
289 =item i_plinf(im, l, r, fcolors)
292 Sets (r-l) pixels starting from (l,y) using (r-l) floating point
293 colors from I<colors>.
295 Returns the number of pixels set.
299 From: Line 219 in imext.c
301 =item i_ppal(im, x, r, y, indexes)
304 Writes palette indexes for the horizontal line (x, y) to (r-1, y) from
307 Returns the number of indexes written.
309 Always returns 0 for direct color images.
313 From: Line 320 in imext.c
315 =item i_ppix(im, x, y, color)
318 Sets the pixel at (x,y) to I<color>.
320 Returns 0 if the pixel was drawn, or -1 if not.
322 Does no alpha blending, just copies the channels from the supplied
327 From: Line 110 in imext.c
329 =item i_ppixf(im, x, y, fcolor)
332 Sets the pixel at (x,y) to the floating point color I<fcolor>.
334 Returns 0 if the pixel was drawn, or -1 if not.
336 Does no alpha blending, just copies the channels from the supplied
341 From: Line 147 in imext.c
346 =head2 Error handling
350 =item i_clear_error()
353 Clears the error stack.
355 Called by any imager function before doing any other processing.
359 From: Line 185 in error.c
361 =item i_push_error(int code, char const *msg)
364 Called by an imager function to push an error message onto the stack.
366 No message is pushed if the stack is full (since this means someone
367 forgot to call i_clear_error(), or that a function that doesn't do
368 error handling is calling function that does.).
372 From: Line 211 in error.c
374 =item i_push_errorf(int code, char const *fmt, ...)
377 A version of i_push_error() that does printf() like formating.
381 From: Line 273 in error.c
383 =item i_push_errorvf(int code, char const *fmt, va_list ap)
386 Intended for use by higher level functions, takes a varargs pointer
387 and a format to produce the finally pushed error message.
391 From: Line 249 in error.c
400 =item i_fill_destroy(fill)
403 Call to destroy any fill object.
407 From: Line 196 in fills.c
409 =item i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, count, segs)
413 Creates a new general fill which fills with a fountain fill.
417 From: Line 1713 in filters.c
419 =item i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
422 Creates a new hatched fill with the fg color used for the 1 bits in
423 the hatch and bg for the 0 bits. If combine is non-zero alpha values
426 If cust_hatch is non-NULL it should be a pointer to 8 bytes of the
427 hash definition, with the high-bits to the left.
429 If cust_hatch is NULL then one of the standard hatches is used.
431 (dx, dy) are an offset into the hatch which can be used to unalign adjoining areas, or to align the origin of a hatch with the the side of a filled area.
435 From: Line 427 in fills.c
437 =item i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy)
440 Creates a new hatched fill with the fg color used for the 1 bits in
441 the hatch and bg for the 0 bits. If combine is non-zero alpha values
444 If cust_hatch is non-NULL it should be a pointer to 8 bytes of the
445 hash definition, with the high-bits to the left.
447 If cust_hatch is NULL then one of the standard hatches is used.
449 (dx, dy) are an offset into the hatch which can be used to unalign adjoining areas, or to align the origin of a hatch with the the side of a filled area.
453 From: Line 452 in fills.c
455 =item i_new_fill_image(im, matrix, xoff, yoff, combine)
458 Create an image based fill.
460 matrix is an array of 9 doubles representing a transformation matrix.
462 xoff and yoff are the offset into the image to start filling from.
466 From: Line 489 in fills.c
468 =item i_new_fill_solid(color, combine)
471 Create a solid fill based on an 8-bit color.
473 If combine is non-zero then alpha values will be combined.
477 From: Line 244 in fills.c
479 =item i_new_fill_solidf(color, combine)
482 Create a solid fill based on a float color.
484 If combine is non-zero then alpha values will be combined.
488 From: Line 213 in fills.c
500 Creates a new image that is a copy of src.
502 Tags are not copied, only the image data.
508 From: Line 626 in image.c
510 =item i_copyto(dest, src, x1, y1, x2, y2, tx, ty)
513 Copies image data from the area (x1,y1)-[x2,y2] in the source image to
514 a rectangle the same size with it's top-left corner at (tx,ty) in the
517 If x1 > x2 or y1 > y2 then the corresponding co-ordinates are swapped.
521 From: Line 557 in image.c
523 =item i_copyto_trans(im, src, x1, y1, x2, y2, tx, ty, trans)
526 (x1,y1) (x2,y2) specifies the region to copy (in the source coordinates)
527 (tx,ty) specifies the upper left corner for the target image.
528 pass NULL in trans for non transparent i_colors.
532 From: Line 515 in image.c
534 =item i_img_destroy(im)
537 Destroy image and free data via exorcise.
543 From: Line 424 in image.c
545 =item i_img_info(im, info)
548 Return image information
551 info - pointer to array to return data
553 info is an array of 4 integers with the following values:
558 info[3] - channel mask
562 From: Line 443 in image.c
564 =item i_rubthru(im, src, tx, ty, src_minx, src_miny, src_maxx, src_maxy )
567 Takes the sub image I<src[src_minx, src_maxx)[src_miny, src_maxy)> and
568 overlays it at (I<tx>,I<ty>) on the image object.
570 The alpha channel of each pixel in I<src> is used to control how much
571 the existing colour in I<im> is replaced, if it is 255 then the colour
572 is completely replaced, if it is 0 then the original colour is left
577 From: Line 701 in image.c
582 =head2 Image creation
586 =item i_img_16_new(x, y, ch)
589 Create a new 16-bit/sample image.
591 Returns the image on success, or NULL on failure.
595 From: Line 192 in img16.c
597 =item i_img_8_new(x, y, ch)
600 Creates a new image object I<x> pixels wide, and I<y> pixels high with
605 From: Line 257 in image.c
607 =item i_img_double_new(int x, int y, int ch)
610 Creates a new double per sample image.
614 From: Line 82 in imgdouble.c
616 =item i_img_pal_new(x, y, channels, maxpal)
619 Creates a new paletted image of the supplied dimensions.
621 Returns a new image or NULL on failure.
625 From: Line 136 in palimg.c
627 =item i_sametype(i_img *im, int xsize, int ysize)
630 Returns an image of the same type (sample size, channels, paletted/direct).
632 For paletted images the palette is copied from the source.
636 From: Line 1107 in image.c
638 =item i_sametype_chans(i_img *im, int xsize, int ysize, int channels)
641 Returns an image of the same type (sample size).
643 For paletted images the equivalent direct type is returned.
647 From: Line 1149 in image.c
652 =head2 Image quantization
656 =item i_quant_makemap(quant, imgs, count)
659 Analyzes the I<count> images in I<imgs> according to the rules in
660 I<quant> to build a color map (optimal or not depending on
665 From: Line 30 in quant.c
667 =item i_quant_translate(quant, img)
670 Quantize the image given the palette in quant.
672 On success returns a pointer to a memory block of img->xsize *
673 img->ysize i_palidx entries.
675 On failure returns NULL.
677 You should call myfree() on the returned block when you're done with
680 This function will fail if the supplied palette contains no colors.
684 From: Line 86 in quant.c
686 =item i_quant_transparent(quant, data, img, trans_index)
689 Dither the alpha channel on I<img> into the palette indexes in
690 I<data>. Pixels to be transparent are replaced with I<trans_pixel>.
692 The method used depends on the tr_* members of quant.
696 From: Line 1470 in quant.c
701 =head2 Paletted images
705 =item i_addcolors(im, colors, count)
708 Adds colors to the image's palette.
710 On success returns the index of the lowest color added.
712 On failure returns -1.
714 Always fails for direct color images.
718 From: Line 339 in imext.c
720 =item i_colorcount(im)
723 Returns the number of colors in the image's palette.
725 Returns -1 for direct images.
729 From: Line 385 in imext.c
731 =item i_findcolor(im, color, &entry)
734 Searches the images palette for the given color.
736 On success sets *I<entry> to the index of the color, and returns true.
738 On failure returns false.
740 Always fails on direct color images.
744 From: Line 420 in imext.c
746 =item i_getcolors(im, index, colors, count)
749 Retrieves I<count> colors starting from I<index> in the image's
752 On success stores the colors into I<colors> and returns true.
754 On failure returns false.
756 Always fails for direct color images.
758 Fails if there are less than I<index>+I<count> colors in the image's
763 From: Line 360 in imext.c
765 =item i_maxcolors(im)
768 Returns the maximum number of colors the palette can hold for the
771 Returns -1 for direct color images.
775 From: Line 402 in imext.c
777 =item i_setcolors(im, index, colors, count)
780 Sets I<count> colors starting from I<index> in the image's palette.
782 On sucess returns true.
784 On failure returns false.
786 The image must have at least I<index>+I<count> colors in it's palette
789 Always fails on direct color images.
793 From: Line 440 in imext.c
802 =item i_tags_delbycode(tags, code)
805 Delete any tags with the given code.
807 Returns the number of tags deleted.
811 From: Line 294 in tags.c
813 =item i_tags_delbyname(tags, name)
816 Delete any tags with the given name.
818 Returns the number of tags deleted.
822 From: Line 264 in tags.c
824 =item i_tags_delete(tags, index)
827 Delete a tag by index.
829 Returns true on success.
833 From: Line 235 in tags.c
835 =item i_tags_destroy(tags)
838 Destroys the given tags structure. Called by i_img_destroy().
842 From: Line 158 in tags.c
844 =item i_tags_find(tags, name, start, &entry)
847 Searchs for a tag of the given I<name> starting from index I<start>.
849 On success returns true and sets *I<entry>.
851 On failure returns false.
855 From: Line 181 in tags.c
857 =item i_tags_findn(tags, code, start, &entry)
860 Searchs for a tag of the given I<code> starting from index I<start>.
862 On success returns true and sets *I<entry>.
864 On failure returns false.
868 From: Line 208 in tags.c
870 =item i_tags_get_color(tags, name, code, &value)
873 Retrieve a tag specified by name or code as color.
875 On success sets the i_color *I<value> to the color and returns true.
877 On failure returns false.
881 From: Line 505 in tags.c
883 =item i_tags_get_float(tags, name, code, value)
886 Retrieves a tag as a floating point value.
888 If the tag has a string value then that is parsed as a floating point
889 number, otherwise the integer value of the tag is used.
891 On success sets *I<value> and returns true.
893 On failure returns false.
897 From: Line 320 in tags.c
899 =item i_tags_get_int(tags, name, code, &value)
902 Retrieve a tag specified by name or code as an integer.
904 On success sets the i_color *I<value> to the color and returns true.
906 On failure returns false.
910 From: Line 406 in tags.c
912 =item i_tags_get_string(tags, name, code, value, value_size)
915 Retrieves a tag by name or code as a string.
917 On success copies the string to value for a max of value_size and
920 On failure returns false.
922 value_size must be at least large enough for a string representation
925 The copied value is always NUL terminated.
929 From: Line 569 in tags.c
931 =item i_tags_new(i_img_tags *tags)
934 Initialize a tags structure. Should not be used if the tags structure
935 has been previously used.
937 This should be called tags member of an i_img object on creation (in
938 i_img_*_new() functions).
940 To destroy the contents use i_tags_destroy()
944 From: Line 61 in tags.c
946 =item i_tags_set(tags, name, data, size)
949 Sets the given tag to the string I<data>
953 From: Line 617 in tags.c
955 =item i_tags_set_color(tags, name, code, &value)
958 Stores the given color as a tag with the given name and code.
962 From: Line 545 in tags.c
964 =item i_tags_set_float(tags, name, code, value)
967 Equivalent to i_tags_set_float2(tags, name, code, value, 30).
971 From: Line 359 in tags.c
973 =item i_tags_set_float2(tags, name, code, value, places)
976 Sets the tag with the given name and code to the given floating point
979 Since tags are strings or ints, we convert the value to a string before
980 storage at the precision specified by C<places>.
984 From: Line 374 in tags.c
986 =item i_tags_setn(tags, name, idata)
989 Sets the given tag to the integer I<idata>
993 From: Line 634 in tags.c
1001 Tony Cook <tony@imager.perl.org>
1005 Imager, Imager::ExtUtils, Imager::Inline