summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2017-03-11 17:15:50 -0600
committerRobin Watts <robin.watts@artifex.com>2017-03-14 16:49:42 +0000
commit4c8f6f696882cb4a924c483dfe5a734c7b41de0f (patch)
treeb79a5237908a78663568dab6bda73af8b4a61e78 /source/tools
parentdcb24ee85ff4b2c6061801e39f5a46c11f74167b (diff)
downloadmupdf-4c8f6f696882cb4a924c483dfe5a734c7b41de0f.tar.xz
Recast TGA output as a band writer.
Annoyingly TGA requires lines to be written from bottom to top, so require callers to flip the image. Also fix TGA to cope with alpha or not. Update mutool draw to use band writer interface for TGA.
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/mudraw.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 74d7c3e2..46609542 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -636,6 +636,12 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
fz_bound_page(ctx, page, &bounds);
zoom = resolution / 72;
fz_pre_scale(fz_rotate(&ctm, rotation), zoom, zoom);
+
+ if (output_format == OUT_TGA)
+ {
+ fz_pre_scale(fz_pre_translate(&ctm, 0, -height), 1, -1);
+ }
+
tbounds = bounds;
fz_round_rect(&ibounds, fz_transform_rect(&tbounds, &ctm));
@@ -749,6 +755,8 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
bander = fz_new_pkm_band_writer(ctx, out);
else if (output_format == OUT_PS)
bander = fz_new_ps_band_writer(ctx, out);
+ else if (output_format == OUT_TGA)
+ bander = fz_new_tga_band_writer(ctx, out, colorspace == fz_device_bgr(ctx));
else if (output_format == OUT_PCL)
{
if (out_cs == CS_MONO)
@@ -781,8 +789,6 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
fz_write_band(ctx, bander, bit ? bit->stride : pix->stride, drawheight, bit ? bit->samples : pix->samples);
else if (output_format == OUT_PWG)
fz_write_pixmap_as_pwg(ctx, out, pix, NULL);
- else if (output_format == OUT_TGA)
- fz_write_pixmap_as_tga(ctx, out, pix);
fz_drop_bitmap(ctx, bit);
bit = NULL;
}