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 where
5 you can find the documentation.
9 Imager::APIRef - Imager's C API - reference.
14 color.rgba.r = 255; color.rgba.g = 0; color.rgba.b = 255;
22 black.rgba.r = black.rgba.g = black.rgba.b = black.rgba.a = 0;
27 i_arc(im, 50, 50, 20, 45, 135, &color);
28 i_arc_cfill(im, 50, 50, 35, 90, 135, fill);
29 i_arc_aa(im, 50, 50, 35, 90, 135, &color);
30 i_arc_aa_cfill(im, 50, 50, 35, 90, 135, fill);
31 i_circle_aa(im, 50, 50, 45, &color);
32 i_box(im, 0, 0, im->xsize-1, im->ysize-1, &color).
33 i_box_filled(im, 0, 0, im->xsize-1, im->ysize-1, &color);
34 i_box_cfill(im, 0, 0, im->xsize-1, im->ysize-1, fill);
35 i_flood_fill(im, 50, 50, &color);
36 i_flood_cfill(im, 50, 50, fill);
37 i_flood_fill_border(im, 50, 50, &color, &border);
38 i_flood_cfill_border(im, 50, 50, fill, border);
42 i_push_error(0, "Yep, it's broken");
43 i_push_error(errno, "Error writing");
44 i_push_errorf(errno, "Cannot open file %s: %d", filename, errno);
47 i_set_image_file_limits(500, 500, 1000000);
48 i_get_image_file_limits(&width, &height, &bytes)
49 i_i_int_check_image_file_limits(width, height, channels, sizeof(i_sample_t))
52 i_fill_t *fill = i_new_fill_solidf(&fcolor, combine);
53 i_fill_t *fill = i_new_fill_solid(&color, combine);
54 i_fill_t *fill = i_new_fill_hatch(&fg_color, &bg_color, combine, hatch, custom_hatch, dx, dy);
55 i_fill_t *fill = i_new_fill_hatchf(&fg_fcolor, &bg_fcolor, combine, hatch, custom_hatch, dx, dy);
56 i_fill_t *fill = i_new_fill_image(src_img, matrix, x_offset, y_offset, combine);
57 fill = i_new_fill_fount(0, 0, 100, 100, i_ft_linear, i_ft_linear,
58 i_fr_triangle, 0, i_fts_grid, 9, 1, segs);
63 # Image creation/destruction
64 i_img *img = i_img_8_new(width, height, channels);
65 i_img *img = i_sametype(src, width, height);
66 i_img *img = i_sametype_chans(src, width, height, channels);
67 i_img *img = i_img_pal_new(width, height, channels, max_palette_size)
68 i_img *img = i_img_double_new(width, height, channels);
69 i_img *img = i_img_16_new(width, height, channels);
72 # Image Implementation
75 // only channel 0 writeable
76 i_img_setmask(img, 0x01);
77 int mask = i_img_getmask(img);
78 int channels = i_img_getchannels(img);
79 i_img_dim width = i_img_get_width(im);
80 i_img_dim height = i_img_get_height(im);
89 i_tags_set(&img->tags, "i_comment", -1);
90 i_tags_setn(&img->tags, "i_xres", 204);
91 i_tags_setn(&img->tags, "i_yres", 196);
99 =item i_render_color(r, x, y, width, source, color)
101 Render the given color with the coverage specified by C<source[0]> to
104 Renders in normal combine mode.
110 =item i_render_delete(r)
112 Release an C<i_render> object.
118 =item i_render_fill(r, x, y, width, source, fill)
120 Render the given fill with the coverage in C<source[0]> through
127 =item i_render_line(r, x, y, width, source, fill)
129 Render the given fill with the coverage in C<source[0]> through
136 =item i_render_linef(r, x, y, width, source, fill)
138 Render the given fill with the coverage in C<source[0]> through
145 =item i_render_new(im, width)
147 Allocate a new C<i_render> object and initialize it.
162 This is Imager's image type.
164 It contains the following members:
170 C<channels> - the number of channels in the image
174 C<xsize>, C<ysize> - the width and height of the image in pixels
178 C<bytes> - the number of bytes used to store the image data. Undefined
179 where virtual is non-zero.
183 C<ch_mask> - a mask of writable channels. eg. if this is 6 then only
184 channels 1 and 2 are writable. There may be bits set for which there
185 are no channels in the image.
189 C<bits> - the number of bits stored per sample. Should be one of
190 i_8_bits, i_16_bits, i_double_bits.
194 C<type> - either i_direct_type for direct color images, or i_palette_type
199 C<virtual> - if zero then this image is-self contained. If non-zero
200 then this image could be an interface to some other implementation.
204 C<idata> - the image data. This should not be directly accessed. A new
205 image implementation can use this to store its image data.
206 i_img_destroy() will myfree() this pointer if it's non-null.
210 C<tags> - a structure storing the image's tags. This should only be
211 accessed via the i_tags_*() functions.
215 C<ext_data> - a pointer for use internal to an image implementation.
216 This should be freed by the image's destroy handler.
220 C<im_data> - data internal to Imager. This is initialized by
225 i_f_ppix, i_f_ppixf, i_f_plin, i_f_plinf, i_f_gpix, i_f_gpixf,
226 i_f_glin, i_f_glinf, i_f_gsamp, i_f_gampf - implementations for each
227 of the required image functions. An image implementation should
228 initialize these between calling i_img_alloc() and i_img_init().
232 i_f_gpal, i_f_ppal, i_f_addcolors, i_f_getcolors, i_f_colorcount,
233 i_f_maxcolors, i_f_findcolor, i_f_setcolors - implementations for each
234 paletted image function.
238 i_f_destroy - custom image destruction function. This should be used
239 to release memory if necessary.
243 i_f_gsamp_bits - implements i_gsamp_bits() for this image.
247 i_f_psamp_bits - implements i_psamp_bits() for this image.
253 From: File imdatatypes.h
257 Type for 8-bit/sample color.
263 i_color is a union of:
269 gray - contains a single element gray_color, eg. C<c.gray.gray_color>
273 C<rgb> - contains three elements C<r>, C<g>, C<b>, eg. C<c.rgb.r>
277 C<rgba> - contains four elements C<r>, C<g>, C<b>, C<a>, eg. C<c.rgba.a>
281 C<cmyk> - contains four elements C<c>, C<m>, C<y>, C<k>,
282 eg. C<c.cmyk.y>. Note that Imager never uses CMYK colors except when
283 reading/writing files.
287 channels - an array of four channels, eg C<c.channels[2]>.
293 From: File imdatatypes.h
297 This is the double/sample color type.
299 Its layout exactly corresponds to i_color.
303 From: File imdatatypes.h
307 This is the "abstract" base type for Imager's fill types.
309 Unless you're implementing a new fill type you'll typically treat this
314 From: File imdatatypes.h
318 A signed integer type that represents an image dimension or ordinate.
320 May be larger than int on some platforms.
324 From: File imdatatypes.h
333 =item i_arc(im, x, y, rad, d1, d2, color)
336 Fills an arc centered at (x,y) with radius I<rad> covering the range
337 of angles in degrees from d1 to d2, with the color.
343 =item i_arc_aa(im, x, y, rad, d1, d2, color)
346 Anti-alias fills an arc centered at (x,y) with radius I<rad> covering
347 the range of angles in degrees from d1 to d2, with the color.
353 =item i_arc_aa_cfill(im, x, y, rad, d1, d2, fill)
356 Anti-alias fills an arc centered at (x,y) with radius I<rad> covering
357 the range of angles in degrees from d1 to d2, with the fill object.
363 =item i_arc_cfill(im, x, y, rad, d1, d2, fill)
366 Fills an arc centered at (x,y) with radius I<rad> covering the range
367 of angles in degrees from d1 to d2, with the fill object.
373 =item i_box(im, x1, y1, x2, y2, color)
376 Outlines the box from (x1,y1) to (x2,y2) inclusive with I<color>.
382 =item i_box_cfill(im, x1, y1, x2, y2, fill)
385 Fills the box from (x1,y1) to (x2,y2) inclusive with fill.
391 =item i_box_filled(im, x1, y1, x2, y2, color)
394 Fills the box from (x1,y1) to (x2,y2) inclusive with color.
400 =item i_circle_aa(im, x, y, rad, color)
403 Anti-alias fills a circle centered at (x,y) for radius I<rad> with
410 =item i_flood_cfill(C<im>, C<seedx>, C<seedy>, C<fill>)
413 Flood fills the 4-connected region starting from the point (C<seedx>,
414 C<seedy>) with C<fill>.
416 Returns false if (C<seedx>, C<seedy>) are outside the image.
422 =item i_flood_cfill_border(C<im>, C<seedx>, C<seedy>, C<fill>, C<border>)
425 Flood fills the 4-connected region starting from the point (C<seedx>,
426 C<seedy>) with C<fill>, the fill stops when it reaches pixels of color
429 Returns false if (C<seedx>, C<seedy>) are outside the image.
435 =item i_flood_fill(C<im>, C<seedx>, C<seedy>, C<color>)
438 Flood fills the 4-connected region starting from the point (C<seedx>,
439 C<seedy>) with I<color>.
441 Returns false if (C<seedx>, C<seedy>) are outside the image.
447 =item i_flood_fill_border(C<im>, C<seedx>, C<seedy>, C<color>, C<border>)
450 Flood fills the 4-connected region starting from the point (C<seedx>,
451 C<seedy>) with C<color>, fill stops when the fill reaches a pixels
452 with color C<border>.
454 Returns false if (C<seedx>, C<seedy>) are outside the image.
460 =item i_glin(im, l, r, y, colors)
463 Retrieves (r-l) pixels starting from (l,y) into I<colors>.
465 Returns the number of pixels retrieved.
471 =item i_glinf(im, l, r, y, colors)
474 Retrieves (r-l) pixels starting from (l,y) into I<colors> as floating
477 Returns the number of pixels retrieved.
483 =item i_gpal(im, left, right, y, indexes)
486 Reads palette indexes for the horizontal line (left, y) to (right-1,
489 Returns the number of indexes read.
491 Always returns 0 for direct color images.
497 =item i_gpix(im, C<x>, C<y>, C<color>)
500 Retrieves the C<color> of the pixel (x,y).
502 Returns 0 if the pixel was retrieved, or -1 if not.
508 =item i_gpixf(im, C<x>, C<y>, C<fcolor>)
511 Retrieves the color of the pixel (x,y) as a floating point color into
514 Returns 0 if the pixel was retrieved, or -1 if not.
520 =item i_gsamp(im, left, right, y, samples, channels, channel_count)
523 Reads sample values from C<im> for the horizontal line (left, y) to
524 (right-1,y) for the channels specified by C<channels>, an array of int
525 with C<channel_count> elements.
527 If channels is NULL then the first channels_count channels are retrieved for
530 Returns the number of samples read (which should be (right-left) *
537 =item i_gsamp_bg(im, l, r, y, samples, out_channels, background)
540 Like C<i_gsampf()> but applies the source image color over a supplied
543 This is intended for output to image formats that don't support alpha
550 =item i_gsampf(im, left, right, y, samples, channels, channel_count)
553 Reads floating point sample values from C<im> for the horizontal line
554 (left, y) to (right-1,y) for the channels specified by C<channels>, an
555 array of int with channel_count elements.
557 If C<channels> is NULL then the first C<channel_count> channels are
558 retrieved for each pixel.
560 Returns the number of samples read (which should be (C<right>-C<left>)
567 =item i_gsampf_bg(im, l, r, y, samples, out_channels, background)
570 Like C<i_gsampf()> but applies the source image color over a supplied
573 This is intended for output to image formats that don't support alpha
580 =item i_line(C<im>, C<x1>, C<y1>, C<x2>, C<y2>, C<color>, C<endp>)
583 =for stopwords Bresenham's
585 Draw a line to image using Bresenham's line drawing algorithm
587 im - image to draw to
588 x1 - starting x coordinate
589 y1 - starting x coordinate
590 x2 - starting x coordinate
591 y2 - starting x coordinate
592 color - color to write to image
593 endp - endpoint flag (boolean)
599 =item i_line_aa(C<im>, C<x1>, C<x2>, C<y1>, C<y2>, C<color>, C<endp>)
602 Anti-alias draws a line from (x1,y1) to (x2, y2) in color.
604 The point (x2, y2) is drawn only if C<endp> is set.
610 =item i_plin(im, l, r, y, colors)
613 Sets (r-l) pixels starting from (l,y) using (r-l) values from
616 Returns the number of pixels set.
622 =item i_plinf(im, C<left>, C<right>, C<fcolors>)
625 Sets (right-left) pixels starting from (left,y) using (right-left)
626 floating point colors from C<fcolors>.
628 Returns the number of pixels set.
634 =item i_ppal(im, left, right, y, indexes)
637 Writes palette indexes for the horizontal line (left, y) to (right-1,
640 Returns the number of indexes written.
642 Always returns 0 for direct color images.
648 =item i_ppix(im, x, y, color)
651 Sets the pixel at (x,y) to I<color>.
653 Returns 0 if the pixel was drawn, or -1 if not.
655 Does no alpha blending, just copies the channels from the supplied
662 =item i_ppixf(im, C<x>, C<y>, C<fcolor>)
665 Sets the pixel at (C<x>,C<y>) to the floating point color C<fcolor>.
667 Returns 0 if the pixel was drawn, or -1 if not.
669 Does no alpha blending, just copies the channels from the supplied
679 =head2 Error handling
683 =item i_clear_error()
685 Clears the error stack.
687 Called by any Imager function before doing any other processing.
693 =item i_push_error(int code, char const *msg)
695 Called by an Imager function to push an error message onto the stack.
697 No message is pushed if the stack is full (since this means someone
698 forgot to call i_clear_error(), or that a function that doesn't do
699 error handling is calling function that does.).
705 =item i_push_errorf(int code, char const *fmt, ...)
707 A version of i_push_error() that does printf() like formatting.
709 Does not support perl specific format codes.
715 =item i_push_errorvf(int C<code>, char const *C<fmt>, va_list C<ap>)
718 Intended for use by higher level functions, takes a varargs pointer
719 and a format to produce the finally pushed error message.
721 Does not support perl specific format codes.
734 =item i_get_file_background(im, &bg)
737 Retrieve the file write background color tag from the image.
739 If not present, returns black.
745 =item i_get_file_backgroundf(im, &bg)
748 Retrieve the file write background color tag from the image as a
749 floating point color.
751 Implemented in terms of i_get_file_background().
753 If not present, returns black.
759 =item i_get_image_file_limits(&width, &height, &bytes)
762 Retrieves the file limits set by i_set_image_file_limits().
768 =item i_int_check_image_file_limits(width, height, channels, sample_size)
771 Checks the size of a file in memory against the configured image file
774 This also range checks the values to those permitted by Imager and
775 checks for overflows in calculating the size.
777 Returns non-zero if the file is within limits.
779 This function is intended to be called by image file read functions.
785 =item i_set_image_file_limits(width, height, bytes)
788 Set limits on the sizes of images read by Imager.
790 Setting a limit to 0 means that limit is ignored.
792 Negative limits result in failure.
794 Returns non-zero on success.
807 =item i_new_fill_fount(C<xa>, C<ya>, C<xb>, C<yb>, C<type>, C<repeat>, C<combine>, C<super_sample>, C<ssample_param>, C<count>, C<segs>)
811 Creates a new general fill which fills with a fountain fill.
815 From: File filters.im
817 =item i_new_fill_hatch(C<fg>, C<bg>, C<combine>, C<hatch>, C<cust_hatch>, C<dx>, C<dy>)
820 Creates a new hatched fill with the C<fg> color used for the 1 bits in
821 the hatch and C<bg> for the 0 bits. If C<combine> is non-zero alpha
822 values will be combined.
824 If C<cust_hatch> is non-NULL it should be a pointer to 8 bytes of the
825 hash definition, with the high-bits to the left.
827 If C<cust_hatch> is NULL then one of the standard hatches is used.
829 (C<dx>, C<dy>) are an offset into the hatch which can be used to hatch
830 adjoining areas out of alignment, or to align the origin of a hatch
831 with the the side of a filled area.
837 =item i_new_fill_hatchf(C<fg>, C<bg>, C<combine>, C<hatch>, C<cust_hatch>, C<dx>, C<dy>)
840 Creates a new hatched fill with the C<fg> color used for the 1 bits in
841 the hatch and C<bg> for the 0 bits. If C<combine> is non-zero alpha
842 values will be combined.
844 If C<cust_hatch> is non-NULL it should be a pointer to 8 bytes of the
845 hash definition, with the high-bits to the left.
847 If C<cust_hatch> is NULL then one of the standard hatches is used.
849 (C<dx>, C<dy>) are an offset into the hatch which can be used to hatch
850 adjoining areas out of alignment, or to align the origin of a hatch
851 with the the side of a filled area.
857 =item i_new_fill_image(C<im>, C<matrix>, C<xoff>, C<yoff>, C<combine>)
860 Create an image based fill.
862 matrix is an array of 9 doubles representing a transformation matrix.
864 C<xoff> and C<yoff> are the offset into the image to start filling from.
870 =item i_new_fill_solid(color, combine)
873 Create a solid fill based on an 8-bit color.
875 If combine is non-zero then alpha values will be combined.
881 =item i_new_fill_solidf(color, combine)
884 Create a solid fill based on a float color.
886 If combine is non-zero then alpha values will be combined.
892 =item i_fill_destroy(fill)
894 Call to destroy any fill object.
910 Creates a new image that is a copy of the image C<source>.
912 Tags are not copied, only the image data.
920 =item i_copyto(C<dest>, C<src>, C<x1>, C<y1>, C<x2>, C<y2>, C<tx>, C<ty>)
923 Copies image data from the area (C<x1>,C<y1>)-[C<x2>,C<y2>] in the
924 source image to a rectangle the same size with it's top-left corner at
925 (C<tx>,C<ty>) in the destination image.
927 If C<x1> > C<x2> or C<y1> > C<y2> then the corresponding co-ordinates
934 =item i_copyto_trans(C<im>, C<src>, C<x1>, C<y1>, C<x2>, C<y2>, C<tx>, C<ty>, C<trans>)
937 (C<x1>,C<y1>) (C<x2>,C<y2>) specifies the region to copy (in the
938 source coordinates) (C<tx>,C<ty>) specifies the upper left corner for
939 the target image. pass NULL in C<trans> for non transparent i_colors.
945 =item i_img_info(im, info)
948 Return image information
951 info - pointer to array to return data
953 info is an array of 4 integers with the following values:
958 info[3] - channel mask
964 =item i_rubthru(C<im>, C<src>, C<tx>, C<ty>, C<src_minx>, C<src_miny>, C<src_maxx>, C<src_maxy>)
967 Takes the sub image C<src>[C<src_minx>, C<src_maxx>)[C<src_miny>, C<src_maxy>)> and
968 overlays it at (C<tx>,C<ty>) on the image object.
970 The alpha channel of each pixel in C<src> is used to control how much
971 the existing color in C<im> is replaced, if it is 255 then the color
972 is completely replaced, if it is 0 then the original color is left
977 From: File rubthru.im
982 =head2 Image creation/destruction
986 =item i_img_16_new(x, y, ch)
989 Create a new 16-bit/sample image.
991 Returns the image on success, or NULL on failure.
997 =item i_img_8_new(x, y, ch)
1001 Creates a new image object I<x> pixels wide, and I<y> pixels high with
1008 =item i_img_double_new(int x, int y, int ch)
1010 Creates a new double per sample image.
1014 From: File imgdouble.c
1016 =item i_img_pal_new(C<x>, C<y>, C<channels>, C<maxpal>)
1019 Creates a new paletted image of the supplied dimensions.
1021 C<maxpal> is the maximum palette size and should normally be 256.
1023 Returns a new image or NULL on failure.
1029 =item i_sametype(C<im>, C<xsize>, C<ysize>)
1032 Returns an image of the same type (sample size, channels, paletted/direct).
1034 For paletted images the palette is copied from the source.
1040 =item i_sametype_chans(C<im>, C<xsize>, C<ysize>, C<channels>)
1043 Returns an image of the same type (sample size).
1045 For paletted images the equivalent direct type is returned.
1051 =item i_img_destroy(C<img>)
1053 Destroy an image object
1062 =head2 Image Implementation
1068 Allocates a new i_img structure.
1070 When implementing a new image type perform the following steps in your
1071 image object creation function:
1077 allocate the image with i_img_alloc().
1081 initialize any function pointers or other data as needed, you can
1082 overwrite the whole block if you need to.
1086 initialize Imager's internal data by calling i_img_init() on the image
1095 =item i_img_init(C<img>)
1097 Imager internal initialization of images.
1099 Currently this does very little, in the future it may be used to
1100 support threads, or color profiles.
1109 =head2 Image Information
1113 =item i_img_color_channels(C<im>)
1116 The number of channels holding color information.
1120 From: File immacros.h
1122 =item i_img_get_height(C<im>)
1124 Returns the height in pixels of the image.
1130 =item i_img_get_width(C<im>)
1132 Returns the width in pixels of the image.
1138 =item i_img_getchannels(C<im>)
1140 Get the number of channels in C<im>.
1146 =item i_img_getmask(C<im>)
1148 Get the image channel mask for C<im>.
1154 =item i_img_has_alpha(C<im>)
1157 Return true if the image has an alpha channel.
1161 From: File immacros.h
1163 =item i_img_is_monochrome(img, &zero_is_white)
1166 Tests an image to check it meets our monochrome tests.
1168 The idea is that a file writer can use this to test where it should
1169 write the image in whatever bi-level format it uses, eg. C<pbm> for
1172 For performance of encoders we require monochrome images:
1182 have a palette of two colors, containing only C<(0,0,0)> and
1183 C<(255,255,255)> in either order.
1187 C<zero_is_white> is set to non-zero if the first palette entry is white.
1193 =item i_img_setmask(C<im>, C<ch_mask>)
1195 Set the image channel mask for C<im> to C<ch_mask>.
1197 The image channel mask gives some control over which channels can be
1198 written to in the image.
1207 =head2 Image quantization
1211 =item i_quant_makemap(C<quant>, C<imgs>, C<count>)
1214 Analyzes the C<count> images in C<imgs> according to the rules in
1215 C<quant> to build a color map (optimal or not depending on
1216 C<< quant->make_colors >>).
1222 =item i_quant_translate(C<quant>, C<img>)
1225 Quantize the image given the palette in C<quant>.
1227 On success returns a pointer to a memory block of C<< img->xsize *
1228 img->ysize >> C<i_palidx> entries.
1230 On failure returns NULL.
1232 You should call myfree() on the returned block when you're done with
1235 This function will fail if the supplied palette contains no colors.
1241 =item i_quant_transparent(C<quant>, C<data>, C<img>, C<trans_index>)
1244 Dither the alpha channel on C<img> into the palette indexes in
1245 C<data>. Pixels to be transparent are replaced with C<trans_pixel>.
1247 The method used depends on the tr_* members of C<quant>.
1260 =item i_lhead(file, line)
1262 This is an internal function called by the mm_log() macro.
1268 =item i_loog(level, format, ...)
1270 This is an internal function called by the mm_log() macro.
1276 =item mm_log((level, format, ...))
1278 This is the main entry point to logging. Note that the extra set of
1279 parentheses are required due to limitations in C89 macros.
1281 This will format a string with the current file and line number to the
1282 log file if logging is enabled.
1291 =head2 Paletted images
1295 =item i_addcolors(im, colors, count)
1298 Adds colors to the image's palette.
1300 On success returns the index of the lowest color added.
1302 On failure returns -1.
1304 Always fails for direct color images.
1310 =item i_colorcount(im)
1313 Returns the number of colors in the image's palette.
1315 Returns -1 for direct images.
1321 =item i_findcolor(im, color, &entry)
1324 Searches the images palette for the given color.
1326 On success sets *I<entry> to the index of the color, and returns true.
1328 On failure returns false.
1330 Always fails on direct color images.
1336 =item i_getcolors(im, index, colors, count)
1339 Retrieves I<count> colors starting from I<index> in the image's
1342 On success stores the colors into I<colors> and returns true.
1344 On failure returns false.
1346 Always fails for direct color images.
1348 Fails if there are less than I<index>+I<count> colors in the image's
1355 =item i_maxcolors(im)
1358 Returns the maximum number of colors the palette can hold for the
1361 Returns -1 for direct color images.
1367 =item i_setcolors(im, index, colors, count)
1370 Sets I<count> colors starting from I<index> in the image's palette.
1372 On success returns true.
1374 On failure returns false.
1376 The image must have at least I<index>+I<count> colors in it's palette
1377 for this to succeed.
1379 Always fails on direct color images.
1392 =item i_tags_delbycode(tags, code)
1395 Delete any tags with the given code.
1397 Returns the number of tags deleted.
1403 =item i_tags_delbyname(tags, name)
1406 Delete any tags with the given name.
1408 Returns the number of tags deleted.
1414 =item i_tags_delete(tags, index)
1417 Delete a tag by index.
1419 Returns true on success.
1425 =item i_tags_destroy(tags)
1428 Destroys the given tags structure. Called by i_img_destroy().
1434 =item i_tags_find(tags, name, start, &entry)
1437 Searches for a tag of the given I<name> starting from index I<start>.
1439 On success returns true and sets *I<entry>.
1441 On failure returns false.
1447 =item i_tags_findn(tags, code, start, &entry)
1450 Searches for a tag of the given I<code> starting from index I<start>.
1452 On success returns true and sets *I<entry>.
1454 On failure returns false.
1460 =item i_tags_get_color(tags, name, code, &value)
1463 Retrieve a tag specified by name or code as color.
1465 On success sets the i_color *I<value> to the color and returns true.
1467 On failure returns false.
1473 =item i_tags_get_float(tags, name, code, value)
1476 Retrieves a tag as a floating point value.
1478 If the tag has a string value then that is parsed as a floating point
1479 number, otherwise the integer value of the tag is used.
1481 On success sets *I<value> and returns true.
1483 On failure returns false.
1489 =item i_tags_get_int(tags, name, code, &value)
1492 Retrieve a tag specified by name or code as an integer.
1494 On success sets the int *I<value> to the integer and returns true.
1496 On failure returns false.
1502 =item i_tags_get_string(tags, name, code, value, value_size)
1505 Retrieves a tag by name or code as a string.
1507 On success copies the string to value for a max of value_size and
1510 On failure returns false.
1512 value_size must be at least large enough for a string representation
1515 The copied value is always C<NUL> terminated.
1521 =item i_tags_new(i_img_tags *tags)
1524 Initialize a tags structure. Should not be used if the tags structure
1525 has been previously used.
1527 This should be called tags member of an i_img object on creation (in
1528 i_img_*_new() functions).
1530 To destroy the contents use i_tags_destroy()
1536 =item i_tags_set(tags, name, data, size)
1538 Sets the given tag to the string I<data>
1540 If size is -1 then the strlen(I<data>) bytes are stored.
1542 Even on failure, if an existing tag I<name> exists, it will be
1549 =item i_tags_set_color(tags, name, code, &value)
1552 Stores the given color as a tag with the given name and code.
1558 =item i_tags_set_float(tags, name, code, value)
1561 Equivalent to i_tags_set_float2(tags, name, code, value, 30).
1567 =item i_tags_set_float2(tags, name, code, value, places)
1570 Sets the tag with the given name and code to the given floating point
1573 Since tags are strings or ints, we convert the value to a string before
1574 storage at the precision specified by C<places>.
1580 =item i_tags_setn(C<tags>, C<name>, C<idata>)
1582 Sets the given tag to the integer C<idata>
1584 Even on failure, if an existing tag C<name> exists, it will be
1594 =head2 Uncategorized functions
1598 =item i_utf8_advance(char **p, size_t *len)
1600 Retrieve a C<UTF-8> character from the stream.
1602 Modifies *p and *len to indicate the consumed characters.
1604 This doesn't support the extended C<UTF-8> encoding used by later
1607 This doesn't check that the C<UTF-8> character is using the shortest
1608 possible representation.
1621 Tony Cook <tony@imager.perl.org>
1625 Imager, Imager::ExtUtils, Imager::Inline