rle tweaks, credits
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sean Barrett · committed by Sean Barrett · parent 40ace6b · Browse files · 1 file·+14 added−3 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+14 added−3 removed
- other:+14 added−3 removed
Provenance
- Commit
5bcce36- Tree
b748d21- Author
Sean Barrett <sean2@nothings.org>- Committer
Sean Barrett <sean2@nothings.org>- Parent
40ace6b
1 file changed+14 added−3 removed
modified:stb_image_write.h+14 added-3 removed
60 unmodified lines61 HDR expects linear float data. Since the format is always 32-bit rgb(e)62 data, alpha (if provided) is discarded, and for monochrome data it is63 replicated across all three channels.64 65+ TGA supports RLE or non-RLE compressed data. To use non-RLE-compressed66+ data, set the global variable 'stbi_write_tga_with_rle' to 0.67+68 CREDITS:69 70 PNG/BMP/TGA71 Sean Barrett2 unmodified lines74 TGA monochrome:75 Jean-Sebastien Guay76 misc enhancements:77 Tim Kelsey78+ TGA RLE79+ Alan Hickman80 bugfixes:81 github:Chribba82 Guillaume Chereau83 github:jry215 unmodified lines99 #ifdef STB_IMAGE_WRITE_STATIC100 #define STBIWDEF static101 #else102 #define STBIWDEF extern103+extern int stbi_write_tga_with_rle;104 #endif105 106 STBIWDEF int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes);107 STBIWDEF int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data);44 unmodified lines152 153 typedef unsigned int stbiw_uint32;154 typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1];155 150-static int stbi__write_tga_with_rle = 1;156 157+#ifdef STB_IMAGE_WRITE_STATIC158+static int stbi_write_tga_with_rle = 1;159+#else160+int stbi_write_tga_with_rle = 1;161+#endif162+163 static void writefv(FILE *f, const char *fmt, va_list v)164 {165 while (*fmt) {166 switch (*fmt++) {113 unmodified lines280 int colorbytes = has_alpha ? comp-1 : comp;281 int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3282 FILE *f;283 273- if (!stbi__write_tga_with_rle) {284+ if (!stbi_write_tga_with_rle) {285 return outfile(filename, -1, -1, x, y, comp, 0, (void *) data, has_alpha, 0,286 "111 221 2222 11", 0, 0, format, 0, 0, 0, 0, 0, x, y, (colorbytes + has_alpha) * 8, has_alpha * 8);287 }288 531 unmodified lines820 #endif // STB_IMAGE_WRITE_IMPLEMENTATION821 822 /* Revision history823 0.99 (2015-09-13)813- warning fixes824+ warning fixes; TGA rle support825 0.98 (2015-04-08)826 added STBIW_MALLOC, STBIW_ASSERT etc827 0.97 (2015-01-18)828 fixed HDR asserts, rewrote HDR rle logic15 unmodified lines