Skip to content

Commit

Permalink
Added clone
Browse files Browse the repository at this point in the history
  • Loading branch information
cmahnke committed Jul 9, 2024
1 parent 2c5ba71 commit 83614da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hdr-canvas",
"version": "0.0.3",
"version": "0.0.4",
"description": "HDR capable HTML canvas",
"main": "dist/hdr-canvas.js",
"files": [
Expand Down
8 changes: 7 additions & 1 deletion src/Uint16Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class Uint16Image {
this.data[pos + 3] = px[3];
}

// Only use this for aplha, since it doesn't to color space conversions
// Only use this for alpha, since it doesn't to color space conversions
static scaleUint8ToUint16(val: number): number {
return (val << 8) | val;
}
Expand Down Expand Up @@ -181,4 +181,10 @@ export class Uint16Image {
}
this.colorSpace = Uint16Image.DEFAULT_COLORSPACE;
}

clone(): Uint16Image {
const i = new Uint16Image(this.width, this.height, this.colorSpace);
i.data = this.data.slice();
return i;
}
}

0 comments on commit 83614da

Please sign in to comment.