Draws a rectangle with rounded corners.

imageDrawRoundRect(name, x, y, width, height, arcwidth, archeight [, filled]) → returns void

Member Function Syntax

someImage.drawRoundRect(x, y, width, height, arcwidth, archeight [, filled])

imageDrawRoundRect Argument Reference

name string

The image on which this operation is performed.

x numeric

The x coordinate of the rectangle.

y numeric

The y coordinate of the rectangle.

width numeric

The width of the rectangle.

height numeric

The height of the rectangle.

arcwidth numeric

The horizontal diameter of the arc at the four corners.

archeight numeric

The vertical diameter of the arc at the four corners.

filled boolean
Default: false

Specify whether the rectangle is filled

Examples sample code invoking the imageDrawRoundRect function

Tag Syntax

This example shows how to draw a square with rounded corners.

<!--- Create a 200x200-pixel image. ---> 
 <cfset myImage=imageNew("",200,200)> 
 <!--- Set the drawing color for the image to blue. ---> 
 <cfset imageSetDrawingColor(myImage,"blue")> 
 <!--- Turn on antialiasing to improve image quality. ---> 
 <cfset imageSetAntialiasing(myImage,"on")> 
 <!--- Draw a blue filled square with round corners of arcWidth=10 and arcHeight=2. ---> 
 <cfset imageDrawRoundRect(myImage,5,5,190,190,"yes",10,2)> 
 <!--- Display the image in a browser. ---> 
 <cfimage source="#myImage#" action="writeToBrowser"> 

Using drawRoundRect member fucntion

CF 11+ Lucee 4.5+ Create an new image. With the new image draw filled rounded rectangle (width=70, height=50) starting at point (x=40,y=50)

imgObj = imageNew("",152,152,"rgb","149c82");
cfimage (action="writeToBrowser", source=imgObj);

Fork me on GitHub