mirror of
https://github.com/nothings/stb
synced 2024-12-15 04:22:35 +03:00
tweak TGA monochrome support
This commit is contained in:
parent
caf6d08f2b
commit
7e079c670d
@ -178,8 +178,8 @@ int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *dat
|
||||
|
||||
int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
|
||||
{
|
||||
int has_alpha = !(comp & 1);
|
||||
int colorbytes = comp - has_alpha;
|
||||
int has_alpha = (comp == 2 || comp == 4);
|
||||
int colorbytes = has_alpha ? comp-1 : comp;
|
||||
int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3
|
||||
return outfile(filename, -1,-1, x, y, comp, (void *) data, has_alpha, 0,
|
||||
"111 221 2222 11", 0,0,format, 0,0,0, 0,0,x,y, (colorbytes+has_alpha)*8, has_alpha*8);
|
||||
|
Loading…
Reference in New Issue
Block a user