Class CanvasGradientItem

  • All Implemented Interfaces:
    IsJSType, IsCastable

    @JsType(isNative=true,
            name="CanvasGradient",
            namespace="<global>")
    public final class CanvasGradientItem
    extends Object
    implements IsCastable
    Represents an opaque object describing a gradient.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • addColorStop

        @JsOverlay
        public void addColorStop​(double offset,
                                 String color)
        Adds a new stop, defined by an offset and a color, to the gradient.
        If the offset is not between 0 and 1, inclusive, an IllegalArgumentException is raised.
        If the color is null, the default color for line element is used. If the color can't be parsed as a CSS color, a SYNTAX_ERR is raised.
        Parameters:
        offset - 0 and 1 value to define the offset
        color - the CSS color
      • addColorStop

        @JsOverlay
        public void addColorStop​(double offset,
                                 IsColor color)
        Adds a new stop, defined by an offset and a color, to the gradient.
        If the offset is not between 0 and 1, inclusive, an IllegalArgumentException is raised.
        If the color is null, the default color for line element is used. If the color can't be parsed as a CSS color, a SYNTAX_ERR is raised.
        Parameters:
        offset - 0 and 1 value to define the offset
        color - the CSS color