hdr-canvas 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +12 -3
- package/dist/hdr-canvas.cjs +21 -1
- package/dist/hdr-canvas.cjs.map +1 -1
- package/dist/hdr-canvas.d.ts +3 -1
- package/dist/hdr-canvas.js +20 -2
- package/dist/hdr-canvas.js.map +1 -1
- package/dist/hdr-canvas.min.js +1 -1
- package/dist/hdr-canvas.min.js.map +1 -1
- package/package.json +2 -2
- package/src/@types/HDRCanvas.d.ts +1 -0
- package/src/hdr-canvas.ts +24 -1
- package/src/index.ts +1 -1
package/dist/hdr-canvas.d.ts
CHANGED
@@ -29,5 +29,7 @@ declare function checkHDR(): boolean;
|
|
29
29
|
declare function checkHDRCanvas(): boolean;
|
30
30
|
|
31
31
|
declare function initHDRCanvas(canvas: HDRHTMLCanvasElement): RenderingContext | null;
|
32
|
+
declare function defaultGetContextHDR(): void;
|
33
|
+
declare function resetGetContext(): void;
|
32
34
|
|
33
|
-
export { Uint16Image, checkHDR, checkHDRCanvas, initHDRCanvas };
|
35
|
+
export { Uint16Image, checkHDR, checkHDRCanvas, defaultGetContextHDR, initHDRCanvas, resetGetContext };
|
package/dist/hdr-canvas.js
CHANGED
@@ -5932,11 +5932,29 @@ function checkHDRCanvas() {
|
|
5932
5932
|
}
|
5933
5933
|
}
|
5934
5934
|
|
5935
|
+
const hdr_options = { colorSpace: Uint16Image.DEFAULT_COLORSPACE, pixelFormat: 'float16' };
|
5935
5936
|
function initHDRCanvas(canvas) {
|
5936
5937
|
canvas.configureHighDynamicRange({ mode: 'extended' });
|
5937
|
-
const ctx = canvas.getContext("2d",
|
5938
|
+
const ctx = canvas.getContext("2d", hdr_options);
|
5938
5939
|
return ctx;
|
5939
5940
|
}
|
5941
|
+
function defaultGetContextHDR() {
|
5942
|
+
HTMLCanvasElement.prototype._getContext = HTMLCanvasElement.prototype.getContext;
|
5943
|
+
HTMLCanvasElement.prototype.getContext = function (type, options) {
|
5944
|
+
if (options !== undefined) {
|
5945
|
+
options = Object.assign({}, options, hdr_options);
|
5946
|
+
}
|
5947
|
+
else {
|
5948
|
+
options = hdr_options;
|
5949
|
+
}
|
5950
|
+
return this._getContext(type, options);
|
5951
|
+
};
|
5952
|
+
}
|
5953
|
+
function resetGetContext() {
|
5954
|
+
if (typeof HTMLCanvasElement.prototype._getContext === "function") {
|
5955
|
+
HTMLCanvasElement.prototype.getContext = HTMLCanvasElement.prototype._getContext;
|
5956
|
+
}
|
5957
|
+
}
|
5940
5958
|
|
5941
|
-
export { Uint16Image, checkHDR, checkHDRCanvas, initHDRCanvas };
|
5959
|
+
export { Uint16Image, checkHDR, checkHDRCanvas, defaultGetContextHDR, initHDRCanvas, resetGetContext };
|
5942
5960
|
//# sourceMappingURL=hdr-canvas.js.map
|