diff --git a/source b/source index d0d75d360ce..f9e9ba27218 100644 --- a/source +++ b/source @@ -65366,12 +65366,15 @@ typedef (HTMLOrSVGImageElement or enum PredefinedColorSpace { "srgb", "display-p3" }; +enum CanvasColorType { "unorm8", "float16" }; + enum CanvasFillRule { "nonzero", "evenodd" }; dictionary CanvasRenderingContext2DSettings { boolean alpha = true; boolean desynchronized = false; PredefinedColorSpace colorSpace = "srgb"; + CanvasColorType colorType = "unorm8"; boolean willReadFrequently = false; }; @@ -65663,6 +65666,10 @@ interface Path2D { specifies the color space of the rendering context.

+

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

+

If the willReadFrequently member is true, then the context is marked for Path2D { a string indicating the context's color space. +

  • colorType member is + a string indicating the context's color + type.
  • +
  • willReadFrequently member is true if the context is marked for readback optimization.
  • @@ -65820,6 +65831,19 @@ context.fillRect(100,0,50,50); // only this square remains
    +

    The CanvasColorType enumeration is used to specify the color type of the canvas's backing store.

    + +

    The "unorm8" value indicates that the type + for all color channels is 8-bit unsigned normalized.

    + +

    The "float16" value indicates that the type + for all color channels is 16-bit floating point.

    + +
    +

    The CanvasFillRule enumeration is used to select the fill rule algorithm by which to determine if a point is inside or outside a path.

    @@ -65962,6 +65986,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 color type setting of type + CanvasColorType. The CanvasSettings object's color type indicates the data type of the + color and alpha components of the pixels of the output bitmap.

    +

    To initialize a CanvasSettings output bitmap, given a CanvasSettings context and a CanvasRenderingContext2DSettings settings:

    @@ -65980,6 +66010,10 @@ context.fillRect(100,0,50,50); // only this square remains settings["colorSpace"].

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

  • +
  • Set context's will read frequently to settings[" this's desynchronized, "colorSpace" โ†’ this's color space, "colorType" โ†’ this's + color type, "willReadFrequently" โ†’ this's will read frequently ]ยป.

    @@ -71832,6 +71868,16 @@ interface OffscreenCanvasRenderingContext2D { data-x="dom-canvas-toBlob">toBlob() method to the canvas, given the appropriate dimensions, has no visible effect beyond, at most, clipping colors of the canvas to a more narrow gamut.

    +

    For image types that support multiple bit depths, the serialized image must use the bit depth + that best preserves content of the underlying bitmap.

    + +

    For example, when serializing a 2D context that has + color type of + float16 to type + "image/png", the resulting image would have 16 bits per sample. + This serialization will still lose significant detail (all values less than 0.5/65535 + would be clamped to 0, and all values greater than 1 would be clamped to 1).

    +

    If type is an image format that supports variable quality (such as "image/jpeg"), quality is given, and type is not "image/png", then, if quality is a Number @@ -71971,9 +72017,9 @@ interface OffscreenCanvasRenderingContext2D {

    As certain colors can only be represented under premultiplied alpha (for instance, additive colors), and others can only be represented under non-premultiplied alpha (for instance, "invisible" colors which hold certain red, green, and blue values even with no opacity); and - division and multiplication on 8-bit integers (which is how canvas's colors are currently stored) - entails a loss of precision, converting between premultiplied and non-premultiplied alpha is a - lossy operation on colors that are not fully opaque.

    + division and multiplication using finite precision entails a loss of accuracy, converting between + premultiplied and non-premultiplied alpha is a lossy operation on colors that are not fully + opaque.

    A CanvasRenderingContext2D's output bitmap and an OffscreenCanvasRenderingContext2D's output bitmap must use premultiplied