C
Fills an area with a specified CSS or SVG color value.
ImplementsInheritance Hierarchy

Remarks

This fill supports color values specified by CSS. Please note that not all color values, such as gradients, are supported as attributes in SVG shapes. Those will only work in HTML styles.

See Also

API

Fill, Color, LinearGradient, RadialGradient

Members

Show:

Constructors

Initializes a new instance of the CssFill class with the specified color value.
New instances of this type are automatically frozen since they are immutable anyway.

Parameters

value: string
The color value for this Fill.

Properties

Gets the color value for this Fill.
readonlyfinal

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

Defined in

Fill.applyTo
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.

Defined in

Fill.clone
Freezes and returns this instance.
Freezing an object makes it immutable, which can result in performance enhancements.

Return Value

Fill
This instance, made immutable.

Defined in

Fill.freeze
Determines whether this CssFill is equal to the specified object.
final

Parameters

fill: Fill
The other Fill instance to compare.

Return Value

boolean
true, if this CssFill 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.

Defined in

Fill.isFrozen
Gets the Color from the color value.
Since the colors are converted, not all css or svg strings are supported, e.g., complex values with multiple colors, like gradients or urls.
final

Return Value

Color
A Color if the value can be converted, null if value is "none", or BLACK otherwise.