X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FColor.java;fp=src%2Fkaka%2Fcakelight%2FColor.java;h=ba85866aa98eb2fe1c030d60dc32f4373fc3024b;hb=242486dc84c4f5b0c1bfad9807099355246f4ee2;hp=0000000000000000000000000000000000000000;hpb=df46bbde578baf6ef9a88935a65e424175518377;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/Color.java b/src/kaka/cakelight/Color.java new file mode 100644 index 0000000..ba85866 --- /dev/null +++ b/src/kaka/cakelight/Color.java @@ -0,0 +1,34 @@ +package kaka.cakelight; + +public class Color { + private int r, g, b; + + public static Color rgb(int r, int g, int b) { + Color c = new Color(); + c.r = r; + c.g = g; + c.b = b; + return c; + } + + public int r() { + return r; + } + + public int g() { + return g; + } + + public int b() { + return b; + } + + public Color interpolate(Color other, double value) { + double invertedValue = 1 - value; + return Color.rgb( + (int)(r * invertedValue + other.r * value), + (int)(g * invertedValue + other.g * value), + (int)(b * invertedValue + other.b * value) + ); + } +}