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
| Attribute | Description | Required | Default |
|---|---|---|---|
| name | Required. The ColdFusion image on which this operation is performed. | ||
| x1 | Required. The x coordinate for the start point of the line. | ||
| x2 | Required. The x coordinate for the end point of the line. | ||
| y1 | Required. The y coordinate for the start point of a line. | ||
| y2 | Required. 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.
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">