Class: ShapePath

ShapePath

A helper class for Graphics - converts its API calls to a shape that can be used by the Graphics2D renderer.

Methods

chamferRect (x, y, width, height, chamfer, transform) this

Draw Rectangle with chamfer corners. These are angled corners.

Name Type Attributes Description
x number

Upper left corner of rect

y number

Upper right corner of rect

width number

Width of rect

height number

Height of rect

chamfer number

non-zero real number, size of corner cutout

transform Matrix <optional>
Returns:
Type Description
this

filletRect (x, y, width, height, fillet) this

Draw Rectangle with fillet corners. This is much like rounded rectangle however it support negative numbers as well for the corner radius.

Name Type Description
x number

Upper left corner of rect

y number

Upper right corner of rect

width number

Width of rect

height number

Height of rect

fillet number

accept negative or positive values

Returns:
Type Description
this

roundShape (points, radius, useQuadratic, smoothness) this

Draw a Shape with rounded corners. Supports custom radius for each point.

Name Type Attributes Default Description
points RoundedPoint[]

Corners of the shape to draw. Minimum length is 3.

radius number

Corners default radius.

useQuadratic boolean false

If true, rounded corners will be drawn using quadraticCurve instead of arc.

smoothness number <optional>

If using quadraticCurve, this is the smoothness of the curve.

Returns:
Type Description
this