From d1b59f97d881dc1eff561ded212f9d2a52de9b01 Mon Sep 17 00:00:00 2001 From: Perminder Singh <127239756+perminder-17@users.noreply.github.com> Date: Sat, 12 Apr 2025 22:15:21 +0530 Subject: [PATCH 1/3] p2hdr --- src/core/environment.js | 1 + 1 file changed, 1 insertion(+) 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. From 0e9bc0078009ada91552e18dcdfe1e8be6523f03 Mon Sep 17 00:00:00 2001 From: Perminder Singh <127239756+perminder-17@users.noreply.github.com> Date: Sat, 12 Apr 2025 22:17:23 +0530 Subject: [PATCH 2/3] p2hdr --- src/core/constants.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/core/constants.js b/src/core/constants.js index 26489c2239..10a3ee285c 100644 --- a/src/core/constants.js +++ b/src/core/constants.js @@ -15,14 +15,28 @@ 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 {@link p5.createCanvas|createCanvas} (for example, + * `createCanvas(400, 400, P2D)`) to specify a 2D context. + * + * @typedef {'p2d'} P2D * @property {P2D} P2D * @final */ export const P2D = 'p2d'; -export const P2DHDR = 'p2d-hdr'; +/** + * 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 {@link p5.P2D}: + * `createCanvas(400, 400, P2DHDR)`. + * + * @typedef {'p2d-hdr'} P2DHDR + * @property {P2DHDR} P2DHDR + * @final + */ /** * One of the two render modes in p5.js, used for computationally intensive tasks like 3D rendering and shaders. From 4cc25ddf8db1fee4bd50c5efb9a2595f0b9c0fb2 Mon Sep 17 00:00:00 2001 From: Perminder Singh <127239756+perminder-17@users.noreply.github.com> Date: Sun, 20 Apr 2025 02:56:00 +0530 Subject: [PATCH 3/3] fixing as per suggestions --- src/core/constants.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/constants.js b/src/core/constants.js index 10a3ee285c..942b48c9ad 100644 --- a/src/core/constants.js +++ b/src/core/constants.js @@ -17,7 +17,7 @@ export const VERSION = 'VERSION_WILL_BE_REPLACED_BY_BUILD'; /** * The default, two-dimensional renderer in p5.js. * - * Use this when calling {@link p5.createCanvas|createCanvas} (for example, + * Use this when calling (for example, * `createCanvas(400, 400, P2D)`) to specify a 2D context. * * @typedef {'p2d'} P2D @@ -30,7 +30,7 @@ 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 {@link p5.P2D}: + * dynamic color representation. Use it similarly to `P2D`: * `createCanvas(400, 400, P2DHDR)`. * * @typedef {'p2d-hdr'} P2DHDR @@ -38,6 +38,8 @@ export const P2D = 'p2d'; * @final */ +export const P2DHDR = 'p2d-hdr'; + /** * One of the two render modes in p5.js, used for computationally intensive tasks like 3D rendering and shaders. *