summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2011-04-06 15:13:55 +0100
committerTor Andersson <tor.andersson@artifex.com>2011-04-06 16:42:33 +0200
commit72c4f265ad5659cace51190002dfde2ad1040608 (patch)
treef38d6cc9cf43c7a211a070912c0654f4572ee27d /apps
parent83bf72e448e26f5b9c77abf0e646ec75ffc04c98 (diff)
downloadmupdf-72c4f265ad5659cace51190002dfde2ad1040608.tar.xz
First cut at halftone support. Mono only, 16x16 default halftone.
Add fz_bitmaps (1bpc versions of pixmaps, really). Add fz_halftones (arrays of fz_pixmaps used as threshold arrays). Add simple halftoning code. Add pdfdraw usage of the above (ask for a .pbm and you get a halftoned image).
Diffstat (limited to 'apps')
-rw-r--r--apps/pdfdraw.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index baaac92c..69a7d3aa 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -186,6 +186,13 @@ static void drawpage(pdf_xref *xref, int pagenum)
fz_write_pam(pix, buf, savealpha);
else if (strstr(output, ".png"))
fz_write_png(pix, buf, savealpha);
+ else if (strstr(output, ".pbm")) {
+ fz_halftone *ht = fz_get_default_halftone(1);
+ fz_bitmap *bit = fz_halftone_pixmap(pix, ht);
+ fz_write_pbm(bit, buf);
+ fz_drop_bitmap(bit);
+ fz_drop_halftone(ht);
+ }
}
if (showmd5)
@@ -327,6 +334,8 @@ int main(int argc, char **argv)
colorspace = fz_device_gray;
if (output && strstr(output, ".ppm"))
colorspace = fz_device_rgb;
+ if (output && strstr(output, ".pbm"))
+ colorspace = fz_device_gray;
timing.count = 0;
timing.total = 0;