StonePainter: Make "brighter" color less bright
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@39 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
e2ecbd02cb
commit
587982bc4f
1 changed files with 17 additions and 8 deletions
|
@ -21,20 +21,29 @@ class StonePainter {
|
|||
private static final float CIRCLE_POS = 0.725f;
|
||||
private static final float CIRCLE_WIDTH = 0.45f;
|
||||
|
||||
|
||||
private static final Color BACKGROUND_COLOR = new Color(0.9f, 0.9f, 0.6f);
|
||||
private static final Color HIGHLIGHTED_COLOR = BACKGROUND_COLOR.darker();
|
||||
|
||||
private static final float BRIGHTER_SCALE = 1.15f;
|
||||
|
||||
public static final float BOARD_SCALE = 75.0f*ASPECT_RATIO/DEFAULT_WIDTH;
|
||||
|
||||
|
||||
private float scale;
|
||||
|
||||
|
||||
private static int even(float f) {
|
||||
return 2*(int)(f/2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Color brighter(Color color) {
|
||||
int r = (int) (color.getRed() * BRIGHTER_SCALE);
|
||||
int g = (int) (color.getRed() * BRIGHTER_SCALE);
|
||||
int b = (int) (color.getRed() * BRIGHTER_SCALE);
|
||||
|
||||
return new Color(r>255?255:r, g>255?255:g, b>255?255:b);
|
||||
}
|
||||
|
||||
private static Color getColor(StoneColor color) {
|
||||
switch(color) {
|
||||
case BLACK:
|
||||
|
@ -81,14 +90,14 @@ class StonePainter {
|
|||
g.fillRect(x, y, width, height);
|
||||
|
||||
// Paint bevel border
|
||||
g.setColor(background.brighter().brighter());
|
||||
g.setColor(brighter(brighter(background)));
|
||||
g.fillRect(x, y, 1, height);
|
||||
g.setColor(background.brighter());
|
||||
g.setColor(brighter(background));
|
||||
g.fillRect(x+1, y+1, 1, height-2);
|
||||
|
||||
g.setColor(background.brighter().brighter());
|
||||
g.setColor(brighter(brighter(background)));
|
||||
g.fillRect(x, y, width, 1);
|
||||
g.setColor(background.brighter());
|
||||
g.setColor(brighter(background));
|
||||
g.fillRect(x+1, y+1, width-2, 1);
|
||||
|
||||
g.setColor(background.darker().darker());
|
||||
|
@ -184,7 +193,7 @@ class StonePainter {
|
|||
g.setColor(background.darker());
|
||||
g.drawArc(x+width/2-size/2, pos-size/2, size, size, 50, 170);
|
||||
|
||||
g.setColor(background.brighter());
|
||||
g.setColor(brighter(background));
|
||||
g.drawArc((int)(x+width/2-size/2), pos-size/2, size, size, -130, 170);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue