summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-04-30 22:29:16 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-04-30 22:29:16 +0200
commit587982bc4fa19fd3bee1a36cbf84ac1bf2a8c6d7 (patch)
tree3d15f3996503312624676dba82f42ff5c71950d1
parente2ecbd02cb80ac2f7ea323ae41df7bd35e5b01ba (diff)
downloadJRummikub-587982bc4fa19fd3bee1a36cbf84ac1bf2a8c6d7.tar
JRummikub-587982bc4fa19fd3bee1a36cbf84ac1bf2a8c6d7.zip
StonePainter: Make "brighter" color less bright
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@39 72836036-5685-4462-b002-a69064685172
-rw-r--r--src/jrummikub/view/impl/StonePainter.java25
1 files changed, 17 insertions, 8 deletions
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);
}