Sets (right-left) pixels starting from (left,y) using (right-left) floating point colors from fcolors.

Returns the number of pixels set.

i_ppal(im, left, right, y, indexes)

Writes palette indexes for the horizontal line (left, y) to (right-1, y) from indexes.

Returns the number of indexes written.

Always returns 0 for direct color images.

i_ppix(im, x, y, color)

Sets the pixel at (x,y) to color.

Returns 0 if the pixel was drawn, or -1 if not.

Does no alpha blending, just copies the channels from the supplied color to the image.

i_ppixf(im, x, y, fcolor)

Sets the pixel at (x,y) to the floating point color fcolor.

Returns 0 if the pixel was drawn, or -1 if not.

Does no alpha blending, just copies the channels from the supplied color to the image.

i_psamp(im, left, right, y, samples, channels, channel_count)

Writes sample values from samples to im for the horizontal line (left, y) to (right-1, y) inclusive for the channels specified by channels, an array of int with channel_count elements.

If channels is NULL then the first channels_count channels are written to for each pixel.

Returns the number of samples written, which should be (right - left) * channel_count. If a channel not in the image is in channels, left is negative, left is outside the image or y is outside the image, returns -1 and pushes an error.

Writes floating point sample values from samples to im for the horizontal line (left, y) to (right-1, y) inclusive for the channels specified by channels, an array of int with channel_count elements.

If channels is NULL then the first channels_count channels are written to for each pixel.

Returns the number of samples written, which should be (right - left) * channel_count. If a channel not in the image is in channels, left is negative, left is outside the image or y is outside the image, returns -1 and pushes an error.

Buffer at least size (at most ig->buf_size bytes of data from the stream and return size bytes of it to the caller in buffer.

This ignores the buffered state of the stream, and will always setup buffering if needed.

If no type parameter is provided to Imager::read() or Imager::read_multi(), Imager will call i_io_peekn() when probing for the file format.

Returns -1 on error, 0 if there is no data before EOF, or the number of bytes read into buffer.

i_io_putc(ig, c)

Write a single character to the stream.

On success return c, on error returns EOF

i_io_read(io, buffer, size)

Read up to size bytes from the stream io into buffer.

Returns the number of bytes read. Returns 0 on end of file. Returns -1 on error.

i_io_seek(io, offset, whence)

Seek within the stream.

Acts like perl's seek.

i_io_set_buffered(io, buffered)

Set the buffering mode of the stream.

If you switch buffering off on a stream with buffering on:

any buffered output will be flushed.

any existing buffered input will be consumed before reads become unbuffered.

Returns true on success. This may fail if any buffered output cannot be flushed.

i_io_write(io, buffer, size)

ssize_t result = i_io_write(io, buffer, size)

Write to the given I/O stream.

Returns the number of bytes written.

io_slurp(ig, c)

Takes the source that the io_glue is bound to and allocates space for a return buffer and returns the entire content in a single buffer. Note: This only works for io_glue objects created by io_new_bufchain(). It is useful for saving to scalars and such.

ig - io_glue object
c - pointer to a pointer to where data should be copied to
char *data;
size_t size = io_slurp(ig, &data);
... do something with the data ...
myfree(data);

io_slurp() will abort the program if the supplied I/O layer is not from io_new_bufchain().

io_glue_destroy(ig)

io_glue_destroy(ig);

Destroy an io_glue objects. Should clean up all related buffers.

ig - io_glue object to destroy.

Image

i_copy(source)

Creates a new image that is a copy of the image source.

Tags are not copied, only the image data.

Returns: i_img *

i_copyto(dest, src, x1, y1, x2, y2, tx, ty)

Copies image data from the area (x1,y1)-[x2,y2] in the source image to a rectangle the same size with it's top-left corner at (tx,ty) in the destination image.

If x1 > x2 or y1 > y2 then the corresponding co-ordinates are swapped.

i_copyto_trans(im, src, x1, y1, x2, y2, tx, ty, trans)

(x1,y1) (x2,y2) specifies the region to copy (in the source coordinates) (tx,ty) specifies the upper left corner for the target image. pass NULL in trans for non transparent i_colors.

Takes the sub image src[src_minx, src_maxx)[src_miny, src_maxy)> and overlays it at (tx,ty) on the image object.

The alpha channel of each pixel in src is used to control how much the existing color in im is replaced, if it is 255 then the color is completely replaced, if it is 0 then the original color is left unmodified.

Image creation/destruction

i_img_16_new(x, y, ch)

i_img *img = i_img_16_new(width, height, channels);

Create a new 16-bit/sample image.

Returns the image on success, or NULL on failure.

i_img_8_new(x, y, ch)

i_img *img = i_img_8_new(width, height, channels);

Creates a new image object x pixels wide, and y pixels high with ch channels.

i_img_double_new(i_img_dim x, i_img_dim y, int ch)

i_img *img = i_img_double_new(width, height, channels);

Creates a new double per sample image.

i_img_pal_new(x, y, channels, maxpal)

i_img *img = i_img_pal_new(width, height, channels, max_palette_size)

Creates a new paletted image of the supplied dimensions.

maxpal is the maximum palette size and should normally be 256.

Returns a new image or NULL on failure.

i_sametype(im, xsize, ysize)

i_img *img = i_sametype(src, width, height);

Returns an image of the same type (sample size, channels, paletted/direct).

For paletted images the palette is copied from the source.

i_sametype_chans(im, xsize, ysize, channels)

i_img *img = i_sametype_chans(src, width, height, channels);

Returns an image of the same type (sample size).

For paletted images the equivalent direct type is returned.

i_img_destroy(img)

i_img_destroy(img)

Destroy an image object

Image Implementation

i_img_alloc()

Allocates a new i_img structure.

When implementing a new image type perform the following steps in your image object creation function:

allocate the image with i_img_alloc().

initialize any function pointers or other data as needed, you can overwrite the whole block if you need to.

Uncategorized functions

i_utf8_advance(char **p, size_t *len)

Retrieve a UTF-8 character from the stream.

Modifies *p and *len to indicate the consumed characters.

This doesn't support the extended UTF-8 encoding used by later versions of Perl. Since this is typically used to implement text output by font drivers, the strings supplied shouldn't have such out of range characters.

This doesn't check that the UTF-8 character is using the shortest possible representation.

Returns ~0UL on failure.

AUTHOR

Tony Cook <tonyc@cpan.org>

SEE ALSO

Imager, Imager::ExtUtils, Imager::Inline

Module Install Instructions

To install Imager::APIRef, simply copy and paste either of the commands in to your terminal