class openfl.canvas.Rectangle extends Object

Available on all platforms

Instance Fields

var bottomLeftRadius:Float

Gets or sets a value indicating the bottom-left radius of this rectangle.

var bottomRightRadius:Float

Gets or sets a value indicating the bottom-right radius of this rectangle.

var topLeftRadius:Float

Gets or sets a value indicating the top-left radius of this rectangle. If this is greater than 0, and all other radiuses are not, the value of this radius will apply to all other radiuses. If not, then each radius will keep its own value. If neither radius is greater than 0, the resulting rectangle is one with only flat corners.

var topRightRadius:Float

Gets or sets a value indicating the top-right radius of this rectangle.

function new(x:Float, y:Float, width:Float, height:Float, ?styleName:String = ''):Void

Creates a new Rectangle with the given position and size. If a styleName is given, that style within a previously parsed JSON-formatted file will be used to format this rectangle.

x

The position of this rectangle along the x-axis.

y

The position of this rectangle along the y-axis.

width

The size of this rectangle's width.

height

The size of this rectangle's height.

styleName

The name of the style used to apply styling to this object.

function draw(g:Graphics, ?applyFill:Bool = false):Void

This function is used with a graphics component to draw the rectangle, in addition to any styling this rectangle have. By default, all default styling variables will be used.

g

The graphics component to use when drawing this rectangle.

applyFill

A value indicating whether or not to apply fill stying to this rectangle.

function resetRadiuses():Void

Resets all radius properties to 0.