imageDrawLine

Description

Draws a single line defined by two sets of x and y coordinates on a ColdFusion image.

Categories

Related

History

ColdFusion 8: Added this function.

Syntax

ImageDrawLine(name, x1, y1, x2, y2)

Attributes

AttributeDescriptionRequiredDefault
nameRequired. The ColdFusion image on which this operation is performed.
x1Required. The x coordinate for the start point of the line.
x2Required. The x coordinate for the end point of the line.
y1Required. The y coordinate for the start point of a line.
y2Required. The y coordinate for the end point of the line.

Returns

Nothing.

Usage

Each pair of coordinates, (x1,y1) and (x2,y2), defines a point. The start and end points cannot be the same.
This function is affected by the attributes defined in the ImageSetDrawingStroke and ImageSetDrawingColor functions. Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

<!--- This example shows how to draw a square bisected by  
    a diagonal line. ---> 
<!--- Use the ImageNew function to create a 100x100-pixel image. ---> 
<cfset myImage=ImageNew("",100,100)> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Draw a diagonal line that bisects the square. ---> 
<cfset ImageDrawLine(myImage,0,0,100,100)> 
<!--- Display the image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">