Fills an area with a linear gradient.
Type Details
- yFiles module
- view
Constructors
Initializes a new instance of the LinearGradient class.
Parameters
A map of options to pass to the method.
- spreadMethod - GradientSpreadMethod
- The spread method of this gradient. This option sets the spreadMethod property on the created object.
- startPoint - Point
- The start point of this gradient. This option sets the startPoint property on the created object.
- endPoint - Point
- The end point of this gradient. This option sets the endPoint property on the created object.
- gradientStops - GradientStop[]
- An array of GradientStops. Each item will be added to the gradientStops collection.
Properties
Gets or sets the end point of this gradient.
Property Value
Gets or sets the spread method of this gradient.
Property Value
Gets or sets the start point of this gradient.
Property Value
Methods
Checks if the specified node references the element represented by this object.
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- The current canvas context.
- item - Node
- The SVG node.
- id - string
- The defs id that has been stored for this instance by the provided context.
Returns
- ↪boolean
true
ifnode
references the element represented by this instance.
Implements
Assigns the fill defined by this instance to the given SVG element
.
Remarks
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
A map of options to pass to the method.
- element - SVGElement
- The element whose fill should be set.
- context - ICanvasContext
- The context.
See Also
Defined in
Clones this instance by returning a memberwise clone, or by returning this
if this instance is frozen.
Creates a new SVG gradient that corresponds to this LinearGradient.
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- The current canvas context.
Returns
- ↪SVGElement
- A new SVG gradient that corresponds to this LinearGradient
Implements
Freezes and returns this instance.
Remarks
Returns
- ↪Fill
- This instance, made immutable.
Overrides
Determines whether this LinearGradient is equal to the specified object.
Parameters
A map of options to pass to the method.
Returns
- ↪boolean
Implements
Determines if this instance is frozen.
Creates a new SVG gradient that corresponds to this LinearGradient.
Returns
- ↪SVGElement
- A new SVG gradient that corresponds to this LinearGradient
Updates the SVG gradient within the defs
section of the SVG document if it has changed.
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- The context.
- oldElement - SVGElement
- The old element.
Implements
Updates the SVG gradient within the defs
section of the SVG document if it has changed.
Parameters
A map of options to pass to the method.
- oldElement - SVGElement
- The old element.
- context - ICanvasContext
- The context.