Draws a single line defined by two sets of x and y coordinates on a ColdFusion image.
imageDrawLine(image, x1, y1, x2, y2)
→ returns void
someImage.drawLine(x1, y1, x2, y2)
bx-image module.
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">
CF 11+ Lucee 4.5+ Create a new image and with this image draw a diagonal line from the top left (0,0) to the bottom right (152,152)
imgObj = imageNew("",152,152,"rgb","149c82");
imgObj.drawLine(0,0,152,152);
cfimage (action="writeToBrowser", source=imgObj);
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.