Interface PaintContext


public interface PaintContext
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    draw(Renderable renderable, Color color)
    Outlines an entity's model (player, NPC, object, ground item, or tile) with a 1px stroke.
    void
    draw(Renderable renderable, Color color, int strokeWidth)
    Outlines an entity's model.
    default void
    draw(Shape shape, Color color)
    Outlines a shape with a 1px stroke.
    void
    draw(Shape shape, Color color, int strokeWidth)
    Outlines a shape.
    default void
    drawImage(BufferedImage image, float x, float y)
    Draws an image at its natural size.
    void
    drawImage(BufferedImage image, float x, float y, float width, float height)
    Draws an image scaled to the given size.
    void
    drawLine(float startX, float startY, float endX, float endY, Color color, float strokeWidth)
    Draws a line.
    default void
    drawText(String str, float x, float y, Color color)
    Draws text at the default size (12px).
    void
    drawText(String str, float x, float y, Color color, float size)
    Draws text at the given pixel size.
    void
    drawText(String str, float x, float y, Color color, Font font)
    Draws text with a specific Font.
    void
    fill(Renderable renderable, Color color)
    Fills an entity's model.
    void
    fill(Shape shape, Color color)
    Fills a shape.
    Get the script paint frame.
    measureText(String str, Font font)
    Measures the pixel bounds text would render at with the given Font, for layout/centering.
  • Method Details

    • getScriptPaintFrame

      PaintFrame getScriptPaintFrame()
      Get the script paint frame. Add rows with scriptPaintFrame.addRow("Status", "Mining").
    • draw

      default void draw(Shape shape, Color color)
      Outlines a shape with a 1px stroke. Example: draw(tile.getBounds(), Color.RED).
    • draw

      void draw(Shape shape, Color color, int strokeWidth)
      Outlines a shape. Example: draw(tile.getBounds(), Color.RED, 2).
    • fill

      void fill(Shape shape, Color color)
      Fills a shape. Example: fill(tile.getBounds(), new Color(255, 0, 0, 100)).
    • draw

      default void draw(Renderable renderable, Color color)
      Outlines an entity's model (player, NPC, object, ground item, or tile) with a 1px stroke. Example: draw(npc, Color.YELLOW).
    • draw

      void draw(Renderable renderable, Color color, int strokeWidth)
      Outlines an entity's model. Example: draw(npc, Color.YELLOW, 2).
    • fill

      void fill(Renderable renderable, Color color)
      Fills an entity's model. Example: fill(sceneObject, new Color(0, 255, 0, 100)).
    • drawText

      default void drawText(String str, float x, float y, Color color)
      Draws text at the default size (12px). Example: drawText("Hi", 10, 20, Color.WHITE).
    • drawText

      void drawText(String str, float x, float y, Color color, float size)
      Draws text at the given pixel size. Example: drawText("Score: 42", 10, 20, Color.WHITE, 16f).
    • drawText

      void drawText(String str, float x, float y, Color color, Font font)
      Draws text with a specific Font. Example: drawText("Hi", 10, 20, Color.WHITE, new Font("Tahoma", Font.BOLD, 20)).
    • measureText

      Rectangle2D measureText(String str, Font font)
      Measures the pixel bounds text would render at with the given Font, for layout/centering. Example: Rectangle2D bounds = measureText("Hi", font);.
    • drawLine

      void drawLine(float startX, float startY, float endX, float endY, Color color, float strokeWidth)
      Draws a line. Example: drawLine(0, 0, 100, 100, Color.WHITE, 2f).
    • drawImage

      default void drawImage(BufferedImage image, float x, float y)
      Draws an image at its natural size. Reuse the same BufferedImage instance every frame rather than reloading it so that the upload only happens once, on first use.

      Note: Limited to roughly 512x512px (RGBA); larger images fail to register and silently won't draw.

      Example: drawImage(logo, 10, 10).

    • drawImage

      void drawImage(BufferedImage image, float x, float y, float width, float height)
      Draws an image scaled to the given size. Reuse the same BufferedImage instance every frame rather than reloading it so that the upload only happens once, on first use.

      Note: Limited to roughly 512x512px (RGBA); larger images fail to register and silently won't draw.

      Example: drawImage(logo, 10, 10, 64, 64).