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
WorkletGlobalScopePaintWorkletGlobalScope
Properties
| Name | Description |
|---|---|
| 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. |
DevicePixelRatio
PaintWorkletGlobalScope.csGets 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
| Name | Description |
|---|---|
| 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.csRegisters 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
namestring- The name of the paint.
paintCtorWorkletClassConstructor- The class: its static
inputProperties,inputArgumentsandcontextOptionsproperties are read once, and its prototype has thepaintcallback.
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
paintfunction. DomException- An
InvalidModificationErrorwhen the name is already registered in the global scope.