diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-03-19 12:00:27 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-03-19 12:00:27 +0000 |
commit | f6f34747ce072f30a15dfc5390833741ff8c56fc (patch) | |
tree | c9db3c2023ff0f3d51c7d0a8033afac2406ec585 | |
parent | eeb1b4fffb5ee88d251d2773d9ae0fc1f8316b56 (diff) | |
download | mupdf-f6f34747ce072f30a15dfc5390833741ff8c56fc.tar.xz |
Add simple 'inverted color' mode for mupdf viewer.
Use 'i' to toggle inversion of the rendered MuPDF bitmap, giving
simple 'white on black' mode.
-rw-r--r-- | apps/man/mupdf.1 | 5 | ||||
-rw-r--r-- | apps/pdfapp.c | 8 | ||||
-rw-r--r-- | apps/pdfapp.h | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/apps/man/mupdf.1 b/apps/man/mupdf.1 index c96bc22d..7a21e7f4 100644 --- a/apps/man/mupdf.1 +++ b/apps/man/mupdf.1 @@ -1,4 +1,4 @@ -.TH MUPDF 1 "January 27, 2012" +.TH MUPDF 1 "March 19, 2012" .\" Please adjust this date whenever revising the manpage. .SH NAME mupdf \- MuPDF is a lightweight PDF viewer written in portable C @@ -78,6 +78,9 @@ Find the next/previous search result. .TP .B c Toggle between color and grayscale rendering. +.TP +.B i +Toggle between normal and inverted color rendering. .SH SEE ALSO .BR mupdfclean (1), .BR mupdfdraw (1), diff --git a/apps/pdfapp.c b/apps/pdfapp.c index 217a3346..2cd669a6 100644 --- a/apps/pdfapp.c +++ b/apps/pdfapp.c @@ -67,6 +67,7 @@ char *pdfapp_usage(pdfapp_t *app) "n\t\t-- find next search result\n" "N\t\t-- find previous search result\n" "c\t\t-- toggle between color and grayscale\n" + "i\t\t-- toggle inverted color mode\n" ; } @@ -338,6 +339,8 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai idev = fz_new_draw_device(app->ctx, app->image); fz_run_display_list(app->page_list, idev, ctm, bbox, NULL); fz_free_device(idev); + if (app->invert) + fz_invert_pixmap(app->ctx, app->image); } if (repaint) @@ -728,6 +731,11 @@ void pdfapp_onkey(pdfapp_t *app, int c) pdfapp_showpage(app, 0, 1, 1); break; + case 'i': + app->invert ^= 1; + pdfapp_showpage(app, 0, 1, 1); + break; + #ifndef NDEBUG case 'a': app->rotate -= 15; diff --git a/apps/pdfapp.h b/apps/pdfapp.h index db83335f..6812323b 100644 --- a/apps/pdfapp.h +++ b/apps/pdfapp.h @@ -46,6 +46,7 @@ struct pdfapp_s int rotate; fz_pixmap *image; int grayscale; + int invert; /* current page params */ int pageno; |