updated on Wed Jan 25 08:34:36 UTC 2012
[aur-mirror.git] / jalingo / jalingo_middle_color.patch
blob0b45236bfa5be8b5b2d31645f76f85600b44aa74
1 --- src/ja/centre/gui/util/ColorUtil.java.old 2009-03-16 11:17:53.000000000 +0000
2 +++ src/ja/centre/gui/util/ColorUtil.java 2009-03-16 11:22:38.000000000 +0000
3 @@ -28,11 +28,15 @@
6 public static Color middle( Color color1, Color color2 ) {
7 - return new Color(
8 - ( color1.getRed() + color2.getRed() ) >> 1,
9 - ( color1.getGreen() + color2.getGreen() ) >> 1,
10 - ( color1.getBlue() + color2.getBlue() ) >> 1,
11 - ( color1.getAlpha() + color2.getAlpha() ) >> 1 // TODO alpha should be calculated with proportions, result is lesser alpha
12 - );
13 + if(color1 != null)
14 + if(color2 != null)
15 + return new Color((color1.getRed() + color2.getRed()) / 2, (color1.getGreen() + color2.getGreen()) / 2, (color1.getBlue() + color2.getBlue()) / 2, Math.min(color1.getAlpha(), color2.getAlpha()));
16 + else
17 + return color1;
18 + else
19 + if(color2 != null)
20 + return color2;
21 + else
22 + return Color.BLACK;