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])

Argument Reference for the imageDrawRoundRect function

name

Required: Yes
The image on which this operation is performed.

x

Required: Yes
The x coordinate of the rectangle.

y

Required: Yes
The y coordinate of the rectangle.

width

Required: Yes
The width of the rectangle.

height

Required: Yes
The height of the rectangle.

arcwidth

Required: Yes
The horizontal diameter of the arc at the four corners.

archeight

Required: Yes
The vertical diameter of the arc at the four corners.

filled

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

Fork me on GitHub