imageDrawRect

Description

Draws a rectangle.

Categories

Related

History

ColdFusion 8: Added this function.

Syntax

ImageDrawRect(name, x, y, width, height [, filled])

Attributes

AttributeDescriptionRequiredDefault
filledOptional. Specify whether the rectangle is filled: yes: The rectangle is filled with the specified drawing color. no: Only the outline of the rectangle is drawn (default).
heightRequired. The height of the rectangle.
nameRequired. The ColdFusion image on which this operation is performed.
widthRequired. The width of the rectangle.
xRequired. The x coordinate of the rectangle.
yRequired. The y coordinate of the rectangle.

Returns

Nothing.

Usage

The left and right edges of the rectangle are at x and x plus width, respectively. The upper and lower edges are at y and y plus height, respectively.
Set the filled parameter to yes to fill the rectangle with the current drawing color.
Use the ImageSetDrawingColor and ImageSetDrawingStroke functions to format the color and lines of the rectangle. Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

<!--- This example shows how to draw a rectangle. ---> 
<!--- Use the ImageNew function to create a ColdFusion image that is 150 pixels wide and 200 pixels high. ---> 
<cfset myImage=ImageNew("",150,200)> 
<!--- Set the drawing color for the image to yellow. ---> 
<cfset ImageSetDrawingColor(myImage,"yellow")> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Draw a filled yellow rectangle on the image. ---> 
<cfset ImageDrawRect(myImage,25,45,100,20,"yes")> 
<!--- Display the image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">