Remove duplicated and unused OverlayUtil code
- Use OverlayUtil in implings plugin - Remove unused code in OverlayUtil Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
package net.runelite.client.plugins.implings;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
@@ -42,6 +41,7 @@ import net.runelite.api.queries.NPCQuery;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.QueryRunner;
|
||||
|
||||
/**
|
||||
@@ -156,34 +156,19 @@ public class ImplingsOverlay extends Overlay
|
||||
Polygon poly = actor.getCanvasTilePoly();
|
||||
if (poly != null)
|
||||
{
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.drawPolygon(poly);
|
||||
graphics.setColor(new Color(0, 0, 0, 50));
|
||||
graphics.fillPolygon(poly);
|
||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||
}
|
||||
|
||||
Point minimapLocation = actor.getMinimapLocation();
|
||||
if (minimapLocation != null)
|
||||
{
|
||||
graphics.setColor(color);
|
||||
graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 5, 5);
|
||||
graphics.setColor(Color.WHITE);
|
||||
graphics.setStroke(new BasicStroke(1));
|
||||
graphics.drawOval(minimapLocation.getX(), minimapLocation.getY(), 5, 5);
|
||||
OverlayUtil.renderMinimapLocation(graphics, minimapLocation, color);
|
||||
}
|
||||
|
||||
Point textLocation = actor.getCanvasTextLocation(graphics, text, actor.getLogicalHeight());
|
||||
if (textLocation != null)
|
||||
{
|
||||
int x = textLocation.getX();
|
||||
int y = textLocation.getY();
|
||||
|
||||
graphics.setColor(Color.BLACK);
|
||||
graphics.drawString(text, x + 1, y + 1);
|
||||
|
||||
graphics.setColor(color);
|
||||
graphics.drawString(text, x, y);
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, text, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,7 @@ import java.awt.Polygon;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.SpritePixels;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
@@ -83,14 +80,6 @@ public class OverlayUtil
|
||||
graphics.drawImage(image, x, y, null);
|
||||
}
|
||||
|
||||
public static void renderSpriteLocation(Graphics2D graphics, Point imgLoc, SpritePixels sprite)
|
||||
{
|
||||
int x = imgLoc.getX();
|
||||
int y = imgLoc.getY();
|
||||
|
||||
sprite.drawAt(x, y);
|
||||
}
|
||||
|
||||
public static void renderActorOverlay(Graphics2D graphics, Actor actor, String text, Color color)
|
||||
{
|
||||
Polygon poly = actor.getCanvasTilePoly();
|
||||
@@ -121,27 +110,6 @@ public class OverlayUtil
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderActorOverlaySprite(Graphics2D graphics, Actor actor, SpritePixels sprite, Color color)
|
||||
{
|
||||
Polygon poly = actor.getCanvasTilePoly();
|
||||
if (poly != null)
|
||||
{
|
||||
renderPolygon(graphics, poly, color);
|
||||
}
|
||||
|
||||
Point minimapLocation = actor.getMinimapLocation();
|
||||
if (minimapLocation != null)
|
||||
{
|
||||
renderMinimapLocation(graphics, minimapLocation, color);
|
||||
}
|
||||
|
||||
Point imageLocation = actor.getCanvasSpriteLocation(graphics, sprite, actor.getLogicalHeight());
|
||||
if (imageLocation != null)
|
||||
{
|
||||
renderSpriteLocation(graphics, imageLocation, sprite);
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderTileOverlay(Graphics2D graphics, TileObject tileObject, String text, Color color)
|
||||
{
|
||||
Polygon poly = tileObject.getCanvasTilePoly();
|
||||
@@ -163,28 +131,6 @@ public class OverlayUtil
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderTilePointOverlay(Graphics2D graphics, Client client, Point point, String text, Color color)
|
||||
{
|
||||
Polygon poly = Perspective.getCanvasTilePoly(client, point);
|
||||
|
||||
if (poly != null)
|
||||
{
|
||||
renderPolygon(graphics, poly, color);
|
||||
}
|
||||
|
||||
Point minimapLocation = Perspective.worldToMiniMap(client, point.getX(), point.getY());
|
||||
if (minimapLocation != null)
|
||||
{
|
||||
renderMinimapLocation(graphics, minimapLocation, color);
|
||||
}
|
||||
|
||||
Point textLocation = Perspective.getCanvasTextLocation(client, graphics, point, text, 0);
|
||||
if (textLocation != null)
|
||||
{
|
||||
renderTextLocation(graphics, textLocation, text, color);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGraphicProperties(Graphics2D graphics)
|
||||
{
|
||||
graphics.setFont(FontManager.getRunescapeFont());
|
||||
|
||||
Reference in New Issue
Block a user