ImageSetAntialiasing

Description

Switches antialiasing on or off in rendered graphics.

Returns

Nothing.

Function syntax

ImageSetAntialiasing(name [, antialias])

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

name

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

antialias

Optional. Antialiasing switch:

  • on (default)

  • off

Usage

The ImageSetAntialiasing function is used to turn antialiasing on and off when drawing shapes and text in an image. Antialiasing is a technique used to soften jagged edges. Turn on antialiasing when using other image functions, such as ImageDrawRoundRect and ImageRotate, to improve the quality of the rendered image. Notice that antialiasing decreases performance.

Example

Example 1

<!--- This example shows how to turn off antialiasing for a ColdFusion image. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfset myImage=ImageNew("../cfdocs/images/artgallery/elecia02.jpg")> 
<!--- Turn off antialiasing.---> 
<cfset ImageSetAntialiasing(myImage,"off")> 
<!--- Display the modified image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">

Example 2

<!--- This example shows how to turn on antialiasing to improve the output of the ImageDrawRoundRect function. ---> 
<!--- Create a 200x200-pixel image. ---> 
<cfset myImage=ImageNew("",200,200)> 
<!--- Set the drawing color for the image to blue. ---> 
<cfset ImageSetDrawingColor(myImage,"blue")> 
<!--- Turn on antialiasing. ---> 
<cfset ImageSetAntialiasing(myImage)> 
<!--- Draw a blue filled square with round corners of arcWidth=10 and arcHeight=2. ---> 
<cfset ImageDrawRoundRect(myImage,5,5,190,190,"yes",10,2)> 
<!--- Rotate the image 30 degrees. ---> 
<cfset ImageRotate(myImage,30)> 
<!--- Display the image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">