diff --git a/source b/source index 61f30552fe3..4ef7aa686f7 100644 --- a/source +++ b/source @@ -65594,10 +65594,39 @@ interface mixin CanvasPath { undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean counterclockwise = false); }; +// CSS Predefined Color Spaces +enum ColorInterpolationMethod { + "srgb", + "hsl", + "hwb", + "srgb-linear", + "display-p3", + "a98-rgb", + "prophoto-rgb", + "rec2020", + "lab", + "oklab", + "lch", + "oklch", + "xyz", + "xyz-d50", + "xyz-d65" + }; + + // CSS Hue Interpolation Method +enum HueInterpolationMethod { + "shorter", + "longer", + "increasing", + "decreasing" +} + [Exposed=(Window,Worker)] interface CanvasGradient { - // opaque object undefined addColorStop(double offset, DOMString color); + attribute ColorInterpolationMethod colorInterpolationMethod; // (default "srgb") + attribute HueInterpolationMethod hueInterpolationMethod; // (default "shorter", only applicable to "hsl", "hwb", "lch" and "oklch") + attribute boolean premultipliedAlpha = false; }; [Exposed=(Window,Worker)] @@ -68721,15 +68750,19 @@ try {
There are three types of gradients, linear gradients, radial gradients, and conic gradients,
- represented by objects implementing the opaque CanvasGradient
interface.
CanvasGradient
interface.
Once a gradient has been created (see below), stops are placed along it to - define how the colors are distributed along the gradient. The color of the - gradient at each stop is the color specified for that stop. Between each such stop, the colors and - the alpha component must be linearly interpolated over the RGBA space without premultiplying the - alpha value to find the color to use at that offset. Before the first stop, the color must be the - color of the first stop. After the last stop, the color must be the color of the last stop. When - there are no stops, the gradient is transparent black.
+ define how the colors are distributed along the gradient. The color of the gradient + at each stop is the color specified for that stop. Between each such stop, the colors and the alpha + component must be linearly interpolated over the ColorInterpolationMethod color space to find the color to + use at that offset. Color values are premultiplied by alpha if the premultipliedAlpha value is true. For polar + color spaces, hue is interpolated according to the HueInterpolationMethod. Before the first stop, the color + must be the color of the first stop. After the last stop, the color must be the color of the last + stop. When there are no stops, the gradient is transparent black.gradient.addColorStop(offset, color)
DOMException
exception.
- gradient = context.createConicGradient(startAngle, x, y)
gradient.colorInterpolationMethod [ = value ]
Returns a CanvasGradient
object that represents a conic gradient that paints
- clockwise along the rotation around the center represented by the arguments.
Returns the current color space used for interpolation.
+ +Can be set, to change the space used for color interpolation. Possible values are enumerated + in the ColorInterpolationMethod enum. Other + values are ignored.
+gradient.hueInterpolationMethod [ = value ]
Returns the current hue interpolation method.
+ +Can be set, to change the hueInterpolationMethod.
+ +Possible hue interpolation method values are "shorter", "longer", "increasing", or + "decreasing". Other values are ignored.
+gradient.premultipliedAlpha [ = value ]
Returns true if the gradient will interpolate using premultiplied alpha. Otherwise returns false.
+ +Can be set, to change the premultipliedAlpha value.
+The CanvasGradient
has a colorInterpolationMethod
+ attribute of type ColorInterpolationMethod
, which indicates the
+ CanvasGradient
object's color space for interpolation.
+ Valid values are enumerated in the ColorInterpolationMethod
enumeration.
The CanvasGradient
also has a hueInterpolationMethod
attribute
+ of type HueInterpolationMethod
, which indicates the CanvasGradient
+ object's method for for interpolationing hues in polar color spaces.
+ Valid values are enumerated in the HueInterpolationMethod
enumeration.
Finally, the CanvasGradient
also has a premultipliedAlpha
boolean
+ attribute, which indicates whether the resulting gradient should interpolate using premultiplied alpha.
The createLinearGradient(x0, y0,
x1, y1)
method takes four arguments that represent the start