Skip to content
Myr

tweak TGA monochrome support

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 caf6d08 · Browse files · 1 file+2 added−2 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+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:stb_image_write.h+2 added-2 removed
176 unmodified lines
177}178179int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)180{181 int has_alpha = !(comp & 1);182 int colorbytes = comp - has_alpha;181 int has_alpha = (comp == 2 || comp == 4);182 int colorbytes = has_alpha ? comp-1 : comp;183 int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3184 return outfile(filename, -1,-1, x, y, comp, (void *) data, has_alpha, 0,185 "111 221 2222 11", 0,0,format, 0,0,0, 0,0,x,y, (colorbytes+has_alpha)*8, has_alpha*8);186}
333 unmodified lines