Class SceneCanvas

java.lang.Object
privbot.ui.overlay.SceneCanvas

public final class SceneCanvas extends Object
The scene-drawing primitives every tile overlay used to hand-roll, over one SceneProjection.

Handed to PrivBotSceneOverlay.draw(SceneCanvas, Object) for one render; it draws with the overlay's Graphics2D and never reads the client except through the projection.

  • Method Details

    • graphics

      public Graphics2D graphics()
      The overlay's graphics, for drawing the primitives here do not cover.
    • projection

      public SceneProjection projection()
      The projection tiles and points go through.
    • tile

      public SceneCanvas tile(net.runelite.api.coords.WorldPoint tile, Color color)
      Fill a tile with color at OverlayTheme.TILE_ALPHA and outline it solid.
    • tile

      public SceneCanvas tile(net.runelite.api.coords.WorldPoint tile, Color fill, Color border)
      Fill and outline a tile with explicit colours; either may be null to skip it. Off-screen tiles draw nothing.
    • tiles

      public SceneCanvas tiles(Iterable<net.runelite.api.coords.WorldPoint> tiles, Color color)
      tile(WorldPoint, Color) for each tile; null draws nothing.
    • area

      public SceneCanvas area(net.runelite.api.coords.WorldArea area, Color color)
      Every tile of area (its plane is ignored; the current plane projects).
    • outline

      public SceneCanvas outline(net.runelite.api.Actor actor, Color color)
      Outline an actor (convex hull where available, its tile otherwise).

      The actor methods read the live actor at render time. Prefer drawing a WorldPoint copied into the snapshot when the actor may have despawned.

    • tileOf

      public SceneCanvas tileOf(net.runelite.api.Actor actor, Color color)
      Fill the tile under an actor.
    • label

      public SceneCanvas label(net.runelite.api.coords.WorldPoint tile, String text, Color color)
      Shadowed text centred over a tile at ground level.
    • label

      public SceneCanvas label(net.runelite.api.coords.WorldPoint tile, String text, Color color, int heightOffset)
      Shadowed text centred over a tile, raised heightOffset scene units; off-screen draws nothing.
    • label

      public SceneCanvas label(net.runelite.api.Actor actor, String text, Color color, int heightOffset)
      Shadowed text above an actor (heightOffset in scene units; the actor's height works).
    • countdown

      public SceneCanvas countdown(net.runelite.api.coords.WorldPoint tile, int ticksLeft, ColorRamp ramp)
      A tick countdown on a tile: fill from ramp, the number shadowed on top.
    • countdown

      public SceneCanvas countdown(net.runelite.api.coords.WorldPoint tile, String text, int ticksLeft, ColorRamp ramp)
      A countdown tile coloured by ramp(ticksLeft) with custom text on top.
    • shadowText

      public SceneCanvas shadowText(int x, int y, String text, Color color)
      Text with a 1 px black drop shadow, the way every plugin drew it.
    • line

      public SceneCanvas line(net.runelite.api.coords.WorldPoint a, net.runelite.api.coords.WorldPoint b, Color color)
      A 2 px line between two tile centres at ground level; nothing if either end is off-screen.
    • path

      public SceneCanvas path(List<net.runelite.api.coords.WorldPoint> tiles, Color color)
      A polyline through tile centres; unprojectable tiles break the line rather than skew it.
    • labelBox

      public SceneCanvas labelBox(int x, int y, List<String> lines, Color textColor)
      A translucent box sized to its lines, drawn at a canvas point (debug boxes over NPC heads).
    • progressBar

      public SceneCanvas progressBar(int x, int y, int w, int h, double fraction, Color color)
      A rounded progress bar in canvas space.
    • lines

      public static List<String> lines(String... lines)
      Convenience for labelBox(int, int, List, Color) callers building lines.