Class Scissors
java.lang.Object
io.github.cottonmc.cotton.gui.client.Scissors
Contains a stack for GL scissors for restricting the drawn area of a widget.
- Since:
- 2.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A single scissor frame in the stack. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
pop()
Pops the topmost scissor frame and refreshes the scissored area.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.static Scissors.Frame
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.
-
Method Details
-
push
Pushes a new scissor frame onto the stack and refreshes the scissored area.- Parameters:
x
- the frame's X coordinatey
- the frame's Y coordinatewidth
- the frame's width in pixelsheight
- 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 providedx
- the frame's X coordinatey
- the frame's Y coordinatewidth
- the frame's width in pixelsheight
- 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
-