imageTranslate

Description

Copies an image to a new location on the plane.

Categories

Related

History

ColdFusion 8: Added this function.

Syntax

ImageTranslate(name, xTrans, yTrans [, interpolation])

Attributes

AttributeDescriptionRequiredDefault
interpolationOptional. Type of interpolation used for resampling: 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.
nameRequired. The ColdFusion image on which this operation is performed.
xTransRequired. Displacement in the x direction.
yTransRequired. Displacement in the y direction.

Returns

Nothing.

Usage

For each pixel (x, y) of the destination, the source value at the fractional subpixel position (x - xTrans, y - yTrans) is constructed with an interpolation object and written to the destination. If both xTrans and yTrans are integral, the operation wraps the source image to change the image’s position in the coordinate plane.
Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/aiden01.jpg" name="myImage"> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Offset the image's position to (20,10). ---> 
<cfset ImageTranslate(myImage,20,10)> 
<!--- Display the offset image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">