imageDrawRoundRect

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
Required

The image on which this operation is performed.

x numeric
Required

The x coordinate of the rectangle.

y numeric
Required

The y coordinate of the rectangle.

width numeric
Required

The width of the rectangle.

height numeric
Required

The height of the rectangle.

arcwidth numeric
Required

The horizontal diameter of the arc at the four corners.

archeight numeric
Required

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

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"> 

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");
imgObj.drawRoundRect(40,50,70,50,35,35,"yes");
cfimage (action="writeToBrowser", source=imgObj);

Fork me on GitHub