ground markers: add fill opacity config

This commit is contained in:
Adam
2021-09-14 11:40:57 -04:00
parent 639765d8e8
commit 4e0211b490
3 changed files with 17 additions and 2 deletions

View File

@@ -98,4 +98,14 @@ public interface GroundMarkerConfig extends Config
{
return 2;
}
@ConfigItem(
keyName = "fillOpacity",
name = "Fill Opacity",
description = "Opacity of the tile fill color"
)
default int fillOpacity()
{
return 50;
}
}

View File

@@ -114,7 +114,7 @@ public class GroundMarkerOverlay extends Overlay
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
if (poly != null)
{
OverlayUtil.renderPolygon(graphics, poly, color, borderStroke);
OverlayUtil.renderPolygon(graphics, poly, color, new Color(0, 0, 0, config.fillOpacity()), borderStroke);
}
if (!Strings.isNullOrEmpty(label))

View File

@@ -54,12 +54,17 @@ public class OverlayUtil
}
public static void renderPolygon(Graphics2D graphics, Shape poly, Color color, Stroke borderStroke)
{
renderPolygon(graphics, poly, color, new Color(0, 0, 0, 50), borderStroke);
}
public static void renderPolygon(Graphics2D graphics, Shape poly, Color color, Color fillColor, Stroke borderStroke)
{
graphics.setColor(color);
final Stroke originalStroke = graphics.getStroke();
graphics.setStroke(borderStroke);
graphics.draw(poly);
graphics.setColor(new Color(0, 0, 0, 50));
graphics.setColor(fillColor);
graphics.fill(poly);
graphics.setStroke(originalStroke);
}