MCPcopy Create free account
hub / github.com/RenderKit/embree / stbi_write_bmp_core

Function stbi_write_bmp_core

tutorials/common/image/stb_image_write.h:492–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490}
491
492static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, const void *data)
493{
494 if (comp != 4) {
495 // write RGB bitmap
496 int pad = (-x*3) & 3;
497 return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad,
498 "11 4 22 4" "4 44 22 444444",
499 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
500 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
501 } else {
502 // RGBA bitmaps need a v4 header
503 // use BI_BITFIELDS mode with 32bpp and alpha mask
504 // (straight BI_RGB with alpha mask doesn't work in most readers)
505 return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *)data,1,0,
506 "11 4 22 4" "4 44 22 444444 4444 4 444 444 444 444",
507 'B', 'M', 14+108+x*y*4, 0, 0, 14+108, // file header
508 108, x,y, 1,32, 3,0,0,0,0,0, 0xff0000,0xff00,0xff,0xff000000u, 0, 0,0,0, 0,0,0, 0,0,0, 0,0,0); // bitmap V4 header
509 }
510}
511
512STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
513{

Callers 2

stbi_write_bmp_to_funcFunction · 0.85
stbi_write_bmpFunction · 0.85

Calls 1

stbiw__outfileFunction · 0.85

Tested by

no test coverage detected