ImageShear

Description

Shears an image either horizontally or vertically. For each pixel (x, y) of the destination, the source value at the fractional subpixel position (x', y') is constructed with an Interpolation object and written to the destination.

Returns

Nothing.

Function syntax

ImageShear(name, shear [, direction, interpolation])

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

name

Required. The ColdFusion image on which this operation is performed.

shear

Required. Shear value. Coordinates can be integers or real numbers.

direction

Optional. Shear direction:

  • horizontal (default)

  • vertical

interpolation

Optional. Type of interpolation:

  • nearest: Applies the nearest neighbor method of interpolation. Image quality is lower than the other interpolation methods, but processing is fastest (default).

  • bilinear: Applies the bilinear method of interpolation. The quality of the image is less pixelated than the default, but processing is slower.

  • bicubic: Applies the bicubic method of interpolation. Generally, the quality of image is highest with this method and processing is slowest.

Usage

Use this function to distort an image.

If the direction parameter is set to horizontal, x' = (x - y*shear) and y' = y.

If the direction parameter is set to vertical, x' = x and y' = (y - x*shear).

Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

<!--- This example shows how to shear an image. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/paul03.jpg" name="myImage"> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Shear the image by a factor of 1 on a horizontal axis. ---> 
<cfset ImageShear(myImage,1,"horizontal")> 
<!--- Display the image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">