aboutsummaryrefslogtreecommitdiffstats
path: root/src/blind-colour-ciexyz.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-09-24 01:26:08 +0200
committerMattias Andrée <maandree@kth.se>2017-09-24 01:31:31 +0200
commitbcac04b4316d64063e743e7a49195173a0c175a0 (patch)
treefc29431d21d83e4496da31d32f4f441de41026be /src/blind-colour-ciexyz.c
parentFix colour distortion (diff)
downloadblind-bcac04b4316d64063e743e7a49195173a0c175a0.tar.gz
blind-bcac04b4316d64063e743e7a49195173a0c175a0.tar.bz2
blind-bcac04b4316d64063e743e7a49195173a0c175a0.tar.xz
Add -% to blind-to-text, blind-colour-srgb, and blind-colour-ciexyz
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/blind-colour-ciexyz.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/blind-colour-ciexyz.c b/src/blind-colour-ciexyz.c
index 9710074..17dec5a 100644
--- a/src/blind-colour-ciexyz.c
+++ b/src/blind-colour-ciexyz.c
@@ -1,20 +1,34 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
-USAGE("(X Y Z | Y)")
+USAGE("[-% format] (X Y Z | Y)")
int
main(int argc, char *argv[])
{
double X, Y, Z;
+ const char *fmt = NULL;
- UNOFLAGS(0);
+ ARGBEGIN {
+ case '%':
+ fmt = UARGF();
+ break;
+ default:
+ usage();
+ } ARGEND;
if (argc == 1) {
+ fmt = select_print_format("%! %! %!\n", DOUBLE, fmt);
Y = etolf_arg("the Y value", argv[0]);
X = Y * D65_XYZ_X;
Z = Y * D65_XYZ_Z;
- printf("%.50lf %.50lf %.50lf\n", X, Y, Z);
+ printf(fmt, X, Y, Z);
+ } else if (argc == 3 && fmt) {
+ fmt = select_print_format("%! %! %!\n", DOUBLE, fmt);
+ X = etolf_arg("the X value", argv[0]);
+ Y = etolf_arg("the Y value", argv[1]);
+ Z = etolf_arg("the Z value", argv[2]);
+ printf(fmt, X, Y, Z);
} else if (argc == 3) {
printf("%s %s %s\n", argv[0], argv[1], argv[2]);
} else {