There are several kinds of possible input formats for the encoding. However, non-8bpc colors would require an overhaul to the BMP header writing.
I briefly considered an implementation that would automatically derive from the input buffer size and image dimensions the presence of the fourth byte; and throw an error if the dimensions and size are incompatible. While the added safety would probably have been a good thing for many users, I guess there might be some funkier uses of buffers which would break. Plus, the parameter at least makes it clear what is supported.
So, here is the ”put new functionality behind a flag” approach to avoid changing anything for past users.
There are several kinds of possible input formats for the encoding. However, non-8bpc colors would require an overhaul to the BMP header writing.
I briefly considered an implementation that would automatically derive from the input buffer size and image dimensions the presence of the fourth byte; and throw an error if the dimensions and size are incompatible. While the added safety would probably have been a good thing for many users, I guess there might be some funkier uses of buffers which would break. Plus, the parameter at least makes it clear what is supported.
So, here is the ”put new functionality behind a flag” approach to avoid changing anything for past users.