C

Fill
abstract

Represents any object that fills an area.
ImplementsInheritance Hierarchy

Remarks

The fill that is defined by instances of this type can be applied to an SVG element using either the static helper setFill or the instance method applyTo.

This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.

CSS color strings are converted to CssFills. For example:

'blue'
'#369'
'#336699'
'#369A',
'#336699AA'
'rgb(51, 102, 153)'
'rgba(51, 102, 153 / 0.5)'
'hsl(225, 98%, 60%)'
'hsla(225, 98%, 60% / 0.5)',

Additionally, SVG strings are supported. For example:

'none'
'url(#gradient)'

Arrays are converted to Color.

See Also

Developer's Guide

API

setFill, Color

Members

No filters for this type

Methods

Assigns the fill defined by this instance to the given SVG element.

If this Fill is a gradient and implements the ISvgDefsCreator interface, it will be added to the defs section of the SVG document per the context. The fill of the given element will be set to a reference to the gradient element.

This method is very similar in functionality to its static method counterpart setFill. However since this method is an instance method, it cannot be called on empty/null fills. If you are unsure whether the reference actually points to an instance, use the static helper method instead.

final

Parameters

element: SVGElement
The element whose fill should be set.
context: ICanvasContext
The context.

See Also

API
setFill
Clones this instance by returning a memberwise clone, or by returning this if this instance is frozen.

Return Value

Object
An instance of the same type as this instance.
Freezes and returns this instance.
Freezing an object makes it immutable, which can result in performance enhancements.

Return Value

Fill
This instance, made immutable.
Determines whether this Fill is equal to the specified object.
abstract

Parameters

fill: Fill
The other Fill instance to compare.

Return Value

boolean
true, if this Color is equal to the other object; false, otherwise.
Determines if this instance is frozen.
final

Return Value

boolean
true if this instance is frozen; otherwise, false.

Static Methods

Creates a Fill instance from the given fill-like object by performing automatic type conversion.
static

Parameters

fillLike: Fill
The object to convert to a Fill.

Return Value

Fill
The given fillLike if it is already a Fill, or a new instance initialized to the values found in fillLike.
Sets the Fill on a given SVG element as the fill.

If this Fill is a gradient and implements the ISvgDefsCreator interface, it will be added to the defs section of the SVG document per the context. The fill of the given element will be set to a reference to the gradient element.

This method is very similar in functionality to its instance method counterpart applyTo. However, being static, it also allows for the case where the fill is null.

static

Parameters

fill: Fill
The fill that should be applied. If null, the element's fill is set to none .
element: SVGElement
The SVG element whose fill should be set.
context: ICanvasContext
The context to use for managing possible defs entries.

See Also

API
applyTo