Interface PaintContext
public interface PaintContext
-
Method Summary
Modifier and TypeMethodDescriptiondefault voiddraw(Renderable renderable, Color color) Outlines an entity's model (player, NPC, object, ground item, or tile) with a 1px stroke.voiddraw(Renderable renderable, Color color, int strokeWidth) Outlines an entity's model.default voidOutlines a shape with a 1px stroke.voidOutlines a shape.default voiddrawImage(BufferedImage image, float x, float y) Draws an image at its natural size.voiddrawImage(BufferedImage image, float x, float y, float width, float height) Draws an image scaled to the given size.voidDraws a line.default voidDraws text at the default size (12px).voidDraws text at the given pixel size.voidDraws text with a specificFont.voidfill(Renderable renderable, Color color) Fills an entity's model.voidFills a shape.Get the script paint frame.measureText(String str, Font font) Measures the pixel bounds text would render at with the givenFont, for layout/centering.
-
Method Details
-
getScriptPaintFrame
PaintFrame getScriptPaintFrame()Get the script paint frame. Add rows withscriptPaintFrame.addRow("Status", "Mining"). -
draw
Outlines a shape with a 1px stroke. Example:draw(tile.getBounds(), Color.RED). -
draw
Outlines a shape. Example:draw(tile.getBounds(), Color.RED, 2). -
fill
Fills a shape. Example:fill(tile.getBounds(), new Color(255, 0, 0, 100)). -
drawText
Draws text at the default size (12px). Example:drawText("Hi", 10, 20, Color.WHITE). -
drawText
Draws text at the given pixel size. Example:drawText("Score: 42", 10, 20, Color.WHITE, 16f). -
drawText
Draws text with a specificFont. Example:drawText("Hi", 10, 20, Color.WHITE, new Font("Tahoma", Font.BOLD, 20)). -
measureText
Measures the pixel bounds text would render at with the givenFont, for layout/centering. Example:Rectangle2D bounds = measureText("Hi", font);. -
drawLine
Draws a line. Example:drawLine(0, 0, 100, 100, Color.WHITE, 2f). -
drawImage
Draws an image at its natural size. Reuse the sameBufferedImageinstance 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
Draws an image scaled to the given size. Reuse the sameBufferedImageinstance 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).
-