Adobe ColdFusion 8

ImageClearRect

Description

Clears the specified rectangle by filling it with the background color of the current drawing surface.

Returns

Nothing.

Category

Image functions

Function syntax

ImageClearRect(name, x, y, width, height)

See also

ImageSetBackgroundColor, IsImageFile

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

name

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

x

Required. The x coordinate of the rectangle to clear.

y

Required. The y coordinate of the rectangle to clear.

width

Required. The width of the rectangle to clear.

height

Required. The height of the rectangle to clear.

Usage

Use this function in conjunction with the ImageSetBackgroundColor function.

Example

<!--- This example shows how to set the background color to green and draws four rectangles in that color on the image. --->
<!--- Create a ColdFusion image from an existing JPEG file. --->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage">
<!--- Set the background color to green. --->
<cfset ImageSetBackgroundColor(myImage,"green")>
<!--- Draw four rectangles in the background color. --->
<cfset ImageClearRect(myImage,10,25,50,50)>
<cfset ImageClearRect(myImage,100,25,50,50)>
<cfset ImageClearRect(myImage,10,100,50,50)>
<cfset ImageClearRect(myImage,100,100,50,50)>
<!--- Save the modified ColdFusion image to a file. --->
<cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes">
<!--- Display the source image and the new image. --->
<img src="../cfdocs/images/artgallery/jeff05.jpg"/>
<img src="test_myImage.jpeg"/>