image_write_test.c
This file
Path
tests/image_write_test.c
60 lines · 1.8 KiB · C
Last changed by
Merge branch 'master' into workingSean Barrettbefore adoptiond940053
History of this fileTake it
The walk stopped after 200 commits: lines older than aeec66c point at it.
Merge branch 'master' into workingSean Barrettbefore adoptiond940053
lines 1–3why, one step back1#ifdef __clang__2#define STBIWDEF static inline3#endifupdate tests and project files for stb_dsSean Barrettbefore adoptione704ed0
line 4why, one step back4#define STB_IMAGE_WRITE_STATICMerge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c
lines 5–19why, one step back5#define STB_IMAGE_WRITE_IMPLEMENTATION6#include "stb_image_write.h"78// using an 'F' since it has no rotational symmetries, and 6x59// because it's a small, atypical size likely to trigger edge cases.10//11// conveniently, it's also small enough to fully fit inside a typical12// directory listing thumbnail, which simplifies checking at a glance.13static const char img6x5_template[] =14 ".****."15 ".*...."16 ".***.."17 ".*...."18 ".*....";19update tests and project files for stb_dsSean Barrettbefore adoptione704ed0
line 20why, one step back20void image_write_test(void)Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c
lines 21–38why, one step back21{22 // make a RGB version of the template image23 // use red on blue to detect R<->B swaps24 unsigned char img6x5_rgb[6*5*3];25 float img6x5_rgbf[6*5*3];26 int i;2728 for (i = 0; i < 6*5; i++) {29 int on = img6x5_template[i] == '*';30 img6x5_rgb[i*3 + 0] = on ? 255 : 0;31 img6x5_rgb[i*3 + 1] = 0;32 img6x5_rgb[i*3 + 2] = on ? 0 : 255;3334 img6x5_rgbf[i*3 + 0] = on ? 1.0f : 0.0f;35 img6x5_rgbf[i*3 + 1] = 0.0f;36 img6x5_rgbf[i*3 + 2] = on ? 0.0f : 1.0f;37 }38update tests and project files for stb_dsSean Barrettbefore adoptione704ed0
lines 39–43why, one step back39 stbi_write_png("output/wr6x5_regular.png", 6, 5, 3, img6x5_rgb, 6*3);40 stbi_write_bmp("output/wr6x5_regular.bmp", 6, 5, 3, img6x5_rgb);41 stbi_write_tga("output/wr6x5_regular.tga", 6, 5, 3, img6x5_rgb);42 stbi_write_jpg("output/wr6x5_regular.jpg", 6, 5, 3, img6x5_rgb, 95);43 stbi_write_hdr("output/wr6x5_regular.hdr", 6, 5, 3, img6x5_rgbf);Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c
lines 44–46why, one step back4445 stbi_flip_vertically_on_write(1);46update tests and project files for stb_dsSean Barrettbefore adoptione704ed0
lines 47–52why, one step back47 stbi_write_png("output/wr6x5_flip.png", 6, 5, 3, img6x5_rgb, 6*3);48 stbi_write_bmp("output/wr6x5_flip.bmp", 6, 5, 3, img6x5_rgb);49 stbi_write_tga("output/wr6x5_flip.tga", 6, 5, 3, img6x5_rgb);50 stbi_write_jpg("output/wr6x5_flip.jpg", 6, 5, 3, img6x5_rgb, 95);51 stbi_write_hdr("output/wr6x5_flip.hdr", 6, 5, 3, img6x5_rgbf);52}Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c
line 53why, one step back53update tests and project files for stb_dsSean Barrettbefore adoptione704ed0
lines 54–57why, one step back54#ifdef IWT_TEST55int main(int argc, char **argv)56{57 image_write_test();Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c
lines 58–59why, one step back58 return 0;59}update tests and project files for stb_dsSean Barrettbefore adoptione704ed0
line 60why, one step back60#endif