public static cave.Color forRGBA(int r, int g, int b, int a) { var v = new cave.Color(); v.setRed((double)(r / 255.00)); v.setGreen((double)(g / 255.00)); v.setBlue((double)(b / 255.00)); v.setAlpha((double)(a / 255.00)); return(v); }
public static cave.Color forRGBADouble(double r, double g, double b, double a) { var v = new cave.Color(); v.setRed(r); v.setGreen(g); v.setBlue(b); v.setAlpha(a); return(v); }
public cave.Color dup(string arg = null) { var f = 1.00; if (!(object.Equals(arg, null))) { if (object.Equals(arg, "light")) { f = 1.20; } else if (object.Equals(arg, "dark")) { f = 0.80; } else if (cape.String.endsWith(arg, "%")) { f = (double)decimalStringToInteger(arg) / 100.00; } } var v = new cave.Color(); if (f > 1.00) { v.setRed(red + (1.00 - red) * (f - 1.00)); v.setGreen(green + (1.00 - green) * (f - 1.00)); v.setBlue(blue + (1.00 - blue) * (f - 1.00)); } else if (f < 1.00) { v.setRed(red * f); v.setGreen(green * f); v.setBlue(blue * f); } else { v.setRed(red); v.setGreen(green); v.setBlue(blue); } v.setAlpha(alpha); return(v); }