image.c - implements most of the basic functions of Imager and much of the rest
i_img *i; i_color *c; c = i_color_new(red, green, blue, alpha); ICL_DESTROY(c); i = i_img_8_new(); i_img_destroy(i); // and much more
image.c implements the basic functions to create and destroy image and color objects for Imager.
Some of these functions are internal.
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.
initialize Imager's internal data by calling i_img_init() on the image object.
Imager internal initialization of images.
See "im_img_alloc(aIMCTX)" for more information.
Return a new color object with values passed to it.
r - red component (range: 0 - 255) g - green component (range: 0 - 255) b - blue component (range: 0 - 255) a - alpha component (range: 0 - 255)
Overwrite a color with new values. cl - pointer to color object r - red component (range: 0 - 255) g - green component (range: 0 - 255) b - blue component (range: 0 - 255) a - alpha component (range: 0 - 255)
Add src to dst inplace - dst is modified.
dst - pointer to destination color object src - pointer to color object that is added ch - number of channels
Dump color information to log - strictly for debugging.
cl - pointer to color object
Destroy ancillary data for Color object.
Free image data.
im - Image pointer
img
Destroy an image object
Return image information
im - Image pointer info - pointer to array to return data
info is an array of 4 integers with the following values:
info[0] - width info[1] - height info[2] - channels info[3] - channel mask
im
ch_mask
Set the image channel mask for im to ch_mask.
The image channel mask gives some control over which channels can be written to in the image.
Get the image channel mask for im.
Get the number of channels in im.
Returns the width in pixels of the image.
Returns the height in pixels of the image.
Returns the color model for the image.
A future version of Imager will allow for images with extra channels beyond gray/rgb and alpha.
Work out the alpha channel for an image.
If the image has an alpha channel, sets *channel to the alpha channel index and returns non-zero.
*channel
If the image has no alpha channel, returns zero and *channel is not modified.
channel may be NULL.
channel
NULL
Returns the number of color channels in the image. For now this is always 1 (for grayscale) or 3 (for RGB) but may be 0 in some special cases in a future release of Imager.
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.
Creates a new image that is a copy of the image source.
source
Tags are not copied, only the image data.
Returns: i_img *
Returns a new image object which is im scaled by value along wither the x-axis (axis == 0) or the y-axis (axis == 1).
Scale by using nearest neighbor Both axes scaled at the same time since nothing is gained by doing it in two steps
xsize
ysize
Returns an image of the same type (sample size, channels, paletted/direct).
For paletted images the palette is copied from the source.
channels
Returns an image of the same type (sample size).
For paletted images the equivalent direct type is returned.
Spatially transforms im returning a new image.
opx for a length of opxl and opy for a length of opy are arrays of operators that modify the x and y positions to retreive the pixel data from.
parm and parmlen define extra parameters that the operators may use.
Note that this function is largely superseded by the more flexible "i_transform2" in transform.c.
Returns the new image.
The operators for this function are defined in stackmach.c.
Calculates the sum of the squares of the differences between correspoding channels in two images.
If the images are not the same size then only the common area is compared, hence even if images are different sizes this function can return zero.
This is like i_img_diff() but looks at floating point samples instead.
returns number of colors or -1 to indicate that it was more than max colors
These functions provide i_fsample_t functions in terms of their i_sample_t versions.
Used for virtual images, these forward palette calls to a wrapped image, assuming the wrapped image is the first pointer in the structure that im->ext_data points at.
Check the beginning of the supplied file for a 'magic number'
Tests an image to check it meets our monochrome tests.
The idea is that a file writer can use this to test where it should write the image in whatever bi-level format it uses, eg. pbm for pnm.
pbm
pnm
For performance of encoders we require monochrome images:
be paletted
have a palette of two colors, containing only (0,0,0) and (255,255,255) in either order.
(0,0,0)
(255,255,255)
zero_is_white is set to non-zero if the first palette entry is white.
zero_is_white
Retrieve the file write background color tag from the image.
If not present, bg is set to black.
bg
Returns 1 if the i_background tag was found and valid.
i_background
Retrieve the file write background color tag from the image as a floating point color.
Implemented in terms of i_get_file_background().
Arnar M. Hrafnkelsson <addi@umich.edu>
Tony Cook <tonyc@cpan.org>
Imager, gif.c
8 POD Errors
The following errors were encountered while parsing the POD:
Unknown directive: =category
To install Imager, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Imager
CPAN shell
perl -MCPAN -e shell install Imager
For more information on module installation, please visit the detailed CPAN module installation guide.