Search in sources :

Example 1 with Point

use of net.runelite.api.Point in project runelite by runelite.

the class CannonOverlay method render.

@Override
public Dimension render(Graphics2D graphics) {
    if (!plugin.isCannonPlaced() || plugin.getCannonPosition() == null) {
        return null;
    }
    LocalPoint cannonPoint = LocalPoint.fromWorld(client, plugin.getCannonPosition());
    if (cannonPoint == null) {
        return null;
    }
    LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
    if (localLocation.distanceTo(cannonPoint) <= MAX_DISTANCE) {
        Point cannonLoc = Perspective.getCanvasTextLocation(client, graphics, cannonPoint, String.valueOf(plugin.getCballsLeft()), 200);
        if (cannonLoc != null) {
            textComponent.setText(String.valueOf(plugin.getCballsLeft()));
            textComponent.setPosition(new java.awt.Point(cannonLoc.getX(), cannonLoc.getY()));
            textComponent.setColor(plugin.getStateColor());
            textComponent.render(graphics);
        }
        if (config.showDoubleHitSpot()) {
            Color color = config.highlightDoubleHitColor();
            drawDoubleHitSpots(graphics, cannonPoint, color);
        }
    }
    return null;
}
Also used : LocalPoint(net.runelite.api.coords.LocalPoint) Color(java.awt.Color) LocalPoint(net.runelite.api.coords.LocalPoint) Point(net.runelite.api.Point)

Example 2 with Point

use of net.runelite.api.Point in project runelite by runelite.

the class ConveyorBeltOverlay method render.

@Override
public Dimension render(Graphics2D graphics) {
    if (!config.showConveyorBelt() || plugin.getConveyorBelt() == null) {
        return null;
    }
    LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
    Point mousePosition = client.getMouseCanvasPosition();
    GameObject object = plugin.getConveyorBelt();
    LocalPoint location = object.getLocalLocation();
    if (localLocation.distanceTo(location) <= MAX_DISTANCE) {
        Area objectClickbox = object.getClickbox();
        if (objectClickbox != null) {
            if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) {
                graphics.setColor(Color.RED.darker());
            } else {
                graphics.setColor(Color.RED);
            }
            graphics.draw(objectClickbox);
            graphics.setColor(new Color(0xFF, 0, 0, 20));
            graphics.fill(objectClickbox);
        }
    }
    return null;
}
Also used : Area(java.awt.geom.Area) LocalPoint(net.runelite.api.coords.LocalPoint) GameObject(net.runelite.api.GameObject) Color(java.awt.Color) LocalPoint(net.runelite.api.coords.LocalPoint) Point(net.runelite.api.Point)

Example 3 with Point

use of net.runelite.api.Point in project runelite by runelite.

the class AbyssOverlay method renderRifts.

private void renderRifts(Graphics2D graphics, DecorativeObject object) {
    AbyssRifts rift = AbyssRifts.getRift(object.getId());
    if (rift == null || !rifts.contains(rift)) {
        return;
    }
    if (config.showClickBox()) {
        // Draw clickbox
        Point mousePosition = client.getMouseCanvasPosition();
        Area objectClickbox = object.getClickbox();
        if (objectClickbox != null) {
            if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) {
                graphics.setColor(Color.MAGENTA.darker());
            } else {
                graphics.setColor(Color.MAGENTA);
            }
            graphics.draw(objectClickbox);
            graphics.setColor(new Color(255, 0, 255, 20));
            graphics.fill(objectClickbox);
        }
    }
    // Draw minimap
    BufferedImage image = getImage(rift);
    Point miniMapImage = Perspective.getMiniMapImageLocation(client, object.getLocalLocation(), image);
    if (miniMapImage != null) {
        graphics.drawImage(image, miniMapImage.getX(), miniMapImage.getY(), null);
    }
}
Also used : Area(java.awt.geom.Area) Color(java.awt.Color) LocalPoint(net.runelite.api.coords.LocalPoint) Point(net.runelite.api.Point) BufferedImage(java.awt.image.BufferedImage)

Example 4 with Point

use of net.runelite.api.Point in project runelite by runelite.

the class OverlayUtil method renderTextLocation.

public static void renderTextLocation(Graphics2D graphics, Point txtLoc, String text, Color color) {
    int x = txtLoc.getX();
    int y = txtLoc.getY();
    graphics.setColor(Color.BLACK);
    graphics.drawString(text, x + 1, y + 1);
    graphics.setColor(color);
    graphics.drawString(text, x, y);
}
Also used : LocalPoint(net.runelite.api.coords.LocalPoint) Point(net.runelite.api.Point)

Example 5 with Point

use of net.runelite.api.Point in project runelite by runelite.

the class OverlayUtil method renderActorOverlayImage.

public static void renderActorOverlayImage(Graphics2D graphics, Actor actor, BufferedImage image, Color color, int zOffset) {
    Polygon poly = actor.getCanvasTilePoly();
    if (poly != null) {
        renderPolygon(graphics, poly, color);
    }
    Point imageLocation = actor.getCanvasImageLocation(graphics, image, zOffset);
    if (imageLocation != null) {
        renderImageLocation(graphics, imageLocation, image);
    }
}
Also used : LocalPoint(net.runelite.api.coords.LocalPoint) Point(net.runelite.api.Point) Polygon(java.awt.Polygon)

Aggregations

Point (net.runelite.api.Point)28 LocalPoint (net.runelite.api.coords.LocalPoint)12 Polygon (java.awt.Polygon)9 Color (java.awt.Color)6 BufferedImage (java.awt.image.BufferedImage)5 Inject (net.runelite.api.mixins.Inject)4 FontMetrics (java.awt.FontMetrics)3 Rectangle (java.awt.Rectangle)3 Area (java.awt.geom.Area)3 ArrayList (java.util.ArrayList)3 WorldPoint (net.runelite.api.coords.WorldPoint)3 WidgetItem (net.runelite.api.widgets.WidgetItem)3 ImageIO (javax.imageio.ImageIO)2 Player (net.runelite.api.Player)2 Vertex (net.runelite.api.model.Vertex)2 Test (org.junit.Test)2 Inject (com.google.inject.Inject)1 Dimension (java.awt.Dimension)1 Graphics (java.awt.Graphics)1 Graphics2D (java.awt.Graphics2D)1