gb-image-decoder 0.1.7 → 0.1.8

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
@@ -384,19 +384,26 @@ class Decoder {
384
384
  for (let x = 0; x < TILE_PIXEL_WIDTH; x += 1) {
385
385
  for (let y = 0; y < TILE_PIXEL_HEIGHT; y += 1) {
386
386
  const rawIndex = (pixelXOffset + x + (pixelYOffset + y) * this.tilesPerLine * TILE_PIXEL_WIDTH) * 4;
387
- const color = getRGBValue({
388
- pixels,
389
- index: y * TILE_PIXEL_WIDTH + x,
390
- tileIndex: index,
391
- handleExportFrame: ExportFrameMode.FRAMEMODE_KEEP,
392
- invertPalette: this.invertPalette,
393
- lockFrame: this.lockFrame,
394
- colorData: this.colorData
395
- });
396
- this.rawImageData[rawIndex] = color.r;
397
- this.rawImageData[rawIndex + 1] = color.g;
398
- this.rawImageData[rawIndex + 2] = color.b;
399
- this.rawImageData[rawIndex + 3] = 255;
387
+ if (pixels !== null) {
388
+ const color = getRGBValue({
389
+ pixels,
390
+ index: y * TILE_PIXEL_WIDTH + x,
391
+ tileIndex: index,
392
+ handleExportFrame: ExportFrameMode.FRAMEMODE_KEEP,
393
+ invertPalette: this.invertPalette,
394
+ lockFrame: this.lockFrame,
395
+ colorData: this.colorData
396
+ });
397
+ this.rawImageData[rawIndex] = color.r;
398
+ this.rawImageData[rawIndex + 1] = color.g;
399
+ this.rawImageData[rawIndex + 2] = color.b;
400
+ this.rawImageData[rawIndex + 3] = 255;
401
+ } else {
402
+ this.rawImageData[rawIndex] = 0;
403
+ this.rawImageData[rawIndex + 1] = 0;
404
+ this.rawImageData[rawIndex + 2] = 0;
405
+ this.rawImageData[rawIndex + 3] = 0;
406
+ }
400
407
  }
401
408
  }
402
409
  }
package/dist/index.mjs CHANGED
@@ -382,19 +382,26 @@ class Decoder {
382
382
  for (let x = 0; x < TILE_PIXEL_WIDTH; x += 1) {
383
383
  for (let y = 0; y < TILE_PIXEL_HEIGHT; y += 1) {
384
384
  const rawIndex = (pixelXOffset + x + (pixelYOffset + y) * this.tilesPerLine * TILE_PIXEL_WIDTH) * 4;
385
- const color = getRGBValue({
386
- pixels,
387
- index: y * TILE_PIXEL_WIDTH + x,
388
- tileIndex: index,
389
- handleExportFrame: ExportFrameMode.FRAMEMODE_KEEP,
390
- invertPalette: this.invertPalette,
391
- lockFrame: this.lockFrame,
392
- colorData: this.colorData
393
- });
394
- this.rawImageData[rawIndex] = color.r;
395
- this.rawImageData[rawIndex + 1] = color.g;
396
- this.rawImageData[rawIndex + 2] = color.b;
397
- this.rawImageData[rawIndex + 3] = 255;
385
+ if (pixels !== null) {
386
+ const color = getRGBValue({
387
+ pixels,
388
+ index: y * TILE_PIXEL_WIDTH + x,
389
+ tileIndex: index,
390
+ handleExportFrame: ExportFrameMode.FRAMEMODE_KEEP,
391
+ invertPalette: this.invertPalette,
392
+ lockFrame: this.lockFrame,
393
+ colorData: this.colorData
394
+ });
395
+ this.rawImageData[rawIndex] = color.r;
396
+ this.rawImageData[rawIndex + 1] = color.g;
397
+ this.rawImageData[rawIndex + 2] = color.b;
398
+ this.rawImageData[rawIndex + 3] = 255;
399
+ } else {
400
+ this.rawImageData[rawIndex] = 0;
401
+ this.rawImageData[rawIndex + 1] = 0;
402
+ this.rawImageData[rawIndex + 2] = 0;
403
+ this.rawImageData[rawIndex + 3] = 0;
404
+ }
398
405
  }
399
406
  }
400
407
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gb-image-decoder",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Decoder classes for GameBoy-encoded images",
5
5
  "repository": "",
6
6
  "license": "MIT",