about summary refs log tree commit diff
path: root/dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/dump.c b/dump.c
index 5ad4456..474af92 100644
--- a/dump.c
+++ b/dump.c
@@ -15,6 +15,7 @@
  */
 
 #include <err.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sysexits.h>
@@ -26,12 +27,14 @@
 
 int main(int argc, char *argv[]) {
 	enum Cards_Flags flags = 0;
+	bool invert = false;
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "abk"))) {
+	while (0 < (opt = getopt(argc, argv, "abik"))) {
 		switch (opt) {
 			break; case 'a': flags |= Cards_AlphaCorners;
 			break; case 'b': flags |= Cards_BlackBorders;
+			break; case 'i': invert = true;
 			break; case 'k': flags |= Cards_ColorKey;
 			break; default:  return EX_USAGE;
 		}
@@ -49,6 +52,11 @@ int main(int argc, char *argv[]) {
 	if (!cards) errx(EX_DATAERR, "Cards_Load: %s", SDL_GetError());
 	SDL_RWclose(rw);
 
+	if (invert) {
+		int error = Cards_Invert(cards);
+		if (error) errx(EX_DATAERR, "Cards_Invert: %s", SDL_GetError());
+	}
+
 	for (int i = 0; i < Cards_Count; ++i) {
 		if (!cards->surfaces[i]) continue;
 		char name[sizeof("00.bmp")];