Loading Icons: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
mNo edit summary
(Don't link to ancient version of stb_image that doesn't even have the functions this references.)
Line 129: Line 129:
Using these is not a simple thing to do. Definitely more complex than those ca. 80 SLoC above. You could port libpng, libjpeg, etc. but that's not an easy task either. They usually have their dependencies on their own, including setjmp and longjmp, and it is not trivial to use libpng's API for example.
Using these is not a simple thing to do. Definitely more complex than those ca. 80 SLoC above. You could port libpng, libjpeg, etc. but that's not an easy task either. They usually have their dependencies on their own, including setjmp and longjmp, and it is not trivial to use libpng's API for example.


Instead, use [https://web.archive.org/web/20070923112451/http://nothings.org/stb_image.h stb_image.h]. This is a single header file (no library linking needed, just libc), which is easy to use, for example the code to load PNG images looks like this:
Instead, use [https://github.com/nothings/stb/blob/master/stb_image.h stb_image.h]. This is a single header file (no library linking needed, just libc), which is easy to use, for example the code to load PNG images looks like this:
<source lang="c">
<source lang="c">
#define STBI_IMPLEMENTATION
#define STBI_IMPLEMENTATION