diff --git a/source b/source index 877761a9424..d49067a2617 100644 --- a/source +++ b/source @@ -68907,6 +68907,7 @@ dictionary CanvasRenderingContext2DSettings { boolean alpha = true; boolean desynchronized = false; PredefinedColorSpace colorSpace = "srgb"; + CanvasToneMapping toneMapping = {}; CanvasColorType colorType = "unorm8"; boolean willReadFrequently = false; }; @@ -69167,7 +69168,7 @@ interface Path2D { objects.

-
context = canvas.getContext('2d' [, { [ alpha: true ] [, desynchronized: false ] [, colorSpace: 'srgb'] [, willReadFrequently: false ]} ])
+
context = canvas.getContext('2d' [, { [ alpha: true ] [, desynchronized: false ] [, colorSpace: 'srgb'] [, toneMapping: {}] [, willReadFrequently: false ]} ])

Returns a CanvasRenderingContext2D object that is permanently bound to a particular canvas element.

@@ -69184,6 +69185,10 @@ interface Path2D { specifies the color space of the rendering context.

+

The toneMapping member + specifies the tone mapping of the rendering + context.

+

The colorType member specifies the color type of the rendering context.

@@ -69212,6 +69217,10 @@ interface Path2D { a string indicating the context's color space. +
  • toneMapping member is + a dictionary indicating the context's tone mapping + behavior.
  • +
  • colorType member is a string indicating the context's color type.
  • @@ -69496,6 +69505,12 @@ context.fillRect(100,0,50,50); // only this square remains data-x="concept-canvas-color-space">color space indicates the color space for the output bitmap.

    +

    The CanvasSettings object also has a tone mapping setting of type + CanvasToneMapping. The CanvasSettings object's tone mapping indicates the tone mapping behavior + of the output bitmap.

    +

    The CanvasSettings object also has a color type setting of type CanvasColorType. The CanvasSettings object's settings["colorSpace"].

    +
  • Set context's tone mapping to + settings["toneMapping"].

  • +
  • Set context's color type to settings["colorType"].

  • @@ -69541,6 +69560,8 @@ context.fillRect(100,0,50,50); // only this square remains this's desynchronized, "colorSpace" → this's color space, "toneMapping" → this's + tone mapping, "colorType" → this's color type, "willReadFrequently" → @@ -75526,7 +75547,19 @@ interface OffscreenCanvasRenderingContext2D {
    Color spaces and color space conversion
    -
    enum PredefinedColorSpace { "srgb", "display-p3" };
    +
    enum PredefinedColorSpace {
    +  "srgb",
    +  "display-p3"
    +};
    +
    +enum CanvasToneMappingMode {
    +  "standard",
    +  "extended",
    +};
    +
    +dictionary CanvasToneMapping {
    +  CanvasToneMappingMode mode = "standard";
    +};

    The PredefinedColorSpace enumeration is used to specify the color space of the canvas's backing store.

    @@ -75539,6 +75572,57 @@ interface OffscreenCanvasRenderingContext2D { data-x="dom-PredefinedColorSpace-display-p3">display-p3" value indicates the 'display-p3' color space.

    +

    The CanvasToneMappingMode enumeration specifies the tone mapping + to perform when rendering the context's output bitmap to the screen.

    + +

    The "standard" value indicates that + color values within the standard dynamic range of the screen shall be unchanged, and + all other color values shall be projected to the standard dynamic range of the screen.

    + +

    This projection is often accomplished by clamping color values in the color + space of the screen to the [0, 1] interval.

    + +
    +

    Suppose that the value (1.035, -0.175, -0.140) is written to an output bitmap + with color space 'srgb'.

    + +

    If this is presented to a screen that natively uses the 'srgb' color space, then + this value will be converted to 'srgb' (which is a no-op), then projected to the + [0, 1] cubed volume in that space. Using component-wise clamping, this would result in the + 'srgb' value (1.0, 0.0, 0.0).

    + +

    If this is presented to a screen that natively uses the 'display-p3' color space, + then this will be converted to the value (0.948, 0.106, 0.01) in the 'display-p3' + color space, and no clamping will be needed.

    +
    + +

    The "extended" value indicates that + color values within the extended dynamic range of the screen shall be unchanged, and + all other color values shall be projected to the extended dynamic range of the screen.

    + +

    This projection is often accomplished by clamping color values in the color + space of the screen to the interval of values that the screen is capable of displaying, + which can include values greater than 1.

    + +
    +

    Suppose that the value (2.5, -0.15, -0.15) is written to an output bitmap + with color space 'srgb'.

    + +

    If this is presented to a screen that natively uses the 'srgb' color space and + is capable of displaying values in the [0, 4] interval in that color space, then this value will be + converted to 'srgb' (which is a no-op), then projected to the [0, 4] cubed volume in + that space. Using component-wise clamping, this would result in the 'srgb' value + (2.5, 0.0, 0.0).

    + +

    If this is presented to a screen that natively uses the 'display-p3' color space + and is capable of displaying values in the [0, 2] interval in that color space, then this value + will be converted to the value (2.3, 0.545, 0.01) in the 'display-p3' color space, + and then projected to the [0, 2] cubed volume in that space. Using component-wise clamping, this + would result in the 'display-p3' value (2.0, 0.545, 0.386).

    +
    +

    Color space conversion must be applied to the canvas's backing store when rendering the canvas to the output device.