summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--commands.c4
-rw-r--r--config.def.h13
-rw-r--r--image.c5
-rw-r--r--options.c8
-rw-r--r--options.h1
-rw-r--r--sxiv.13
-rw-r--r--thumbs.c3
8 files changed, 23 insertions, 15 deletions
diff --git a/README.md b/README.md
index fe0711d..cda09ee 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/commands.c b/commands.c
index 501a938..09ba926 100644
--- a/commands.c
+++ b/commands.c
@@ -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: */
diff --git a/image.c b/image.c
index cc93cd8..ec248e1 100644
--- a/image.c
+++ b/image.c
@@ -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;
}
diff --git a/options.c b/options.c
index 2d35992..e47ad37 100644
--- a/options.c
+++ b/options.c
@@ -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;
diff --git a/options.h b/options.h
index d60bc9a..848a6b2 100644
--- a/options.h
+++ b/options.h
@@ -34,7 +34,6 @@ typedef struct {
/* image: */
scalemode_t scalemode;
float zoom;
- bool aa;
/* window: */
bool fixed_win;
diff --git a/sxiv.1 b/sxiv.1
index 8a03404..ee42a00 100644
--- a/sxiv.1
+++ b/sxiv.1
@@ -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
diff --git a/thumbs.c b/thumbs.c
index 48b3a75..ec6e5ef 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -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) {