PaintWorkletGlobalScope Class

The global object of a paint worklet (https://drafts.css-houdini.org/css-paint-api-1/#paintworkletglobalscope): the scripts added to CSS.paintWorklet register the classes that paint the paint() images.

public sealed class PaintWorkletGlobalScope : WorkletGlobalScope
Inheritance
WorkletGlobalScope PaintWorkletGlobalScope

Properties

NameDescription
DevicePixelRatioGets the number of device pixels per CSS pixel of the document (https://drafts.css-houdini.org/css-paint-api-1/#dom-paintworkletglobalscope-devicepixelratio), as window.devicePixelRatio.

Gets the number of device pixels per CSS pixel of the document (https://drafts.css-houdini.org/css-paint-api-1/#dom-paintworkletglobalscope-devicepixelratio), as window.devicePixelRatio.

public double DevicePixelRatio { get; }

Methods

NameDescription
RegisterPaint(string, WorkletClassConstructor)Registers a class that paints the paint() images (https://drafts.css-houdini.org/css-paint-api-1/#dom-paintworkletglobalscope-registerpaint).

RegisterPaint(string, WorkletClassConstructor)

PaintWorkletGlobalScope.cs

Registers a class that paints the paint() images (https://drafts.css-houdini.org/css-paint-api-1/#dom-paintworkletglobalscope-registerpaint).

public void RegisterPaint(string name, WorkletClassConstructor paintCtor)

Parameters

name string
The name of the paint.
paintCtor WorkletClassConstructor
The class: its static inputProperties, inputArguments and contextOptions properties are read once, and its prototype has the paint callback.

Exceptions

TypeErrorException
The name is empty, an input argument is not a syntax definition, the value is not a constructor, or its prototype has no paint function.
DomException
An InvalidModificationError when the name is already registered in the global scope.

See also