Skip to content

Commit 4cb0ca0

Browse files
authored
Merge pull request #7728 from perminder-17/patch-8
P2HDR docs
2 parents cd80ae3 + 4cc25dd commit 4cb0ca0

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/core/constants.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,29 @@ export const VERSION = 'VERSION_WILL_BE_REPLACED_BY_BUILD';
1515

1616
// GRAPHICS RENDERER
1717
/**
18-
* The default, two-dimensional renderer.
19-
* @typedef {unique symbol} P2D
18+
* The default, two-dimensional renderer in p5.js.
19+
*
20+
* Use this when calling <a href="#/p5/createCanvas"> (for example,
21+
* `createCanvas(400, 400, P2D)`) to specify a 2D context.
22+
*
23+
* @typedef {'p2d'} P2D
2024
* @property {P2D} P2D
2125
* @final
2226
*/
2327
export const P2D = 'p2d';
2428

29+
/**
30+
* A high-dynamic-range (HDR) variant of the default, two-dimensional renderer.
31+
*
32+
* When available, this mode can allow for extended color ranges and more
33+
* dynamic color representation. Use it similarly to `P2D`:
34+
* `createCanvas(400, 400, P2DHDR)`.
35+
*
36+
* @typedef {'p2d-hdr'} P2DHDR
37+
* @property {P2DHDR} P2DHDR
38+
* @final
39+
*/
40+
2541
export const P2DHDR = 'p2d-hdr';
2642

2743
/**

src/core/environment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ function environment(p5, fn){
514514
* - `WEBGL2` whose value is `'webgl2'`,
515515
* - `WEBGL` whose value is `'webgl'`, or
516516
* - `P2D` whose value is `'p2d'`. This is the default for 2D sketches.
517+
* - `P2DHDR` whose value is `'p2d-hdr'` (used for HDR 2D sketches, if available).
517518
*
518519
* See <a href="#/p5/setAttributes">setAttributes()</a> for ways to set the
519520
* WebGL version.

0 commit comments

Comments
 (0)