Package me.hackware.api.gui
Class CircleSprite
java.lang.Object
me.hackware.api.gui.CircleSprite
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 TypeMethodDescriptionstatic voiddraw(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 voiddrawDonut(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 intosegmentsequal wedges by separator lines, with AA rings on both edges.static voiddrawDonutSector(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radius, int innerRadius, int segments, int sector, int fill) Fills only wedgesectorof a segmented donut — the selection highlight overlay fordrawDonut(net.minecraft.client.gui.GuiGraphics, double, int, int, int, int, int, int, int).static voiddrawDonutSector(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 voiddrawDonutSectorArcs(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 voiddrawDonutSectorRotated(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 asegmentsdonut rotated byrotationDegabout(cx, cy)— for a slice sitting at an arbitrary (animated) angle rather than a fixed slot.static voiddrawPx(net.minecraft.client.gui.GuiGraphics g, double res, int cx, int cy, int radiusPx, int fill, int ring) Likedraw(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.
-
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.resis physical pixels per logical unit (seeUiContext.res). Passringwith zero alpha to skip the outline, orfillwith 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) Likedraw(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 intosegmentsequal wedges by separator lines, with AA rings on both edges.innerRadius0 makes a plain disc;segments0 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 wedgesectorof a segmented donut — the selection highlight overlay fordrawDonut(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 asegmentsdonut rotated byrotationDegabout(cx, cy)— for a slice sitting at an arbitrary (animated) angle rather than a fixed slot. PassarcsOnlyfor just the arc border. The radius is unchanged, so no per-angle re-bake.
-