package kaka.cakelight;
public class Color {
+ private static int[] gammaCorrection = new int[256];
+
+ public static void calculateGammaCorrection(double gamma) {
+ for (int i = 0, max = 255; i <= max; i++) {
+ gammaCorrection[i] = (int)(Math.pow((double)i / max, gamma) * max);
+ }
+ }
+
private int r, g, b;
public static Color rgb(double r, double g, double b) {
}
public int r() {
- return r;
+ return gammaCorrection[r];
}
public int g() {
- return g;
+ return gammaCorrection[g];
}
public int b() {
- return b;
+ return gammaCorrection[b];
}
public Color interpolate(Color other, double value) {