summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2013-09-25 17:05:45 +0200
committerRobin Watts <robin.watts@artifex.com>2013-09-27 17:09:48 +0100
commitc301f0b3b493935fcf1d7ff58543486b7c6b2773 (patch)
treede2cd90c3a3d58b5dd2777b3afe01855d6e7a83f /source/tools
parent728034546726798d8a31fcb046846b662f5073b5 (diff)
downloadmupdf-c301f0b3b493935fcf1d7ff58543486b7c6b2773.tar.xz
add support for .tga output to mudraw
SumatraPDF's testsuite uses Targa images as output because they're compressed while still far easier to compare than PNG and have better tool support than PCL/PWG.
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/mudraw.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 81222993..c95be5e3 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -14,7 +14,7 @@
enum { TEXT_PLAIN = 1, TEXT_HTML = 2, TEXT_XML = 3 };
-enum { OUT_PNG, OUT_PPM, OUT_PNM, OUT_PAM, OUT_PGM, OUT_PBM, OUT_SVG, OUT_PWG, OUT_PCL, OUT_PDF };
+enum { OUT_PNG, OUT_PPM, OUT_PNM, OUT_PAM, OUT_PGM, OUT_PBM, OUT_SVG, OUT_PWG, OUT_PCL, OUT_PDF, OUT_TGA };
enum { CS_INVALID, CS_UNSET, CS_MONO, CS_GRAY, CS_GRAYALPHA, CS_RGB, CS_RGBA };
@@ -36,6 +36,7 @@ static const suffix_t suffix_table[] =
{ ".pwg", OUT_PWG },
{ ".pcl", OUT_PCL },
{ ".pdf", OUT_PDF },
+ { ".tga", OUT_TGA },
};
typedef struct
@@ -77,7 +78,8 @@ static const format_cs_table_t format_cs_table[] =
{ OUT_SVG, CS_RGB, { CS_RGB } },
{ OUT_PWG, CS_RGB, { CS_MONO, CS_GRAY, CS_RGB } },
{ OUT_PCL, CS_MONO, { CS_MONO } },
- { OUT_PDF, CS_RGB, { CS_RGB } }
+ { OUT_PDF, CS_RGB, { CS_RGB } },
+ { OUT_TGA, CS_RGB, { CS_GRAY, CS_GRAYALPHA, CS_RGB, CS_RGBA } },
};
/*
@@ -183,7 +185,7 @@ static void usage(void)
"usage: mudraw [options] input [pages]\n"
"\t-o -\toutput filename (%%d for page number)\n"
"\t-F -\toutput format (if no -F, -o will be examined)\n"
- "\t\tsupported formats: pgm, ppm, pam, png, pbm\n"
+ "\t\tsupported formats: pgm, ppm, pam, png, pbm, tga\n"
"\t-p -\tpassword\n"
"\t-r -\tresolution in dpi (default: 72)\n"
"\t-w -\twidth (in pixels) (maximum width if -r is specified)\n"
@@ -758,6 +760,10 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_write_pbm(ctx, bit, filename_buf);
fz_drop_bitmap(ctx, bit);
}
+ else if (output_format == OUT_TGA)
+ {
+ fz_write_tga(ctx, pix, filename_buf, savealpha);
+ }
}
ctm.f -= drawheight;
}