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.
@@ -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 };
@@ -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", { colorSpace: Uint16Image.DEFAULT_COLORSPACE, pixelFormat: 'float16' });
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