User Guide Cancel

ImageSetAntialiasing

 

Description

Switches antialiasing on or off in rendered graphics.

Returns

Nothing.

Category

Image functions

Function syntax

ImageSetAntialiasing(image [, antialias])
ImageSetAntialiasing(image [, antialias])
ImageSetAntialiasing(image [, antialias])

See also

ImageRotateDrawingAxisImageSetBackgroundColorImageSetDrawingColorImageSetDrawingStroke
ImageSetDrawingTransparencyIsImageFile

History

ColdFusion (2018 release): Introduced named parameters.

ColdFusion (2016 release) Update 1: Accepts true/false for antialias.

ColdFusion 8: Added this function.

Parameters

Parameter

Description

image

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

antialias

Optional. Antialiasing switch:

  • on (default) / true
  • off / false

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

<!--- 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">
<!--- 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">
<!--- 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

<!--- 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,true)>
<!--- 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">
<!--- 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,true)> <!--- 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">
<!--- 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,true)>
<!--- 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">

Get help faster and easier

New user?