aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yawa.c44
-rw-r--r--src/yawa.h16
2 files changed, 17 insertions, 43 deletions
diff --git a/src/yawa.c b/src/yawa.c
index f8dae01..453421a 100644
--- a/src/yawa.c
+++ b/src/yawa.c
@@ -100,17 +100,17 @@ parse_opt(signed key, char *arg, struct argp_state *state)
case 'o':
arguments->contrast = true;
- arguments->contrast_amount = parse_uint(arg, "contrast amount");
+ arguments->contrast_amount = parse_double(arg, "contrast amount");
break;
case 'B':
arguments->brightness = true;
- arguments->brightness_amount = parse_uint(arg, "brightness amount");
+ arguments->brightness_amount = parse_double(arg, "brightness amount");
break;
case 'G':
arguments->gamma = true;
- arguments->gamma_amount = parse_uint(arg, "gamma amount");
+ arguments->gamma_amount = parse_double(arg, "gamma amount");
break;
case 'v':
@@ -328,7 +328,7 @@ main(signed argc, char **argv)
imlib_context_set_blend(1);
if (arguments.alpha) {
- alpha = arguments.alpha;
+ alpha = (signed)arguments.alpha_amount;
} else {
alpha = 255;
}
@@ -414,45 +414,19 @@ main(signed argc, char **argv)
imlib_set_color_modifier_tables(r, g, b, a);
}
if (arguments.blur) {
- int intval;
- if (sscanf(argv[i], "%i", &intval) == 0) {
- fprintf(stderr, "Bad value (%s)\n", argv[i]);
- continue;
- }
-
- imlib_image_blur(intval);
+ imlib_image_blur((signed)arguments.blur_radius);
}
if (arguments.sharpen) {
- int intval;
- if (sscanf(argv[i], "%i", &intval) == 0) {
- fprintf(stderr, "Bad value (%s)\n", argv[i]);
- continue;
- }
- imlib_image_sharpen(intval);
+ imlib_image_sharpen((signed)arguments.sharpen_radius);
}
if (arguments.contrast) {
- double dblval;
- if (sscanf(argv[i], "%lf", &dblval) == 0) {
- fprintf(stderr, "Bad value (%s)\n", argv[i]);
- continue;
- }
- imlib_modify_color_modifier_contrast(dblval);
+ imlib_modify_color_modifier_contrast(arguments.contrast_amount);
}
if (arguments.brightness) {
- double dblval;
- if (sscanf(argv[i], "%lf", &dblval) == 0) {
- fprintf(stderr, "Bad value (%s)\n", argv[i]);
- continue;
- }
- imlib_modify_color_modifier_brightness(dblval);
+ imlib_modify_color_modifier_brightness(arguments.brightness_amount);
}
if (arguments.gamma) {
- double dblval;
- if (sscanf(argv[i], "%lf", &dblval) == 0) {
- fprintf(stderr, "Bad value (%s)\n", argv[i]);
- continue;
- }
- imlib_modify_color_modifier_gamma(dblval);
+ imlib_modify_color_modifier_gamma(arguments.gamma_amount);
}
if (arguments.flipv) {
diff --git a/src/yawa.h b/src/yawa.h
index e9cc2c8..458050b 100644
--- a/src/yawa.h
+++ b/src/yawa.h
@@ -40,9 +40,9 @@ struct arguments {
signed angle;
unsigned blur_radius;
unsigned sharpen_radius;
- unsigned contrast_amount;
- unsigned brightness_amount;
- unsigned gamma_amount;
+ double contrast_amount;
+ double brightness_amount;
+ double gamma_amount;
unsigned alpha_amount;
bool add: 1;
@@ -89,11 +89,11 @@ static struct argp_option options[] = {
{0, 0, 0, 0, "Manipulations:", 4},
{"tint", 'T', "COLOR", 0, "Tint current image", 4},
- {"blur", 'b', "RADIUS", 0, "Blur the current image", 4}, // Not implemented
- {"sharpen", 'S', "RADIUS", 0, "Sharpen the current image", 4}, // Not implemented
- {"contrast", 'o', "AMOUNT", 0, "Adjust the contrast of the current image", 4}, // Not implemented
- {"brightness", 'B', "AMOUNT", 0, "Adjust the bightness of the current image", 4}, // Not implemented
- {"gamma", 'G', "AMOUNT", 0, "Adjust the gamma level of the current image", 4}, // Not implemented
+ {"blur", 'b', "RADIUS", 0, "Blur the current image", 4},
+ {"sharpen", 'S', "RADIUS", 0, "Sharpen the current image", 4},
+ {"contrast", 'o', "AMOUNT", 0, "Adjust the contrast of the current image", 4},
+ {"brightness", 'B', "AMOUNT", 0, "Adjust the bightness of the current image", 4},
+ {"gamma", 'G', "AMOUNT", 0, "Adjust the gamma level of the current image", 4},
{"flipv", 'v', 0, 0, "Flip the current image vertically", 4},
{"fliph", 'h', 0, 0, "Flip the current image horizontally", 4},
{"flipd", 'd', 0, 0, "Flip the current image diagonally", 4},