public void drawDebug (ShapeRenderer shapes) { shapes.flush(); applyTransform(shapes, computeTransform()); if (ScissorStack.pushScissors(scissorBounds)) { drawDebugChildren(shapes); ScissorStack.popScissors(); } resetTransform(shapes); }
/** @see ScissorStack#calculateScissors(Camera, float, float, float, float, Matrix4, Rectangle, Rectangle) */ public void calculateScissors (Matrix4 batchTransform, Rectangle area, Rectangle scissor) { ScissorStack.calculateScissors(camera, screenX, screenY, screenWidth, screenHeight, batchTransform, area, scissor); }
fix(scissor);
Matrix4 batchTransform = new Matrix4(); batchTransform.translate(camera.position.x/background.getDepth(), camera.position.y/background.getDepth(), 0); ScissorStack.calculateScissors(camera, batchTransform, clipBounds, scissors); scissorCheck = ScissorStack.pushScissors(scissors); if(scissorCheck){ batch.flush(); ScissorStack.popScissors();
public void setClip(int x, int y, int w, int h) { Rectangle scissors = new Rectangle(); Rectangle clipBounds = new Rectangle(x, y, w, h); ScissorStack.calculateScissors(orthographicCamera, batch.getTransformMatrix(), clipBounds, scissors); ScissorStack.pushScissors(scissors); }
/** Ends clipping begun by {@link #clipBegin(float, float, float, float)}. */ public void clipEnd () { Pools.free(ScissorStack.popScissors()); }
/** Clips the specified screen aligned rectangle, specified relative to the transform matrix of the stage's Batch. The * transform matrix and the stage's camera must not have rotational components. Calling this method must be followed by a call * to {@link #clipEnd()} if true is returned. * @return false if the clipping area is zero and no drawing should occur. * @see ScissorStack */ public boolean clipBegin (float x, float y, float width, float height) { if (width <= 0 || height <= 0) return false; Rectangle tableBounds = Rectangle.tmp; tableBounds.x = x; tableBounds.y = y; tableBounds.width = width; tableBounds.height = height; Stage stage = this.stage; Rectangle scissorBounds = Pools.obtain(Rectangle.class); stage.calculateScissors(tableBounds, scissorBounds); if (ScissorStack.pushScissors(scissorBounds)) return true; Pools.free(scissorBounds); return false; }
/** Ends clipping begun by {@link #clipBegin(float, float, float, float)}. */ public void clipEnd () { Pools.free(ScissorStack.popScissors()); }
/** Clips the specified screen aligned rectangle, specified relative to the transform matrix of the stage's Batch. The * transform matrix and the stage's camera must not have rotational components. Calling this method must be followed by a call * to {@link #clipEnd()} if true is returned. * @return false if the clipping area is zero and no drawing should occur. * @see ScissorStack */ public boolean clipBegin (float x, float y, float width, float height) { if (width <= 0 || height <= 0) return false; Rectangle tableBounds = Rectangle.tmp; tableBounds.x = x; tableBounds.y = y; tableBounds.width = width; tableBounds.height = height; Stage stage = this.stage; Rectangle scissorBounds = Pools.obtain(Rectangle.class); stage.calculateScissors(tableBounds, scissorBounds); if (ScissorStack.pushScissors(scissorBounds)) return true; Pools.free(scissorBounds); return false; }
public void drawDebug (ShapeRenderer shapes) { shapes.flush(); applyTransform(shapes, computeTransform()); if (ScissorStack.pushScissors(scissorBounds)) { drawDebugChildren(shapes); ScissorStack.popScissors(); } resetTransform(shapes); }
public void resetClip() { ScissorStack.popScissors(); }
/** Clips the specified screen aligned rectangle, specified relative to the transform matrix of the stage's Batch. The * transform matrix and the stage's camera must not have rotational components. Calling this method must be followed by a call * to {@link #clipEnd()} if true is returned. * @return false if the clipping area is zero and no drawing should occur. * @see ScissorStack */ public boolean clipBegin (float x, float y, float width, float height) { if (width <= 0 || height <= 0) return false; Rectangle tableBounds = Rectangle.tmp; tableBounds.x = x; tableBounds.y = y; tableBounds.width = width; tableBounds.height = height; Stage stage = this.stage; Rectangle scissorBounds = Pools.obtain(Rectangle.class); stage.calculateScissors(tableBounds, scissorBounds); if (ScissorStack.pushScissors(scissorBounds)) return true; Pools.free(scissorBounds); return false; }
/** @see ScissorStack#calculateScissors(Camera, float, float, float, float, Matrix4, Rectangle, Rectangle) */ public void calculateScissors (Matrix4 batchTransform, Rectangle area, Rectangle scissor) { ScissorStack.calculateScissors(camera, screenX, screenY, screenWidth, screenHeight, batchTransform, area, scissor); }
fix(scissor);
@Override public void draw (Batch batch, float parentAlpha) { validate(); Color color = getColor(); float alpha = color.a * parentAlpha; applyTransform(batch, computeTransform()); if (firstWidget != null && firstWidget.isVisible()) { batch.flush(); getStage().calculateScissors(firstWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { firstWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } if (secondWidget != null && secondWidget.isVisible()) { batch.flush(); getStage().calculateScissors(secondWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { secondWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } batch.setColor(color.r, color.g, color.b, alpha); style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height); resetTransform(batch); }
/** Ends clipping begun by {@link #clipBegin(float, float, float, float)}. */ public void clipEnd () { Pools.free(ScissorStack.popScissors()); }
/** Calculates a scissor rectangle using 0,0,Gdx.graphics.getWidth(),Gdx.graphics.getHeight() as the viewport. * @see #calculateScissors(Camera, float, float, float, float, Matrix4, Rectangle, Rectangle) */ public static void calculateScissors (Camera camera, Matrix4 batchTransform, Rectangle area, Rectangle scissor) { calculateScissors(camera, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), batchTransform, area, scissor); }
fix(scissor);
@Override public void draw (Batch batch, float parentAlpha) { validate(); Color color = getColor(); float alpha = color.a * parentAlpha; applyTransform(batch, computeTransform()); if (firstWidget != null && firstWidget.isVisible()) { batch.flush(); getStage().calculateScissors(firstWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { firstWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } if (secondWidget != null && secondWidget.isVisible()) { batch.flush(); getStage().calculateScissors(secondWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { secondWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } batch.setColor(color.r, color.g, color.b, alpha); style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height); resetTransform(batch); }
/** Calculates a scissor rectangle using 0,0,Gdx.graphics.getWidth(),Gdx.graphics.getHeight() as the viewport. * @see #calculateScissors(Camera, float, float, float, float, Matrix4, Rectangle, Rectangle) */ public static void calculateScissors (Camera camera, Matrix4 batchTransform, Rectangle area, Rectangle scissor) { calculateScissors(camera, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), batchTransform, area, scissor); }