Validate battle UI icon PNG color mode
This commit is contained in:
@@ -54,6 +54,9 @@ function validateBattleUiIconAtlas(errors, manifest) {
|
|||||||
if (dimensions.width !== expectedWidth || dimensions.height !== expectedHeight) {
|
if (dimensions.width !== expectedWidth || dimensions.height !== expectedHeight) {
|
||||||
errors.push(`battle UI icon atlas is ${dimensions.width}x${dimensions.height}, expected ${expectedWidth}x${expectedHeight}`);
|
errors.push(`battle UI icon atlas is ${dimensions.width}x${dimensions.height}, expected ${expectedWidth}x${expectedHeight}`);
|
||||||
}
|
}
|
||||||
|
if (dimensions.bitDepth !== 8 || dimensions.colorType !== 6) {
|
||||||
|
errors.push(`battle UI icon atlas must be 8-bit RGBA PNG color type 6, got bitDepth=${dimensions.bitDepth} colorType=${dimensions.colorType}`);
|
||||||
|
}
|
||||||
|
|
||||||
const frameLimit = manifest.columns * manifest.rows;
|
const frameLimit = manifest.columns * manifest.rows;
|
||||||
Object.entries(manifest.frames).forEach(([key, frame]) => {
|
Object.entries(manifest.frames).forEach(([key, frame]) => {
|
||||||
@@ -129,7 +132,9 @@ function readPngDimensions(path) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
width: bytes.readUInt32BE(16),
|
width: bytes.readUInt32BE(16),
|
||||||
height: bytes.readUInt32BE(20)
|
height: bytes.readUInt32BE(20),
|
||||||
|
bitDepth: bytes[24],
|
||||||
|
colorType: bytes[25]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user