NAME

shear - Shear or rotate a raster image by an arbitrary angle


SYNOPSIS

RotateImage(image,degrees,crop,sharpen)

ShearImage(image,x_shear,y_shear,crop)


FUNCTION DESCRIPTIONS


RotateImage

Function 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 defined by the pixel at location (0,0). RotateImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.

Function RotateImage is based on the paper ``A Fast Algorithm for General Raster Rotatation'' by Alan W. Paeth. RotateImage is adapted from a similiar routine based on the Paeth paper written by Michael Halle of the Spatial Imaging Group, MIT Media Lab.

The format of the RotateImage routine is:

        RotateImage(image,degrees,crop,sharpen)

A description of each parameter follows.

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

image:
The address of a structure of type Image; returned from ReadImage.

degrees:
Specifies the number of degrees to rotate the image.

crop:
A value other than zero crops the corners of the rotated image and retains the original image size.

sharpen:
A value other than zero sharpens the image after it is rotated.


ShearImage

Function ShearImage creates a new image that is a sheared 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.

Function ShearImage is based on the paper ``A Fast Algorithm for General Raster Rotatation'' by Alan W. Paeth.

The format of the ShearImage routine is:

        ShearImage(image,x_shear,y_shear,crop)

A description of each parameter follows.

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

image:
The address of a structure of type Image; returned from ReadImage.

x_shear, y_shear:
Specifies the number of degrees to shear the image.

crop:
A value other than zero crops the corners of the rotated image and retains the original image size.