summaryrefslogtreecommitdiff
path: root/platform/x11/x11_main.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-08-20 11:33:55 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-08-20 11:33:55 +0200
commit61de1fe7e510fdd425686c478439209f6f7a4b73 (patch)
treeef6994ceb17a14e29b5b2dc20e7b5bfc58e0f2dc /platform/x11/x11_main.c
parent44efa7e4a451793dd2357a65c92bc47719da1ad2 (diff)
downloadmupdf-61de1fe7e510fdd425686c478439209f6f7a4b73.tar.xz
Add full-page color tinting option and key binding to X11 viewer.
win32 supports tinting, but cannot change the color from the default.
Diffstat (limited to 'platform/x11/x11_main.c')
-rw-r--r--platform/x11/x11_main.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/platform/x11/x11_main.c b/platform/x11/x11_main.c
index d3f3d368..908850eb 100644
--- a/platform/x11/x11_main.c
+++ b/platform/x11/x11_main.c
@@ -791,6 +791,7 @@ static void usage(void)
fprintf(stderr, "\t-b -\tset anti-aliasing quality in bits (0=off, 8=best)\n");
fprintf(stderr, "\t-p -\tpassword\n");
fprintf(stderr, "\t-r -\tresolution\n");
+ fprintf(stderr, "\t-C -\tRRGGBB (tint color in hexadecimal syntax)\n");
exit(1);
}
@@ -811,6 +812,7 @@ int main(int argc, char **argv)
struct timeval now;
struct timeval *timeout;
struct timeval tmo_advance_delay;
+ int tint, tint_r, tint_g, tint_b;
ctx = fz_new_context(NULL, NULL, FZ_STORE_DEFAULT);
if (!ctx)
@@ -819,10 +821,17 @@ int main(int argc, char **argv)
exit(1);
}
- while ((c = fz_getopt(argc, argv, "p:r:b:")) != -1)
+ while ((c = fz_getopt(argc, argv, "p:r:b:C:")) != -1)
{
switch (c)
{
+ case 'C':
+ c = strtol(fz_optarg, NULL, 16);
+ tint = 1;
+ tint_r = (c >> 16) & 255;
+ tint_g = (c >> 8) & 255;
+ tint_b = (c) & 255;
+ break;
case 'p': password = fz_optarg; break;
case 'r': resolution = atoi(fz_optarg); break;
case 'b': fz_set_aa_level(ctx, atoi(fz_optarg)); break;
@@ -839,6 +848,13 @@ int main(int argc, char **argv)
pageno = atoi(argv[fz_optind++]);
pdfapp_init(ctx, &gapp);
+ if (tint)
+ {
+ gapp.tint = tint;
+ gapp.tint_r = tint_r;
+ gapp.tint_g = tint_g;
+ gapp.tint_b = tint_b;
+ }
winopen();