From 45d9f749e2378392c5d16638541df43703750576 Mon Sep 17 00:00:00 2001 From: Aaron Krajeski Date: Mon, 3 Feb 2025 10:31:26 -0500 Subject: [PATCH 1/7] Add gradient stuff --- source | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/source b/source index 61f30552fe3..4b21d8a90a3 100644 --- a/source +++ b/source @@ -65594,10 +65594,40 @@ 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", + "specified" +} + [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)] @@ -68726,8 +68756,8 @@ try {

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 + 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 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.

From dbce0399968174c34083bf04fb9e7e5f96ae7e59 Mon Sep 17 00:00:00 2001 From: Aaron Krajeski Date: Mon, 3 Feb 2025 11:01:10 -0500 Subject: [PATCH 2/7] Add non normative stuff --- source | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/source b/source index 4b21d8a90a3..b270128f5fb 100644 --- a/source +++ b/source @@ -68751,15 +68751,18 @@ try {

There are three types of gradients, linear gradients, radial gradients, and conic gradients, - represented by objects implementing the opaque CanvasGradient interface.

+ represented by objects implementing the 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 - ColorInterpolationMethod color space to find the color to use at that offset. Color values are premultiplied by alpha if 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.

+ 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)
@@ -68790,10 +68793,36 @@ try { 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 colorInterpolationMethod + color space.

+ +

The color space must be a string. Invalid values are ignored.

+
+ +
gradient.hueInterpolationMethod [ = value ]
+ +
+

Returns the current hue interpolation method.

+ +

Can be set, to change the hueInterpolationMethod.

+ +

The method must be a string. Invalid 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.

+
From c290a1da22c24b4a763a8b85e906b4f3d7a1a5d7 Mon Sep 17 00:00:00 2001 From: Aaron Krajeski Date: Mon, 3 Feb 2025 11:23:41 -0500 Subject: [PATCH 3/7] Remove specified --- source | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source b/source index b270128f5fb..638b5a784b6 100644 --- a/source +++ b/source @@ -65618,8 +65618,7 @@ enum HueInterpolationMethod { "shorter", "longer", "increasing", - "decreasing", - "specified" + "decreasing" } [Exposed=(Window,Worker)] From 05374815591fff843cdab02eaf775ab45fbb0533 Mon Sep 17 00:00:00 2001 From: Aaron Krajeski Date: Mon, 3 Feb 2025 13:33:35 -0500 Subject: [PATCH 4/7] missing some commas --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 638b5a784b6..21d6b2a4338 100644 --- a/source +++ b/source @@ -65603,11 +65603,11 @@ enum ColorInterpolationMethod { "display-p3", "a98-rgb", "prophoto-rgb", - "rec2020" + "rec2020", "lab", "oklab", "lch", - "oklch" + "oklch", "xyz", "xyz-d50", "xyz-d65" From 16c0c081f6c5b06998f22ec5084558e406f8b99c Mon Sep 17 00:00:00 2001 From: Aaron Krajeski Date: Tue, 4 Feb 2025 08:12:54 -0500 Subject: [PATCH 5/7] Rewrap --- source | 62 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/source b/source index 21d6b2a4338..8447cd10eb8 100644 --- a/source +++ b/source @@ -68753,15 +68753,16 @@ try { represented by objects implementing the 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 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.

+ 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)
@@ -68792,37 +68793,38 @@ try { DOMException exception.

-
gradient.colorInterpolationMethod [ = value ]
+
gradient.colorInterpolationMethod [ = value ]
-
-

Returns the current color space used for interpolation.

+
+

Returns the current color space used for interpolation.

-

Can be set, to change the colorInterpolationMethod - color space.

+

Can be set, to change the colorInterpolationMethod color space.

-

The color space must be a string. Invalid values are ignored.

-
+

The color space must be a string. Invalid values are ignored.

+ -
gradient.hueInterpolationMethod [ = value ]
+
gradient.hueInterpolationMethod [ = value ]
-
-

Returns the current hue interpolation method.

+
+

Returns the current hue interpolation method.

-

Can be set, to change the hueInterpolationMethod.

+

Can be set, to change the hueInterpolationMethod.

-

The method must be a string. Invalid values are ignored.

-
+

The method must be a string. Invalid values are ignored.

+ -
gradient.premultipliedAlpha [ = value ]
+
gradient.premultipliedAlpha [ = value ]
-
-

Returns true if the gradient will interpolate using premultiplied alpha. - Otherwise returns false.

+
+

Returns true if the gradient will interpolate using premultiplied alpha. Otherwise returns false.

-

Can be set, to change the premultipliedAlpha - value.

-
-
+

Can be set, to change the premultipliedAlpha value.

+ +
From 22b24d5a9b01fd08501beaabf9b4a20e06dae438 Mon Sep 17 00:00:00 2001 From: Aaron Krajeski Date: Tue, 4 Feb 2025 08:23:27 -0500 Subject: [PATCH 6/7] Dont use must non-normatively --- source | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source b/source index 8447cd10eb8..b91177ac299 100644 --- a/source +++ b/source @@ -68798,10 +68798,9 @@ try {

Returns the current color space used for interpolation.

-

Can be set, to change the colorInterpolationMethod color space.

- -

The color space must be a string. Invalid values are ignored.

+

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 ]
@@ -68812,7 +68811,8 @@ try {

Can be set, to change the hueInterpolationMethod.

-

The method must be a string. Invalid values are ignored.

+

Possible hue interpolation method values are "shorter", "longer", "increasing", or + "decreasing". Other values are ignored.

gradient.premultipliedAlpha [ = value ]
From e9e20c0536f73cf6d52e55b736758c5c1c5c56d6 Mon Sep 17 00:00:00 2001 From: Aaron Krajeski Date: Mon, 24 Feb 2025 11:22:13 -0500 Subject: [PATCH 7/7] Add non normative sections --- source | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source b/source index b91177ac299..4ef7aa686f7 100644 --- a/source +++ b/source @@ -68861,6 +68861,24 @@ try { +

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