Draws a rectangle.
imageDrawRect(name, x, y, width, height [, filled])
→ returns void
someImage.drawRect(x, y, width, height [, filled])
false
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">
CF 11+ Lucee 4.5+ Create a new image. With the new image draw filled rectangle (width=70, height=50) starting at point (x=40,y=50)
imgObj = imageNew("",152,152,"rgb","149c82");
imgObj.drawRect(40,50,70,50,"yes");
cfimage (action="writeToBrowser", source=imgObj);
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.