ImageDrawOval

Description

Draws an oval.

Returns

Nothing.

Function syntax

ImageDrawOval(name, x, y, width, height [, filled])

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

name

Required. The ColdFusion image on which this operation is performed.

x

Required. The x coordinate of the upper left corner of the oval to draw.

y

Required. The y coordinate of the upper left corner of the oval to draw.

width

Required. The width of the oval to draw.

height

Required. The height of the oval to draw.

filled

Optional. Specify whether the oval is filled:

  • yes: The oval is filled with the specified drawing color.

  • no: Only the outline of the oval is drawn (default).

Usage

The result is a circle or ellipse that fits within the rectangle specified by the x, y, width, and height arguments.

If the filled parameter is set to yes, the area inside the oval is filled with the current drawing color.

Use the ImageSetDrawingColor and ImageSetDrawingStroke functions to specify the color and line attributes of the oval. Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

Example 1

<!--- This example shows how to draw a green filled oval. ---> 
<!--- Use the ImageNew function to create a 200x110-pixel image. ---> 
<cfset myImage=ImageNew("",200,110)> 
<!--- Set the drawing color to green. ---> 
<cfset ImageSetDrawingColor(myImage,"green")> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Draw a filled green oval on the image. ---> 
<cfset ImageDrawOval(myImage,5,5,190,100,"yes")> 
<!--- Display the image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">

Example 2

<!--- This example shows how to draw a red circle with  
    a line through it. ---> 
<!--- Use the ImageNew function to create a 201x201-pixel image. ---> 
<cfset myImage=ImageNew("",201,201)> 
<!--- Set the drawing color to red. ---> 
<cfset ImageSetDrawingColor(myImage,"red")> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Set the line width to 10 pixels. ---> 
<cfset attr=StructNew()> 
<cfset attr.width = 10> 
<cfset ImageSetDrawingStroke(myImage,attr)> 
<!--- Draw a diagonal line starting at (40,40) and ending at (165,165) on myImage. ---> 
<cfset ImageDrawLine(myImage,40,40,165,165)> 
<!--- Draw a circle starting at (5,5) and is 190 pixels high and 190 pixels wide. ---> 
<cfset ImageDrawOval(myImage,5,5,190,190)> 
<!--- Display the image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">