-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TRUECOLOR vs RGB8 #231
Comments
The fields have the same size as the described by the file format, but I'll probably change that for the next breaking version.
When decoding you're converting from |
Correct. The issue is that you can assign a spng_format to uint8_t color_type due to enum implicitly cast to int. It's much better if the static checker to throw an error in this case.
Thanks for the clarification. I understand the rational for having different types between encoding and decoding steps. I will try to clarify the point I was trying to make with truecolor. https://en.wikipedia.org/wiki/Color_depth#True_color_(24-bit)
Therefore, In my opinion something like: Makes it expressly clear that we are talking about a color type and a fmt type. Perhaps I will just make this a typedef for myself if you are not interested in changing the API. |
The standard uses the term "truecolor", at the time it made sense to use the exact same words. I wouldn't add something like
But they already start with |
Doesn't seem too far of a reach to have a COLOR_TYPE that combines the "truecolour"-ness and the 8 or 16 bit-ness in a single flag. That's just an observation. I see now that would be innovating on the standard a little bit. From a practical standpoint I was surprised to not see it is all. Take it for what it's worth. |
In the following struct,
Shouldn't
color_type
be of typeenum spng_color_type
rather thanuint8_t
?Also maybe this isn't a bug but it's worth noting that it's pretty confusing to have two different types
enum spng_color_type
andenum spng_format
that have names with identical meaning, but different enum values such asSPNG_COLOR_TYPE_TRUECOLOR_ALPHA
andSPNG_FMT_RGBA8
. The reason I mention this is because it is often tempting to do something like:int fmt = ihdr.color_type
But alas, you cannot and it takes awhile getting familiar with the API before you realize why it doesn't work.
The text was updated successfully, but these errors were encountered: