summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gen_test_tga.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/gen_test_tga.cc b/tools/gen_test_tga.cc
new file mode 100644
index 0000000..7414eea
--- /dev/null
+++ b/tools/gen_test_tga.cc
@@ -0,0 +1,35 @@
+#include <cstdio>
+#include <cstdint>
+
+int main() {
+ FILE* f = fopen("assets/final/test_image.tga", "wb");
+ if (!f) return 1;
+
+ // TGA Header (Uncompressed True-Color, 2x2, 32-bit)
+ uint8_t header[18] = {
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, // Width: 2 (LE)
+ 2, 0, // Height: 2 (LE)
+ 32, // Depth: 32 bit
+ 0x28 // Descriptor: Top-Left origin, 8-bit alpha
+ };
+ fwrite(header, 1, 18, f);
+
+ // Pixel Data (BGRA order for TGA usually, but let's see what stbi expects/returns)
+ // stbi converts to requested format (RGBA).
+ // Let's write BGRA:
+ // Pixel 0 (0,0): Red -> 00 00 FF FF
+ // Pixel 1 (1,0): Green -> 00 FF 00 FF
+ // Pixel 2 (0,1): Blue -> FF 00 00 FF
+ // Pixel 3 (1,1): White -> FF FF FF FF
+
+ uint8_t pixels[] = {
+ 0x00, 0x00, 0xFF, 0xFF, // Red
+ 0x00, 0xFF, 0x00, 0xFF, // Green
+ 0xFF, 0x00, 0x00, 0xFF, // Blue
+ 0xFF, 0xFF, 0xFF, 0xFF // White
+ };
+ fwrite(pixels, 1, sizeof(pixels), f);
+ fclose(f);
+ return 0;
+}