MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / stbi_write_hdr_core

Function stbi_write_hdr_core

include/stb_image_write.h:604–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, float *data)
605{
606 if (y <= 0 || x <= 0 || data == NULL)
607 return 0;
608 else {
609 // Each component is stored separately. Allocate scratch space for full output scanline.
610 unsigned char *scratch = (unsigned char *) STBIW_MALLOC(x*4);
611 int i, len;
612 char buffer[128];
613 char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n";
614 s->func(s->context, header, sizeof(header)-1);
615
616 len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
617 s->func(s->context, buffer, len);
618
619 for(i=0; i < y; i++)
620 stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*i*x);
621 STBIW_FREE(scratch);
622 return 1;
623 }
624}
625
626int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data)
627{

Callers 2

stbi_write_hdr_to_funcFunction · 0.85
stbi_write_hdrFunction · 0.85

Calls 1

Tested by

no test coverage detected