]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/imagelib.c
new modes for minimap: -black = black on transparent, -white = white on transparent...
[xonotic/netradiant.git] / tools / quake3 / common / imagelib.c
index 5971d8101d69cc34d54f6ed8d67f4cf054d5c2c0..9e52f1ed1a74dbe24efa1ad9234b1a6e2ec371c3 100644 (file)
@@ -1181,6 +1181,26 @@ void WriteTGA (const char *filename, byte *data, int width, int height) {
        free (buffer);
 }
 
+void WriteTGAGray (const char *filename, byte *data, int width, int height) {
+       byte    buffer[18];
+       int             i;
+       int             c;
+       FILE    *f;
+
+       memset (buffer, 0, 18);
+       buffer[2] = 3;          // uncompressed type
+       buffer[12] = width&255;
+       buffer[13] = width>>8;
+       buffer[14] = height&255;
+       buffer[15] = height>>8;
+       buffer[16] = 8; // pixel size
+
+       f = fopen (filename, "wb");
+       fwrite (buffer, 1, 18, f);
+       fwrite (data, 1, width * height, f);
+       fclose (f);
+}
+
 /*
 ============================================================================