Added options for anti-alias & alpha layer coloring to config.def.h

Also removed now obsolete -p command line option; fixes issue #98
This commit is contained in:
Bert Münnich 2013-08-22 12:59:05 +02:00
parent fb6e4bdd98
commit 26a624a543
8 changed files with 23 additions and 15 deletions

View file

@ -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 NUM Start at picture NUM
-N NAME Set X window resource name to NAME -N NAME Set X window resource name to NAME
-o Write list of marked files to stdout when quitting -o Write list of marked files to stdout when quitting
-p Pixelize, i.e. turn off image anti-aliasing
-q Be quiet, disable warnings -q Be quiet, disable warnings
-r Search given directories recursively for images -r Search given directories recursively for images
-s Scale all images to fit into window -s Scale all images to fit into window

View file

@ -74,8 +74,10 @@ bool it_quit(arg_t a)
bool it_switch_mode(arg_t a) bool it_switch_mode(arg_t a)
{ {
if (mode == MODE_IMAGE) { if (mode == MODE_IMAGE) {
if (tns.thumbs == NULL) if (tns.thumbs == NULL) {
tns_init(&tns, filecnt, &win); tns_init(&tns, filecnt, &win);
tns.alpha = img.alpha;
}
img_close(&img, false); img_close(&img, false);
reset_timeout(reset_cursor); reset_timeout(reset_cursor);
tns.sel = fileidx; tns.sel = fileidx;

View file

@ -52,6 +52,19 @@ enum {
/* default dimension of thumbnails (width == height): */ /* default dimension of thumbnails (width == height): */
enum { THUMB_SIZE = 60 }; 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 #endif
#ifdef _MAPPINGS_CONFIG #ifdef _MAPPINGS_CONFIG

View file

@ -18,6 +18,7 @@
#define _POSIX_C_SOURCE 200112L #define _POSIX_C_SOURCE 200112L
#define _IMAGE_CONFIG #define _IMAGE_CONFIG
#define _RENDER_CONFIG
#include <stdlib.h> #include <stdlib.h>
#include <string.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->zoom = MIN(img->zoom, zoom_max);
img->checkpan = false; img->checkpan = false;
img->dirty = false; img->dirty = false;
img->aa = options->aa; img->aa = RENDER_ANTI_ALIAS;
img->alpha = true; img->alpha = !RENDER_WHITE_ALPHA;
img->multi.cap = img->multi.cnt = 0; img->multi.cap = img->multi.cnt = 0;
img->multi.animate = false; img->multi.animate = false;
} }

View file

@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options;
void print_usage(void) 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"); "[-N name] [-z ZOOM] FILES...\n");
} }
@ -53,7 +53,6 @@ void parse_options(int argc, char **argv)
_options.scalemode = SCALE_MODE; _options.scalemode = SCALE_MODE;
_options.zoom = 1.0; _options.zoom = 1.0;
_options.aa = true;
_options.fixed_win = false; _options.fixed_win = false;
_options.fullscreen = false; _options.fullscreen = false;
@ -65,7 +64,7 @@ void parse_options(int argc, char **argv)
_options.thumb_mode = false; _options.thumb_mode = false;
_options.clean_cache = 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) { switch (opt) {
case '?': case '?':
print_usage(); print_usage();
@ -109,9 +108,6 @@ void parse_options(int argc, char **argv)
case 'o': case 'o':
_options.to_stdout = true; _options.to_stdout = true;
break; break;
case 'p':
_options.aa = false;
break;
case 'q': case 'q':
_options.quiet = true; _options.quiet = true;
break; break;

View file

@ -34,7 +34,6 @@ typedef struct {
/* image: */ /* image: */
scalemode_t scalemode; scalemode_t scalemode;
float zoom; float zoom;
bool aa;
/* window: */ /* window: */
bool fixed_win; bool fixed_win;

3
sxiv.1
View file

@ -67,9 +67,6 @@ with
.I \-i .I \-i
sxiv can be used as a visual filter/pipe. sxiv can be used as a visual filter/pipe.
.TP .TP
.B \-p
Pixelize images, i.e. turn off anti-aliasing.
.TP
.B \-q .B \-q
Be quiet, disable warnings to standard error stream. Be quiet, disable warnings to standard error stream.
.TP .TP

View file

@ -18,6 +18,7 @@
#define _POSIX_C_SOURCE 200112L #define _POSIX_C_SOURCE 200112L
#define _THUMBS_CONFIG #define _THUMBS_CONFIG
#define _RENDER_CONFIG
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -177,7 +178,7 @@ void tns_init(tns_t *tns, int cnt, win_t *win)
tns->cap = cnt; tns->cap = cnt;
tns->cnt = tns->first = tns->sel = 0; tns->cnt = tns->first = tns->sel = 0;
tns->win = win; tns->win = win;
tns->alpha = true; tns->alpha = !RENDER_WHITE_ALPHA;
tns->dirty = false; tns->dirty = false;
if ((homedir = getenv("HOME")) != NULL) { if ((homedir = getenv("HOME")) != NULL) {