Add support for QOI image format#3554
Conversation
|
The reference implementation is a reasonable choice, but there are alternative implementations available (some offering much faster performance). The reference one is just that, a reference for others who want to implement the format. Is there any reason we shouldn't consider one of the alternative implementations here? |
|
Do you have an alternative implementation in mind? The ones listed in the official repo that would fit the C/C++ requirement are either C++20 or targeted at embedded applications or WIP. Most promising would be qoixx, but it‘s C++20. |
Ah, I didn't spot the C++20 requirement. That's a bit of a bummer, but maybe the reference implementation would suffice until v4 when the bump to C++20 happens for SFML. |
Yeah, I think this sounds reasonable. I'm not sure why the analyzers are still failing, I added a comment to suppress the Also, I'm not sure what to do about the formatter, as it keeps trying to put the qoi header in the middle of the STL headers, even with a line break in between, which seems to go against the recommended style. |
|
Okay, I think I accidentally removed the comment to supress that warning, I was sure I added it in the last commit. |
The correct fix here is to reconfigure the formatter by adding this header to the list of 3rd party headers here in the .clang-format file. This will ensure it gets put in its own section of Line 115 in f33deb2 |
Ah, I was referencing the style guidelines on the website, which state that dependency headers should always come before standard llibrary ones. I think it was unhappy because I didn't have them in alphabetical order, in that commit I ran the formatter again and it accepted it. |
|
Also note, I've rebased your PR to include the latest build fixes from master. You'll have to resync your local version with your GitHub repo |
eXpl0it3r
left a comment
There was a problem hiding this comment.
Will have to give this a try, but code looks good to me.
|
Rebased onto master and resolved the merge conflict and |
|
Test images render correctly
|
|
Thank you for implementing this! 🥳 |
|
Thank you @raineycat! <3 |

Description
This PR implements the image part of #2969. The
sf::Imageclass can now read and write .qoi files, and test cases have been aded for this.I used the reference implementation, since it was only a single header and fairly easy to implement.
Before trying to load using stb_image, the code just checks the first four bytes of the data it was given, if they match the QOI magic number it will continue trying to load it as a QOI image, otherwise it just falls back to STB.
Tasks