prepare for some colors - greyed background

- background is not greyed depending on surrouding walls
- MazeColorMap to prepare for color edition
This commit is contained in:
philippe lhardy
2020-12-13 18:05:02 +01:00
parent 9b4f035d0f
commit 56585712c8
2 changed files with 55 additions and 7 deletions

View File

@@ -73,6 +73,23 @@ public class MazeCellParameters {
offsetY + (int) (mapHeight * height));
}
public Color getGreyedColor(Color color, int greylevel)
{
Color greyedColor = new Color(
Math.max(0,color.getRed() - greylevel),
Math.max(0,color.getGreen() - greylevel),
Math.max(0,color.getBlue() - greylevel));
return greyedColor;
}
public void drawBackground(Graphics g, int pX, int pY, short walls) {
int x = offsetX + (int) (pX * width);
int y = offsetY + (int) (pY * height);
Color savecolor = g.getColor();
int greylevel = walls << 2;
g.setColor(getGreyedColor(savecolor,greylevel));
//g.fillRect(x+1,y+1,((int)width) -1,((int)height) - 1);
g.fillRect(x,y,((int)width),((int)height));
}
public void drawWalls(Graphics g, int pX, int pY, short walls) {
int x = offsetX + (int) (pX * width);
int y = offsetY + (int) (pY * height);