Class Scissors

java.lang.Object
io.github.cottonmc.cotton.gui.client.Scissors

@Environment(CLIENT) public final class Scissors extends Object
Contains a stack for GL scissors for restricting the drawn area of a widget.
Since:
2.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A single scissor frame in the stack.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    pop()
    Pops the topmost scissor frame and refreshes the scissored area.
    push(int x, int y, int width, int height)
    Pushes a new scissor frame onto the stack and refreshes the scissored area.
    push(@Nullable DrawContext context, int x, int y, int width, int height)
    Pushes a new scissor frame onto the stack and refreshes the scissored area.

    Methods inherited from class java.lang.Object

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

    • push

      public static Scissors.Frame push(int x, int y, int width, int height)
      Pushes a new scissor frame onto the stack and refreshes the scissored area.
      Parameters:
      x - the frame's X coordinate
      y - the frame's Y coordinate
      width - the frame's width in pixels
      height - the frame's height in pixels
      Returns:
      the pushed frame
    • push

      public static Scissors.Frame push(@Nullable @Nullable DrawContext context, int x, int y, int width, int height)
      Pushes a new scissor frame onto the stack and refreshes the scissored area.

      If the draw context is not null, any buffered content in it will be drawn when refreshing the scissor state.

      Parameters:
      context - the associated draw context, or null if not provided
      x - the frame's X coordinate
      y - the frame's Y coordinate
      width - the frame's width in pixels
      height - the frame's height in pixels
      Returns:
      the pushed frame
    • pop

      public static void pop()
      Pops the topmost scissor frame and refreshes the scissored area.
      Throws:
      IllegalStateException - if there are no scissor frames on the stack