gb-image-decoder 0.1.4 → 0.1.5

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/dist/index.cjs CHANGED
@@ -233,7 +233,7 @@ class Decoder {
233
233
  }
234
234
  if (this.canvas.height !== newHeight || !this.rawImageData?.length) {
235
235
  this.canvas.height = newHeight;
236
- const newRawImageData = new Uint8ClampedArray(160 * newHeight * 4);
236
+ const newRawImageData = new Uint8ClampedArray(this.tilesPerLine * TILE_PIXEL_WIDTH * newHeight * 4);
237
237
  this.rawImageData?.forEach((value, index) => {
238
238
  newRawImageData[index] = value;
239
239
  });
@@ -249,7 +249,7 @@ class Decoder {
249
249
  return;
250
250
  }
251
251
  const context = this.canvas.getContext("2d");
252
- const imageData = new ImageData(this.rawImageData, 160, newHeight);
252
+ const imageData = new ImageData(this.rawImageData, this.tilesPerLine * TILE_PIXEL_WIDTH, newHeight);
253
253
  context?.putImageData(imageData, 0, 0);
254
254
  }
255
255
  getScaledCanvas(scaleFactor, handleExportFrame = ExportFrameMode.FRAMEMODE_KEEP) {
@@ -379,7 +379,7 @@ class Decoder {
379
379
  const pixelYOffset = TILE_PIXEL_HEIGHT * tileYOffset;
380
380
  for (let x = 0; x < TILE_PIXEL_WIDTH; x += 1) {
381
381
  for (let y = 0; y < TILE_PIXEL_HEIGHT; y += 1) {
382
- const rawIndex = (pixelXOffset + x + (pixelYOffset + y) * 160) * 4;
382
+ const rawIndex = (pixelXOffset + x + (pixelYOffset + y) * this.tilesPerLine * TILE_PIXEL_WIDTH) * 4;
383
383
  const color = getRGBValue({
384
384
  pixels,
385
385
  index: y * TILE_PIXEL_WIDTH + x,
package/dist/index.mjs CHANGED
@@ -231,7 +231,7 @@ class Decoder {
231
231
  }
232
232
  if (this.canvas.height !== newHeight || !this.rawImageData?.length) {
233
233
  this.canvas.height = newHeight;
234
- const newRawImageData = new Uint8ClampedArray(160 * newHeight * 4);
234
+ const newRawImageData = new Uint8ClampedArray(this.tilesPerLine * TILE_PIXEL_WIDTH * newHeight * 4);
235
235
  this.rawImageData?.forEach((value, index) => {
236
236
  newRawImageData[index] = value;
237
237
  });
@@ -247,7 +247,7 @@ class Decoder {
247
247
  return;
248
248
  }
249
249
  const context = this.canvas.getContext("2d");
250
- const imageData = new ImageData(this.rawImageData, 160, newHeight);
250
+ const imageData = new ImageData(this.rawImageData, this.tilesPerLine * TILE_PIXEL_WIDTH, newHeight);
251
251
  context?.putImageData(imageData, 0, 0);
252
252
  }
253
253
  getScaledCanvas(scaleFactor, handleExportFrame = ExportFrameMode.FRAMEMODE_KEEP) {
@@ -377,7 +377,7 @@ class Decoder {
377
377
  const pixelYOffset = TILE_PIXEL_HEIGHT * tileYOffset;
378
378
  for (let x = 0; x < TILE_PIXEL_WIDTH; x += 1) {
379
379
  for (let y = 0; y < TILE_PIXEL_HEIGHT; y += 1) {
380
- const rawIndex = (pixelXOffset + x + (pixelYOffset + y) * 160) * 4;
380
+ const rawIndex = (pixelXOffset + x + (pixelYOffset + y) * this.tilesPerLine * TILE_PIXEL_WIDTH) * 4;
381
381
  const color = getRGBValue({
382
382
  pixels,
383
383
  index: y * TILE_PIXEL_WIDTH + x,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gb-image-decoder",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Decoder classes for GameBoy-encoded images",
5
5
  "repository": "",
6
6
  "license": "MIT",