diff options
author | Bert Münnich <be.muennich@gmail.com> | 2013-08-22 12:59:05 +0200 |
---|---|---|
committer | Bert Münnich <be.muennich@gmail.com> | 2013-08-22 12:59:05 +0200 |
commit | 26a624a543f2e723550996d76d90ccbb7b954aeb (patch) | |
tree | 8799c977b965656ccea3c9ec14c7ba00f0204a0f | |
parent | fb6e4bdd980f72082a264894c12ed7e0650a5bf9 (diff) |
Added options for anti-alias & alpha layer coloring to config.def.h
Also removed now obsolete -p command line option; fixes issue #98
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | commands.c | 4 | ||||
-rw-r--r-- | config.def.h | 13 | ||||
-rw-r--r-- | image.c | 5 | ||||
-rw-r--r-- | options.c | 8 | ||||
-rw-r--r-- | options.h | 1 | ||||
-rw-r--r-- | sxiv.1 | 3 | ||||
-rw-r--r-- | thumbs.c | 3 |
8 files changed, 23 insertions, 15 deletions
@@ -80,7 +80,6 @@ of small previews is displayed, making it easy to choose an image to open. -n NUM Start at picture NUM -N NAME Set X window resource name to NAME -o Write list of marked files to stdout when quitting - -p Pixelize, i.e. turn off image anti-aliasing -q Be quiet, disable warnings -r Search given directories recursively for images -s Scale all images to fit into window @@ -74,8 +74,10 @@ bool it_quit(arg_t a) bool it_switch_mode(arg_t a) { if (mode == MODE_IMAGE) { - if (tns.thumbs == NULL) + if (tns.thumbs == NULL) { tns_init(&tns, filecnt, &win); + tns.alpha = img.alpha; + } img_close(&img, false); reset_timeout(reset_cursor); tns.sel = fileidx; diff --git a/config.def.h b/config.def.h index d24723d..f5d048a 100644 --- a/config.def.h +++ b/config.def.h @@ -53,6 +53,19 @@ enum { enum { THUMB_SIZE = 60 }; #endif +#ifdef _RENDER_CONFIG + +/* if false, pixelate images at zoom level != 100%, + * toggled with 'a' key binding + */ +static const bool RENDER_ANTI_ALIAS = true; + +/* if true, use white background for alpha layer, + * toggled with 'A' key binding + */ +static const bool RENDER_WHITE_ALPHA = false; + +#endif #ifdef _MAPPINGS_CONFIG /* keyboard mappings for image and thumbnail mode: */ @@ -18,6 +18,7 @@ #define _POSIX_C_SOURCE 200112L #define _IMAGE_CONFIG +#define _RENDER_CONFIG #include <stdlib.h> #include <string.h> @@ -62,8 +63,8 @@ void img_init(img_t *img, win_t *win) img->zoom = MIN(img->zoom, zoom_max); img->checkpan = false; img->dirty = false; - img->aa = options->aa; - img->alpha = true; + img->aa = RENDER_ANTI_ALIAS; + img->alpha = !RENDER_WHITE_ALPHA; img->multi.cap = img->multi.cnt = 0; img->multi.animate = false; } @@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options; void print_usage(void) { - printf("usage: sxiv [-bcdFfhiopqrstvZ] [-g GEOMETRY] [-n NUM] " + printf("usage: sxiv [-bcdFfhioqrstvZ] [-g GEOMETRY] [-n NUM] " "[-N name] [-z ZOOM] FILES...\n"); } @@ -53,7 +53,6 @@ void parse_options(int argc, char **argv) _options.scalemode = SCALE_MODE; _options.zoom = 1.0; - _options.aa = true; _options.fixed_win = false; _options.fullscreen = false; @@ -65,7 +64,7 @@ void parse_options(int argc, char **argv) _options.thumb_mode = false; _options.clean_cache = false; - while ((opt = getopt(argc, argv, "bcdFfg:hin:N:opqrstvZz:")) != -1) { + while ((opt = getopt(argc, argv, "bcdFfg:hin:N:oqrstvZz:")) != -1) { switch (opt) { case '?': print_usage(); @@ -109,9 +108,6 @@ void parse_options(int argc, char **argv) case 'o': _options.to_stdout = true; break; - case 'p': - _options.aa = false; - break; case 'q': _options.quiet = true; break; @@ -34,7 +34,6 @@ typedef struct { /* image: */ scalemode_t scalemode; float zoom; - bool aa; /* window: */ bool fixed_win; @@ -67,9 +67,6 @@ with .I \-i sxiv can be used as a visual filter/pipe. .TP -.B \-p -Pixelize images, i.e. turn off anti-aliasing. -.TP .B \-q Be quiet, disable warnings to standard error stream. .TP @@ -18,6 +18,7 @@ #define _POSIX_C_SOURCE 200112L #define _THUMBS_CONFIG +#define _RENDER_CONFIG #include <stdlib.h> #include <string.h> @@ -177,7 +178,7 @@ void tns_init(tns_t *tns, int cnt, win_t *win) tns->cap = cnt; tns->cnt = tns->first = tns->sel = 0; tns->win = win; - tns->alpha = true; + tns->alpha = !RENDER_WHITE_ALPHA; tns->dirty = false; if ((homedir = getenv("HOME")) != NULL) { |