Class GuiCanvas

java.lang.Object
com.render.api.GuiCanvas

public final class GuiCanvas extends Object
Lightweight wrapper around GuiGraphicsExtractor for HUD and screen rendering.
  • Method Details

    • of

      public static GuiCanvas of(net.minecraft.client.gui.GuiGraphicsExtractor graphics)
      Wraps a raw GuiGraphicsExtractor instance in a GuiCanvas.
      Parameters:
      graphics - graphics instance for the current frame
      Returns:
      a canvas backed by the client font renderer
    • raw

      public net.minecraft.client.gui.GuiGraphicsExtractor raw()
      Returns the wrapped GuiGraphicsExtractor instance.
      Returns:
      the underlying graphics object
    • font

      public net.minecraft.client.gui.Font font()
      Returns the font used for text drawing.
      Returns:
      the active Minecraft font
    • width

      public int width()
      Returns the current GUI width in pixels.
      Returns:
      GUI width in pixels
    • height

      public int height()
      Returns the current GUI height in pixels.
      Returns:
      GUI height in pixels
    • rect

      public void rect(int x1, int y1, int x2, int y2, RenderColor color)
      Fills a rectangle in ARGB color space.
      Parameters:
      x1 - left edge
      y1 - top edge
      x2 - right edge
      y2 - bottom edge
      color - fill color
    • rect

      @Deprecated(forRemoval=false) public void rect(int x1, int y1, int x2, int y2, int argb)
    • rectOutline

      public void rectOutline(int x1, int y1, int x2, int y2, RenderColor color)
      Draws a one-pixel outline around a rectangle.
      Parameters:
      x1 - left edge
      y1 - top edge
      x2 - right edge
      y2 - bottom edge
      color - outline color
    • rectOutline

      @Deprecated(forRemoval=false) public void rectOutline(int x1, int y1, int x2, int y2, int argb)
    • text

      public void text(String text, int x, int y, RenderColor color)
      Draws literal text with a shadow.
      Parameters:
      text - literal text to draw
      x - left position
      y - top position
      color - text color
    • text

      @Deprecated(forRemoval=false) public void text(String text, int x, int y, int argb)
    • text

      public void text(net.minecraft.network.chat.Component text, int x, int y, RenderColor color)
      Draws a component with a shadow.
      Parameters:
      text - text component to draw
      x - left position
      y - top position
      color - text color
    • text

      @Deprecated(forRemoval=false) public void text(net.minecraft.network.chat.Component text, int x, int y, int argb)
    • text

      public void text(net.minecraft.network.chat.Component text, int x, int y, RenderColor color, boolean shadow)
      Draws a component at the supplied position.
      Parameters:
      text - text component to draw
      x - left position
      y - top position
      color - text color
      shadow - whether to draw the standard text shadow
    • text

      @Deprecated(forRemoval=false) public void text(net.minecraft.network.chat.Component text, int x, int y, int argb, boolean shadow)
    • text

      public void text(String text, int x, int y, RenderColor color, GuiFont guiFont)
    • text

      public void text(net.minecraft.network.chat.Component text, int x, int y, RenderColor color, GuiFont guiFont)
    • text

      public void text(String text, int x, int y, RenderColor color, GuiFont guiFont, float textSizePixels)
    • text

      public void text(net.minecraft.network.chat.Component text, int x, int y, RenderColor color, GuiFont guiFont, float textSizePixels)
    • text

      public void text(net.minecraft.network.chat.Component text, int x, int y, RenderColor color, GuiFont guiFont, boolean shadow)
    • text

      public void text(net.minecraft.network.chat.Component text, int x, int y, RenderColor color, GuiFont guiFont, float textSizePixels, boolean shadow)
    • centeredText

      public void centeredText(String text, int centerX, int y, RenderColor color)
      Draws centered literal text with a shadow.
      Parameters:
      text - literal text to draw
      centerX - horizontal center
      y - top position
      color - text color
    • centeredText

      @Deprecated(forRemoval=false) public void centeredText(String text, int centerX, int y, int argb)
    • centeredText

      public void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, RenderColor color)
      Draws centered component text with a shadow.
      Parameters:
      text - text component to draw
      centerX - horizontal center
      y - top position
      color - text color
    • centeredText

      @Deprecated(forRemoval=false) public void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, int argb)
    • centeredText

      public void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, RenderColor color, boolean shadow)
      Draws centered component text.
      Parameters:
      text - text component to draw
      centerX - horizontal center
      y - top position
      color - text color
      shadow - whether to draw the standard text shadow
    • centeredText

      @Deprecated(forRemoval=false) public void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, int argb, boolean shadow)
    • centeredText

      public void centeredText(String text, int centerX, int y, RenderColor color, GuiFont guiFont)
    • centeredText

      public void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, RenderColor color, GuiFont guiFont)
    • centeredText

      public void centeredText(String text, int centerX, int y, RenderColor color, GuiFont guiFont, float textSizePixels)
    • centeredText

      public void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, RenderColor color, GuiFont guiFont, float textSizePixels)
    • centeredText

      public void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, RenderColor color, GuiFont guiFont, boolean shadow)
    • centeredText

      public void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, RenderColor color, GuiFont guiFont, float textSizePixels, boolean shadow)
    • textWidth

      public int textWidth(String text, GuiFont guiFont)
    • textWidth

      public int textWidth(String text, GuiFont guiFont, float textSizePixels)
    • textWidth

      public int textWidth(net.minecraft.network.chat.Component text, GuiFont guiFont)
    • textWidth

      public int textWidth(net.minecraft.network.chat.Component text, GuiFont guiFont, float textSizePixels)
    • text

      public GuiTextLayout text(GuiRichText text, float x, float y, GuiTextConstraints constraints)
      Draws fully styled rich text through the browser-grade renderer.
    • text

      public GuiTextLayout text(String text, float x, float y, GuiTextStyle style, GuiTextConstraints constraints)