diff --git a/src/core/constants.js b/src/core/constants.js index 26489c2239..942b48c9ad 100644 --- a/src/core/constants.js +++ b/src/core/constants.js @@ -15,13 +15,29 @@ export const VERSION = 'VERSION_WILL_BE_REPLACED_BY_BUILD'; // GRAPHICS RENDERER /** - * The default, two-dimensional renderer. - * @typedef {unique symbol} P2D + * The default, two-dimensional renderer in p5.js. + * + * Use this when calling (for example, + * `createCanvas(400, 400, P2D)`) to specify a 2D context. + * + * @typedef {'p2d'} P2D * @property {P2D} P2D * @final */ export const P2D = 'p2d'; +/** + * A high-dynamic-range (HDR) variant of the default, two-dimensional renderer. + * + * When available, this mode can allow for extended color ranges and more + * dynamic color representation. Use it similarly to `P2D`: + * `createCanvas(400, 400, P2DHDR)`. + * + * @typedef {'p2d-hdr'} P2DHDR + * @property {P2DHDR} P2DHDR + * @final + */ + export const P2DHDR = 'p2d-hdr'; /** diff --git a/src/core/environment.js b/src/core/environment.js index 6936d04f52..4256bb090f 100644 --- a/src/core/environment.js +++ b/src/core/environment.js @@ -514,6 +514,7 @@ function environment(p5, fn){ * - `WEBGL2` whose value is `'webgl2'`, * - `WEBGL` whose value is `'webgl'`, or * - `P2D` whose value is `'p2d'`. This is the default for 2D sketches. + * - `P2DHDR` whose value is `'p2d-hdr'` (used for HDR 2D sketches, if available). * * See setAttributes() for ways to set the * WebGL version.