hdr-canvas 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # `hdr-canvas`
2
2
 
3
- This Module contains a collection of functions and classes to work with the HDR support for HTML `canvas` elements i chrome based browsers. This should only be considered as proof of concept or alpha code, don't use it in production environments.
3
+ This module contains a collection of functions and classes to work with the HDR support for HTML `canvas` elements in chromium based (like Chrome, Edge, Opera and Brave) browsers.
4
4
 
5
- ## Perfomance
5
+ **This should only be considered as proof of concept or alpha code, don't use it in production environments!**
6
6
 
7
- This module is intended as a proof of concept (PoC), especially operations on the `ImageData` arrays are not optimized, e.g. quite slow.
7
+ **Especially operations on the `ImageData` arrays are not optimized, e.g. quite slow.**
8
8
 
9
9
  # Feature detection
10
10
 
@@ -28,6 +28,8 @@ if (checkHDRCanvas()) {
28
28
  }
29
29
  ```
30
30
 
31
+ This can be useful to add a warning (using the [`fillText()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillText) method) to the canvas if it doesn't support HDR content.
32
+
31
33
  ## Example `checkHDRCanvas()`
32
34
 
33
35
  ```javascript
@@ -106,6 +108,10 @@ Use it as you'll do with a `WebGPURenderer`.
106
108
  renderer = new HDRWebGPURenderer({ canvas: canvas, antialias: true });
107
109
  ```
108
110
 
111
+ # Example
112
+
113
+ See [this](https://christianmahnke.de/en/post/hdr-image-analysis/) blog post for an example in action, requires a Chromium based browser (like Chrome, Edge, Opera and Brave) and a HDR-enable monitor.
114
+
109
115
  ---
110
116
 
111
117
  # TODO
@@ -115,3 +121,6 @@ The following things might be improved:
115
121
  - Try to detect change of screen for HDR detection
116
122
  - Improve speed
117
123
  - Provide WebWorker
124
+ - Documentation
125
+ - Link to browser HDR support
126
+ - Document `Uint16Image`
@@ -5934,9 +5934,10 @@ function checkHDRCanvas() {
5934
5934
  }
5935
5935
  }
5936
5936
 
5937
+ const hdr_options = { colorSpace: Uint16Image.DEFAULT_COLORSPACE, pixelFormat: 'float16' };
5937
5938
  function initHDRCanvas(canvas) {
5938
5939
  canvas.configureHighDynamicRange({ mode: 'extended' });
5939
- const ctx = canvas.getContext("2d", { colorSpace: Uint16Image.DEFAULT_COLORSPACE, pixelFormat: 'float16' });
5940
+ const ctx = canvas.getContext("2d", hdr_options);
5940
5941
  return ctx;
5941
5942
  }
5942
5943