diff --git a/extras/cabi/README.md b/extras/cabi/README.md index b6b8462..f68be19 100644 --- a/extras/cabi/README.md +++ b/extras/cabi/README.md @@ -77,10 +77,13 @@ given and a non-zero exit code will be returned. ## Input file decoding -The input file should be a PNG file containing the image to be converted. The -image will be translated to a raw array of 32 bit RGBA (Red, Green, Blue, Alpha) -pixels internally before being processed to output. Ideally, pixels that are to -be drawn (represented as a 1 in the image output) should be fully white. +The input file should be a PNG file containing the image to be converted. +The height of the image must be a multiple of 8 pixels (8, 16, 24, 32, ...). +The width can be any size. + +The image will be translated to a raw array of 32 bit RGBA (Red, Green, Blue, +Alpha) pixels internally before being processed to output. Ideally, pixels that +are to be drawn (represented as a 1 in the image output) should be fully white. Non-drawn (0) pixels should be fully black. Pixels intended to be masked out of the image (represented as a 0 in both the image and mask output), should be fully transparent and their color doesn't matter. diff --git a/extras/cabi/cabi.c b/extras/cabi/cabi.c index ae88575..31f1bca 100644 --- a/extras/cabi/cabi.c +++ b/extras/cabi/cabi.c @@ -11,7 +11,7 @@ https://www.lexaloffle.com/bbs/?uid=1 https://twitter.com/lexaloffle Contributed to Team A.R.G. -Modifications by Scott Allen - July 2016 +Modifications by Scott Allen - July 2020, September 2020 To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain @@ -332,6 +332,12 @@ int main(int argc, char **argv) exit(result); } + if (h % 8 != 0) { + printf("error 120: file %s: image height must be a multiple of 8 but is %u\n", argv[1], h); + free(bmp); + exit(120); + } + // generate sprite and mask rawlen = w * (h+7) / 8;