shear

Rotate image, shear image, or apply a 2D affine transformation

Contents

AffineTransformImage

Synopsis

Image *AffineTransformImage( const Image *image, AffineMatrix *affine,
                             ExceptionInfo *exception );

Description

AffineTransformImage() transforms an image as dictated by the affine matrix. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

The format of the AffineTransformImage method is:

Image *AffineTransformImage( const Image *image, AffineMatrix *affine,
                             ExceptionInfo *exception );
image:

The image.

affine:

The affine transform.

exception:

Return any errors or warnings in this structure.

AutoOrientImage

Synopsis

Image *AutoOrientImage( const Image *image, const OrientationType current_orientation,
                        ExceptionInfo *exception );

Description

AutoOrientImage() returns an image adjusted so that its orientation is suitable for viewing (i.e. top-left orientation).

The format of the AutoOrientImage method is:

Image *AutoOrientImage( const Image *image, const OrientationType current_orientation,
                        ExceptionInfo *exception );
image:

The image.

current_orientation:

Current image orientation (normally same as image->orientation).

exception:

Return any errors or warnings in this structure.

RotateImage

Synopsis

Image *RotateImage( const Image *image, const double degrees,
                    ExceptionInfo *exception );

Description

Method RotateImage creates a new image that is a rotated copy of an existing one. Positive angles rotate counter-clockwise (right-hand rule), while negative angles rotate clockwise. Rotated images are usually larger than the originals and have 'empty' triangular corners. X axis. Empty triangles left over from shearing the image are filled with the color specified by the image background_color. RotateImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.

Method RotateImage is based on the paper "A Fast Algorithm for General Raster Rotatation" by Alan W. Paeth. RotateImage is adapted from a similar method based on the Paeth paper written by Michael Halle of the Spatial Imaging Group, MIT Media Lab.

The format of the RotateImage method is:

Image *RotateImage( const Image *image, const double degrees,
                    ExceptionInfo *exception );
status:

Method RotateImage returns a pointer to the image after rotating. A null image is returned if there is a memory shortage.

image:

The image; returned from ReadImage.

degrees:

Specifies the number of degrees to rotate the image.

exception:

Return any errors or warnings in this structure.

ShearImage

Synopsis

Image *ShearImage( const Image *image, const double x_shear, const double y_shear,
                   ExceptionInfo *exception );

Description

Method ShearImage creates a new image that is a shear_image copy of an existing one. Shearing slides one edge of an image along the X or Y axis, creating a parallelogram. An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x_shear is measured relative to the Y axis, and similarly, for Y direction shears y_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the color defined by the pixel at location (0,0). ShearImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.

Method ShearImage is based on the paper "A Fast Algorithm for General Raster Rotatation" by Alan W. Paeth.

The format of the ShearImage method is:

Image *ShearImage( const Image *image, const double x_shear, const double y_shear,
                   ExceptionInfo *exception );
status:

Method ShearImage returns a pointer to the image after rotating. A null image is returned if there is a memory shortage.

image:

The image; returned from ReadImage.

x_shear, y_shear:

Specifies the number of degrees to shear the image.

exception:

Return any errors or warnings in this structure.


Copyright © GraphicsMagick Group 2002 - 2024