gb-image-decoder 0.0.2 → 0.0.3
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 +7 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +7 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -592,13 +592,18 @@ class RGBNDecoder {
|
|
|
592
592
|
return canvas;
|
|
593
593
|
}
|
|
594
594
|
maxTiles() {
|
|
595
|
-
return
|
|
595
|
+
return channels.reduce((acc, key) => {
|
|
596
|
+
const channel = this.channels[key];
|
|
597
|
+
return Math.max(acc, channel.tiles?.length || 0);
|
|
598
|
+
}, 0);
|
|
596
599
|
}
|
|
597
600
|
getHeight() {
|
|
598
601
|
return TILE_PIXEL_HEIGHT * Math.ceil(this.maxTiles() / TILES_PER_LINE);
|
|
599
602
|
}
|
|
600
603
|
}
|
|
601
604
|
|
|
605
|
+
const maxTiles = (rgbnTiles) => Math.max(...channels.map((key) => rgbnTiles[key]?.length || 0));
|
|
606
|
+
|
|
602
607
|
exports.BW_PALETTE = BW_PALETTE;
|
|
603
608
|
exports.BlendMode = BlendMode;
|
|
604
609
|
exports.Decoder = Decoder;
|
|
@@ -607,4 +612,5 @@ exports.RGBNDecoder = RGBNDecoder;
|
|
|
607
612
|
exports.blendModeNewName = blendModeNewName;
|
|
608
613
|
exports.decodeTile = decodeTile;
|
|
609
614
|
exports.getRGBValue = getRGBValue;
|
|
615
|
+
exports.maxTiles = maxTiles;
|
|
610
616
|
exports.tileIndexIsPartOfFrame = tileIndexIsPartOfFrame;
|
package/dist/index.d.cts
CHANGED
|
@@ -128,6 +128,8 @@ declare const getRGBValue: ({ pixels, index, tileIndex, handleExportFrame, lockF
|
|
|
128
128
|
|
|
129
129
|
declare const tileIndexIsPartOfFrame: (tileIndex: number, handleExportFrame?: ExportFrameMode) => boolean;
|
|
130
130
|
|
|
131
|
+
declare const maxTiles: (rgbnTiles: RGBNTiles) => number;
|
|
132
|
+
|
|
131
133
|
declare const BW_PALETTE: number[];
|
|
132
134
|
|
|
133
|
-
export { type BWPalette, BW_PALETTE, BlendMode, type ChangedTile, type Channel, type Channels, Decoder, ExportFrameMode, type IndexedTilePixels, RGBNDecoder, type RGBNPalette, type RGBNTiles, type RGBValue, type ScaledCanvasSize, type SourceCanvases, blendModeNewName, decodeTile, getRGBValue, tileIndexIsPartOfFrame };
|
|
135
|
+
export { type BWPalette, BW_PALETTE, BlendMode, type ChangedTile, type Channel, type Channels, Decoder, ExportFrameMode, type IndexedTilePixels, RGBNDecoder, type RGBNPalette, type RGBNTiles, type RGBValue, type ScaledCanvasSize, type SourceCanvases, blendModeNewName, decodeTile, getRGBValue, maxTiles, tileIndexIsPartOfFrame };
|
package/dist/index.d.mts
CHANGED
|
@@ -128,6 +128,8 @@ declare const getRGBValue: ({ pixels, index, tileIndex, handleExportFrame, lockF
|
|
|
128
128
|
|
|
129
129
|
declare const tileIndexIsPartOfFrame: (tileIndex: number, handleExportFrame?: ExportFrameMode) => boolean;
|
|
130
130
|
|
|
131
|
+
declare const maxTiles: (rgbnTiles: RGBNTiles) => number;
|
|
132
|
+
|
|
131
133
|
declare const BW_PALETTE: number[];
|
|
132
134
|
|
|
133
|
-
export { type BWPalette, BW_PALETTE, BlendMode, type ChangedTile, type Channel, type Channels, Decoder, ExportFrameMode, type IndexedTilePixels, RGBNDecoder, type RGBNPalette, type RGBNTiles, type RGBValue, type ScaledCanvasSize, type SourceCanvases, blendModeNewName, decodeTile, getRGBValue, tileIndexIsPartOfFrame };
|
|
135
|
+
export { type BWPalette, BW_PALETTE, BlendMode, type ChangedTile, type Channel, type Channels, Decoder, ExportFrameMode, type IndexedTilePixels, RGBNDecoder, type RGBNPalette, type RGBNTiles, type RGBValue, type ScaledCanvasSize, type SourceCanvases, blendModeNewName, decodeTile, getRGBValue, maxTiles, tileIndexIsPartOfFrame };
|
package/dist/index.d.ts
CHANGED
|
@@ -128,6 +128,8 @@ declare const getRGBValue: ({ pixels, index, tileIndex, handleExportFrame, lockF
|
|
|
128
128
|
|
|
129
129
|
declare const tileIndexIsPartOfFrame: (tileIndex: number, handleExportFrame?: ExportFrameMode) => boolean;
|
|
130
130
|
|
|
131
|
+
declare const maxTiles: (rgbnTiles: RGBNTiles) => number;
|
|
132
|
+
|
|
131
133
|
declare const BW_PALETTE: number[];
|
|
132
134
|
|
|
133
|
-
export { type BWPalette, BW_PALETTE, BlendMode, type ChangedTile, type Channel, type Channels, Decoder, ExportFrameMode, type IndexedTilePixels, RGBNDecoder, type RGBNPalette, type RGBNTiles, type RGBValue, type ScaledCanvasSize, type SourceCanvases, blendModeNewName, decodeTile, getRGBValue, tileIndexIsPartOfFrame };
|
|
135
|
+
export { type BWPalette, BW_PALETTE, BlendMode, type ChangedTile, type Channel, type Channels, Decoder, ExportFrameMode, type IndexedTilePixels, RGBNDecoder, type RGBNPalette, type RGBNTiles, type RGBValue, type ScaledCanvasSize, type SourceCanvases, blendModeNewName, decodeTile, getRGBValue, maxTiles, tileIndexIsPartOfFrame };
|
package/dist/index.mjs
CHANGED
|
@@ -590,11 +590,16 @@ class RGBNDecoder {
|
|
|
590
590
|
return canvas;
|
|
591
591
|
}
|
|
592
592
|
maxTiles() {
|
|
593
|
-
return
|
|
593
|
+
return channels.reduce((acc, key) => {
|
|
594
|
+
const channel = this.channels[key];
|
|
595
|
+
return Math.max(acc, channel.tiles?.length || 0);
|
|
596
|
+
}, 0);
|
|
594
597
|
}
|
|
595
598
|
getHeight() {
|
|
596
599
|
return TILE_PIXEL_HEIGHT * Math.ceil(this.maxTiles() / TILES_PER_LINE);
|
|
597
600
|
}
|
|
598
601
|
}
|
|
599
602
|
|
|
600
|
-
|
|
603
|
+
const maxTiles = (rgbnTiles) => Math.max(...channels.map((key) => rgbnTiles[key]?.length || 0));
|
|
604
|
+
|
|
605
|
+
export { BW_PALETTE, BlendMode, Decoder, ExportFrameMode, RGBNDecoder, blendModeNewName, decodeTile, getRGBValue, maxTiles, tileIndexIsPartOfFrame };
|