diff options
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/pdfapp.c | 10 | ||||
-rw-r--r-- | platform/x11/pdfapp.h | 1 | ||||
-rw-r--r-- | platform/x11/x11_main.c | 18 |
3 files changed, 28 insertions, 1 deletions
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index 00f085a4..4f05a496 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -122,6 +122,9 @@ void pdfapp_init(fz_context *ctx, pdfapp_t *app) #else app->colorspace = fz_device_rgb(ctx); #endif + app->tint_r = 255; + app->tint_g = 250; + app->tint_b = 240; } void pdfapp_invert(pdfapp_t *app, const fz_rect *rect) @@ -820,6 +823,8 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai } if (app->invert) fz_invert_pixmap(app->ctx, app->image); + if (app->tint) + fz_tint_pixmap(app->ctx, app->image, app->tint_r, app->tint_g, app->tint_b); } if (transition) @@ -1116,6 +1121,11 @@ void pdfapp_onkey(pdfapp_t *app, int c) pdfapp_showpage(app, 0, 1, 1, 0, 0); break; + case 'C': + app->tint ^= 1; + pdfapp_showpage(app, 0, 1, 1, 0, 0); + break; + case 'c': app->grayscale ^= 1; pdfapp_showpage(app, 0, 1, 1, 0, 0); diff --git a/platform/x11/pdfapp.h b/platform/x11/pdfapp.h index b2ff78da..81211181 100644 --- a/platform/x11/pdfapp.h +++ b/platform/x11/pdfapp.h @@ -64,6 +64,7 @@ struct pdfapp_s int grayscale; fz_colorspace *colorspace; int invert; + int tint, tint_r, tint_g, tint_b; /* presentation mode */ int presentation_mode; 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(); |