//red-cyan Dubois
unsigned char* dubois_rc(unsigned char *out, const unsigned char *l, const unsigned char *r){
- out[0] = (unsigned char)mm((456*(int)l[0] + 500*(int)l[1] + 176*(int)l[2] +
+ out[0] = (unsigned char) mm((456*(int)l[0] + 500*(int)l[1] + 176*(int)l[2] +
-43*(int)r[0] + -88*(int)r[1] + -2*(int)r[2]) / 1000, 0, 255);
- out[1] = (unsigned char)mm((-40*(int)l[0] + -38*(int)l[1] + -16*(int)l[2] +
+ out[1] = (unsigned char) mm((-40*(int)l[0] + -38*(int)l[1] + -16*(int)l[2] +
378*(int)r[0] + 734*(int)r[1] + -18*(int)r[2]) / 1000, 0, 255);
- out[2] = (unsigned char)mm((-15*(int)l[0] + -21*(int)l[1] + -5*(int)l[2] +
+ out[2] = (unsigned char) mm((-15*(int)l[0] + -21*(int)l[1] + -5*(int)l[2] +
-72*(int)r[0] +-113*(int)r[1] + 1226*(int)r[2]) / 1000, 0, 255);
return out;
}
return out;
}
-//magenta-cyan "Dubois"
-unsigned char* dubois_mc(unsigned char *out, const unsigned char *l, const unsigned char *r){
- out[0] = (unsigned char)mm((529*(int)l[0] + 705*(int)l[1] + 24*(int)l[2] +
- -62*(int)r[0] +-158*(int)r[1] + -39*(int)r[2]) / 1000, 0, 255);
- out[1] = (unsigned char)mm((-40*(int)l[0] + -38*(int)l[1] + -16*(int)l[2] +
- 378*(int)r[0] + 734*(int)r[1] + -18*(int)r[2]) / 1000, 0, 255);
- out[2] = (unsigned char)mm((-15*(int)l[0] + -24*(int)l[1] + 8*(int)l[2] +
- -32*(int)r[0] + -19*(int)r[1] + 1081*(int)r[2]) / 1000, 0, 255);
-
-// out[2] = (unsigned char)mm((-15*(int)l[0] + -27*(int)l[1] + 21*(int)l[2] + gm
-// 9*(int)r[0] + 75*(int)r[1] + 937*(int)r[2]) / 1000, 0, 255);
-// out[2] = (unsigned char)mm((-15*(int)l[0] + -21*(int)l[1] + -5*(int)l[2] + rc
-// -72*(int)r[0] +-113*(int)r[1] + 1226*(int)r[2]) / 1000, 0, 255);
+//magenta-cyan experimental
+unsigned char* experimental_mc(unsigned char *out, const unsigned char *l, const unsigned char *r){
+ out[0] = (unsigned char) mm((556*(int)l[0] + 400*(int)l[1] + 176*(int)l[2] +
+ -43*(int)r[0] + -88*(int)r[1] + -2*(int)r[2]) / 950, 0, 255);
+ out[1] = (unsigned char) mm((-40*(int)l[0] + -38*(int)l[1] + -16*(int)l[2] +
+ 278*(int)r[0] + 734*(int)r[1] + -18*(int)r[2]) / 1100, 0, 255);
+ out[2] = (unsigned char) mm((-15*(int)l[0] + -21*(int)l[1] + 600*(int)l[2] +
+ -72*(int)r[0] +-113*(int)r[1] + 621*(int)r[2]) / 950, 0, 255);
return out;
}
if (!strcmp(arg, "-drc")) return &dubois_rc;
if (!strcmp(arg, "-fmc")) return &full_mc;
- if (!strcmp(arg, "-dmc")) return &dubois_mc;
if (!strcmp(arg, "-dab")) return &dubois_ab;
+ if (!strcmp(arg, "-emc")) return &experimental_mc;
exit(error(1)); return &dubois_rc;
}
#!/bin/sh
algo="d" #algorythm, Dubois by default
-model="gm" #color model, green-magenta by default
+model="rc" #color model, green-magenta by default
param="" #leave blank, will be -$algo$model
left=''
right=''
while [ -n "$1" ]; do
case "$1" in
- -d|--dubois]) algo="d"
- ;;
- -f|--full|--full-color]) algo="f"
- ;;
- -h|--half|--half-color]) algo="d"
- ;;
- -rc|--rc|--red-cyan) model="rc"
- ;;
- -mc|--mc|--magenta-cyan) model="mc"
- ;;
- -gm|--gm|--green-magenta) model="gm"
- ;;
- -ab|--ab|--amber-blue|yellow-blue) model="ab"
- ;;
- -[dfh]rc|-[dfh]gm|-[fd]mc|-dab) param="$1"
- ;;
+ -d|--dubois) algo="d";;
+ -f|--full|--full-color) algo="f";;
+ -h|--half|--half-color) algo="d";;
+ -rc|--rc|--red-cyan) model="rc";;
+ -mc|--mc|--magenta-cyan) model="mc";;
+ -gm|--gm|--green-magenta) model="gm";;
+ -ab|--ab|--amber-blue|yellow-blue) model="ab";;
+ -[dfh]rc|-[dfh]gm|-[fe]mc|-dab) param="$1";;
+ -*) echo "no such color model" >/dev/stderr; exit 1;;
*) if [ -z "$left" ]; then
left="$1"
elif [ -z "$right" ]; then