Class ScissorStack
java.lang.Object
lol.trq.helios.state.ScissorStack
Nested clipping rectangles in drawing units, each clipped to the one outside it.
Drawing units are screen space with the origin at the top left, and pixel is one framebuffer pixel in
those units. The first push(float, float, float, float, float) saves the scissor state; the last pop() restores it. A clip covers every
pixel the rectangle touches.
-
Constructor Summary
ConstructorsConstructorDescriptionScissorStack(GlBackend gl, GlStateCache cache, SurfaceSize surface) Creates a stack. -
Method Summary
Modifier and TypeMethodDescriptionintdepth()Returns how many clips are pushed.voidpop()Returns to the previous clip, or to the state before the first push.voidpush(float x, float y, float width, float height, float pixel) Clips further drawing to a rectangle, inside the current clip.static int[]toPixels(float x, float y, float width, float height, float pixel, int framebufferHeight) Converts a rectangle in drawing units to a scissor box, rounding outward.
-
Constructor Details
-
ScissorStack
Creates a stack.- Parameters:
gl- the backendcache- the host's state cachesurface- the window framebuffer size
-
-
Method Details
-
push
public void push(float x, float y, float width, float height, float pixel) Clips further drawing to a rectangle, inside the current clip.- Parameters:
x- lefty- topwidth- widthheight- heightpixel- one framebuffer pixel in drawing units
-
pop
public void pop()Returns to the previous clip, or to the state before the first push. -
depth
public int depth()Returns how many clips are pushed.- Returns:
- the depth
-
toPixels
public static int[] toPixels(float x, float y, float width, float height, float pixel, int framebufferHeight) Converts a rectangle in drawing units to a scissor box, rounding outward.- Parameters:
x- lefty- topwidth- widthheight- heightpixel- one framebuffer pixel in drawing unitsframebufferHeight- the framebuffer height in pixels- Returns:
{x, y, width, height}in pixels, y from the bottom, never negative in size
-