Class Outline

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.utils.Outline

public final class Outline extends Object
How a rectangular outline looks: a solid color or an animated ColorGradient (a rainbow, or colors of your own), its thickness, and how far it sits outside the rectangle. Immutable; the with... methods return copies.

Draw it yourself with draw(GuiGraphicsExtractor, ScreenRectangle), or attach it to a widget with ElementOutlines.

For a gradient outline the spread is measured around the outline: 1 puts the whole gradient once around it whatever its size, 2 puts it twice. The colors run clockwise from the top-left corner.

  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    void
    draw(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height)
    Draws around the rectangle at (x, y) of the given size, grown by the padding.
    void
    draw(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.navigation.ScreenRectangle rectangle)
     
    @Nullable ColorGradient
    The gradient, or null for a solid outline.
    static Outline
    A 1 pixel outline in an animated gradient; see the class docs for how its spread applies.
    int
     
    static Outline
    A 1 pixel outline with one full, animated rainbow around it.
    int
     
    static Outline
    solid(int color)
    A 1 pixel outline in one ARGB color.
    int
     
    withColor(int color)
    A solid outline's color, or the alpha multiplier (its alpha byte) for a gradient outline.
    withPadding(int padding)
    Pixels between the rectangle and the outline; negative draws inside it.
    withSegmentLength(int segment)
    Length in pixels of each single-colored piece of a gradient outline (2 by default).
    withThickness(int thickness)
    Line width in pixels, at least 1.

    Methods inherited from class Object

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

    • solid

      public static Outline solid(int color)
      A 1 pixel outline in one ARGB color.
    • rainbow

      public static Outline rainbow()
      A 1 pixel outline with one full, animated rainbow around it.
    • gradient

      public static Outline gradient(ColorGradient gradient)
      A 1 pixel outline in an animated gradient; see the class docs for how its spread applies.
    • withThickness

      public Outline withThickness(int thickness)
      Line width in pixels, at least 1.
    • withPadding

      public Outline withPadding(int padding)
      Pixels between the rectangle and the outline; negative draws inside it.
    • withSegmentLength

      public Outline withSegmentLength(int segment)
      Length in pixels of each single-colored piece of a gradient outline (2 by default). Longer pieces are fewer draws but show visible steps.
    • withColor

      public Outline withColor(int color)
      A solid outline's color, or the alpha multiplier (its alpha byte) for a gradient outline.
    • color

      public int color()
    • getGradient

      @Nullable public @Nullable ColorGradient getGradient()
      The gradient, or null for a solid outline.
    • thickness

      public int thickness()
    • padding

      public int padding()
    • segmentLength

      public int segmentLength()
    • draw

      public void draw(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.navigation.ScreenRectangle rectangle)
    • draw

      public void draw(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height)
      Draws around the rectangle at (x, y) of the given size, grown by the padding.