Class ScissorStack

java.lang.Object
foundry.veil.api.client.util.ScissorStack

public final class ScissorStack extends Object
A utility class to manage scissor clipping regions. This allows for restricting rendering to specific rectangular areas.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all scissored regions and disables scissoring.
    boolean
    containsPoint(float x, float y)
    Checks if the current scissor region contains the x, y point.
    @Nullable net.minecraft.client.gui.navigation.ScreenRectangle
     
    boolean
     
    void
    pop()
    Removes the top scissor clipping region from the stack.
    void
    push(float x, float y, float width, float height)
    Pushes a new scissor clipping region onto the stack.
    void
    push(int x, int y, int width, int height)
    Pushes a new scissor clipping region onto the stack.
    int
     

    Methods inherited from class java.lang.Object

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

    • ScissorStack

      public ScissorStack()
  • Method Details

    • push

      public void push(int x, int y, int width, int height)
      Pushes a new scissor clipping region onto the stack. The region is automatically constrained by any existing regions on the stack.
      Parameters:
      x - The x-coordinate of the top-left corner
      y - The y-coordinate of the top-left corner
      width - The width of the region
      height - The height of the region
    • push

      public void push(float x, float y, float width, float height)
      Pushes a new scissor clipping region onto the stack. The region is automatically constrained by any existing regions on the stack.
      Parameters:
      x - The x-coordinate of the top-left corner
      y - The y-coordinate of the top-left corner
      width - The width of the region
      height - The height of the region
      Since:
      1.3.0
    • pop

      public void pop()
      Removes the top scissor clipping region from the stack. If there are any regions remaining, the previous region is reapplied.
    • getTop

      @Nullable public @Nullable net.minecraft.client.gui.navigation.ScreenRectangle getTop()
      Returns:
      The top of the scissor stack or null if scissoring is disabled
      Since:
      1.3.0
    • containsPoint

      public boolean containsPoint(float x, float y)
      Checks if the current scissor region contains the x, y point.
      Parameters:
      x - The x position to check
      y - The y position to check
      Returns:
      Whether that position is contained in the scissor bounds
      Since:
      1.3.0
    • size

      public int size()
      Returns:
      The number of regions in the stack
      Since:
      1.3.0
    • isEmpty

      public boolean isEmpty()
      Returns:
      Whether all regions have been popped
      Since:
      1.3.0
    • clear

      public void clear()
      Clears all scissored regions and disables scissoring.
      Since:
      1.3.0