Skip to content
Myr

Merge branch 'master' of https://github.com/Skylark13/stb into working

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 · parents b36f990, ebc2d23 · Browse files · 1 file+6 added−4 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+6 added−4 removed

  • other:+6 added−4 removed

1 file+6 added−4 removed

modified:stb_image_write.h+6 added-4 removed
40 unmodified lines
41 For PNG, "stride_in_bytes" is the distance in bytes from the first byte of42 a row of pixels to the first byte of the next row of pixels.4344 PNG creates output files with the same number of components as the input.45 The BMP and TGA formats expand Y to RGB in the file format. BMP does not45 The BMP format expands Y to RGB in the file format and does not46 output alpha.47 48 PNG supports writing rectangles of data even when the bytes storing rows of49 data are not consecutive in memory (e.g. sub-rectangles of a larger image),
77 unmodified lines
127 unsigned char *d = (unsigned char *) data + (j*x+i)*comp;128 if (write_alpha < 0)129 fwrite(&d[comp-1], 1, 1, f);130 switch (comp) {131 case 1:132 case 2: write3(f, d[0],d[0],d[0]);131 case 1: 132 case 2: fwrite(d, 1, 1, f);133 break;134 case 4:135 if (!write_alpha) {136 // composite against pink background
41 unmodified lines
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;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,183 "111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha);185 "111 221 2222 11", 0,0,format, 0,0,0, 0,0,x,y, (colorbytes+has_alpha)*8, has_alpha*8);186}187188// stretchy buffer; stbiw__sbpush() == vector<>::push_back() -- stbiw__sbcount() == vector<>::size()189#define stbiw__sbraw(a) ((int *) (a) - 2)
330 unmodified lines