mirror of https://github.com/MLXXXp/Arduboy2.git
Add image height check to cabi.c
An image converted using the cabi utility must have a height that is a multiple of 8 pixels. An error is now reported if not. Also, the README.md file for cabi was updated with this requirement.
This commit is contained in:
parent
2baca75689
commit
500d81abb7
|
@ -77,10 +77,13 @@ given and a non-zero exit code will be returned.
|
||||||
|
|
||||||
## Input file decoding
|
## Input file decoding
|
||||||
|
|
||||||
The input file should be a PNG file containing the image to be converted. The
|
The input file should be a PNG file containing the image to be converted.
|
||||||
image will be translated to a raw array of 32 bit RGBA (Red, Green, Blue, Alpha)
|
The height of the image must be a multiple of 8 pixels (8, 16, 24, 32, ...).
|
||||||
pixels internally before being processed to output. Ideally, pixels that are to
|
The width can be any size.
|
||||||
be drawn (represented as a 1 in the image output) should be fully white.
|
|
||||||
|
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
|
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
|
the image (represented as a 0 in both the image and mask output), should be
|
||||||
fully transparent and their color doesn't matter.
|
fully transparent and their color doesn't matter.
|
||||||
|
|
|
@ -11,7 +11,7 @@ https://www.lexaloffle.com/bbs/?uid=1
|
||||||
https://twitter.com/lexaloffle
|
https://twitter.com/lexaloffle
|
||||||
Contributed to Team A.R.G.
|
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
|
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
|
and related and neighboring rights to this software to the public domain
|
||||||
|
@ -332,6 +332,12 @@ int main(int argc, char **argv)
|
||||||
exit(result);
|
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
|
// generate sprite and mask
|
||||||
|
|
||||||
rawlen = w * (h+7) / 8;
|
rawlen = w * (h+7) / 8;
|
||||||
|
|
Loading…
Reference in New Issue