- I
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
Members
Methods
Assigns the fill defined by this instance to the given SVG element.
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.
Parameters
- element: SVGElement
- The element whose fill should be set.
- context: ICanvasContext
- The context.
See Also
API
- setFill
Freezes and returns this instance.
Return Value
- Fill
- This instance, made immutable.
Parameters
Return Value
- boolean
Static Methods
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.
Parameters
- fill: Fill
- The fill that should be applied. If
null, the element's fill is set tonone. - element: SVGElement
- The SVG element whose fill should be set.
- context: ICanvasContext
- The context to use for managing possible
defsentries.
See Also
API
- applyTo