#607 BITSAVE silently treats unknown maxcolordepth inputs as 24

v_6.06x
open
nobody
None
5
2026-04-20
2026-04-20
No

BITSAVE has an optional input named "maxcolordepth" which is documented as

The maxcolordepth input is total number of colors in the bitmap in bits per pixel. That is, 1 = 2 colors, 4 = 16 colors, 8 = 256 colors, and 24 = 16.7 million colors. The default value is 24.

Any other integer value is treated as 24. For example:

(BITSAVE "bitmap.bmp 3)

Creates a bitmap file with 24 bits per pixel. This feels wrong to me. It's acceptable to have a default of 24 to mean "I'll do what I think is right in absence of specific direction", but if a programmer explicitly says they want the bitmap to be created with a maximum of 3 colors, FMSLogo shouldn't ignore them and create a true-color bitmap with 24 bpp. Since there's no such thing as 3 bpp bitmap file, it's more sensible to throw a "doesn't like input" error. This way, FMSLogo doesn't disobey the programmer and the programmer might learn something about bitmap files.

Note that this would be a breaking change and should only be done in a major version update.

Discussion


Log in to post a comment.