diff options
author | Christian C <cc@localhost> | 2025-03-05 13:22:37 -0800 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-03-05 13:22:37 -0800 |
commit | 3a61b957905ed1952f6ec15f684a03bf0f55a2ba (patch) | |
tree | d3a0ec65d6693cb82c98deb61e0caac960aae0ca /src/main.c | |
parent | 18f1ffd5da6e032f5ce461cda216a1cfa4474413 (diff) |
Dump output to file
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -6,6 +6,7 @@ #include <lib/lib.h> #include <lib/bool.h> #include <lib/dir.h> +#include <lib/file.h> #include <lib/time.h> #include <lib/color.h> #include <lib/algo/flood_fill.h> @@ -80,7 +81,9 @@ int main(int argc, char** argv) // This assumes 4096 (2^12) > labels for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x++) { - masks[x + y*width] |= 0xFF000000; + /// RGBA channels: Move labels to RGB + masks[x + y*width] <<= 4; + masks[x + y*width] |= 0x000F; } } //----------------------------------------------- @@ -139,6 +142,14 @@ int main(int argc, char** argv) } if (masks != NULL) { + for (size_t y = 0; y < height; y++) { + for (size_t x = 0; x < width; x++) { + /// Restore labels from RGBA + masks[x + y*width] &= 0xFFF0; + masks[x + y*width] >>= 4; + } + } + write_array("../out.bin", masks, width*height*sizeof(uint16_t)); free(masks); } CloseWindow(); |