From 587982bc4fa19fd3bee1a36cbf84ac1bf2a8c6d7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 30 Apr 2011 22:29:16 +0200 Subject: StonePainter: Make "brighter" color less bright git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@39 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/view/impl/StonePainter.java | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/jrummikub/view') diff --git a/src/jrummikub/view/impl/StonePainter.java b/src/jrummikub/view/impl/StonePainter.java index f795eea..9bdca05 100644 --- a/src/jrummikub/view/impl/StonePainter.java +++ b/src/jrummikub/view/impl/StonePainter.java @@ -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); } -- cgit v1.2.3