Class CircleSprite

java.lang.Object
me.hackware.api.gui.CircleSprite

public final class CircleSprite extends Object
Smooth large-circle rendering. Big circles through the per-pixel fill helpers cost hundreds-to-thousands of quads per frame (and un-anti-aliased scanlines look stepped), so instead an anti-aliased disc+ring is baked once into a texture at exact physical resolution and drawn as a single 1:1 quad.

Textures are cached by (diameter, fill, ring) in a tiny LRU; a bake only happens when a new size/colour combination first appears (e.g. panel resize).

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    draw(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int fill, int ring)
    Draws a filled circle with a ~1.5-physical-px ring, anti-aliased, centred at (cx, cy) in logical space.
    static void
    drawDonut(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int fill, int ring)
    Draws a donut (annulus) split into segments equal wedges by separator lines, with AA rings on both edges.
    static void
    drawDonutSector(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int sector, int fill)
    Fills only wedge sector of a segmented donut — the selection highlight overlay for drawDonut(net.minecraft.client.gui.GuiGraphics, double, int, int, int, int, int, int, int).
    static void
    drawDonutSector(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int sector, int fill, int ring)
    Sector fill with an outline (ring) on its edges — the selected-slice highlight.
    static void
    drawDonutSectorArcs(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int sector, int ring)
    Just the inner + outer arc borders of one wedge (ring), no radial separators.
    static void
    drawDonutSectorRotated(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, double rotationDeg, int fill, int ring, boolean arcsOnly)
    Draws wedge 0 of a segments donut rotated by rotationDeg about (cx, cy) — for a slice sitting at an arbitrary (animated) angle rather than a fixed slot.
    static void
    drawPx(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radiusPx, int fill, int ring)
    Like draw(net.minecraft.client.gui.GuiGraphics, double, int, int, int, int, int) but with the radius in physical pixels (unscaled), for elements sized on a fixed dp baseline regardless of GUI/panel scale.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • draw

      public static void draw(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int fill, int ring)
      Draws a filled circle with a ~1.5-physical-px ring, anti-aliased, centred at (cx, cy) in logical space. res is physical pixels per logical unit (see UiContext.res). Pass ring with zero alpha to skip the outline, or fill with zero alpha for ring-only.
    • drawPx

      public static void drawPx(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radiusPx, int fill, int ring)
      Like draw(net.minecraft.client.gui.GuiGraphics, double, int, int, int, int, int) but with the radius in physical pixels (unscaled), for elements sized on a fixed dp baseline regardless of GUI/panel scale.
    • drawDonut

      public static void drawDonut(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int fill, int ring)
      Draws a donut (annulus) split into segments equal wedges by separator lines, with AA rings on both edges. innerRadius 0 makes a plain disc; segments 0 skips separators. Wedge 0 is centred at the top, matching
      invalid reference
      RadialMenu#segmentAt
      .
    • drawDonutSector

      public static void drawDonutSector(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int sector, int fill)
      Fills only wedge sector of a segmented donut — the selection highlight overlay for drawDonut(net.minecraft.client.gui.GuiGraphics, double, int, int, int, int, int, int, int).
    • drawDonutSector

      public static void drawDonutSector(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int sector, int fill, int ring)
      Sector fill with an outline (ring) on its edges — the selected-slice highlight.
    • drawDonutSectorArcs

      public static void drawDonutSectorArcs(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int sector, int ring)
      Just the inner + outer arc borders of one wedge (ring), no radial separators.
    • drawDonutSectorRotated

      public static void drawDonutSectorRotated(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, double rotationDeg, int fill, int ring, boolean arcsOnly)
      Draws wedge 0 of a segments donut rotated by rotationDeg about (cx, cy) — for a slice sitting at an arbitrary (animated) angle rather than a fixed slot. Pass arcsOnly for just the arc border. The radius is unchanged, so no per-angle re-bake.