/** 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; }
/** 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 drawDebug (ShapeRenderer shapes) { shapes.flush(); applyTransform(shapes, computeTransform()); if (ScissorStack.pushScissors(scissorBounds)) { drawDebugChildren(shapes); ScissorStack.popScissors(); } resetTransform(shapes); }
@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); }
@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); }
@Override public void draw (Batch batch, float parentAlpha) { if (widget == null) return; validate(); // Setup transform for this group. applyTransform(batch, computeTransform()); if (scrollX) hKnobBounds.x = hScrollBounds.x + (int)((hScrollBounds.width - hKnobBounds.width) * getVisualScrollPercentX()); if (scrollY) vKnobBounds.y = vScrollBounds.y + (int)((vScrollBounds.height - vKnobBounds.height) * (1 - getVisualScrollPercentY())); updateWidgetPosition(); // Draw the background ninepatch. Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); if (style.background != null) style.background.draw(batch, 0, 0, getWidth(), getHeight()); // Caculate the scissor bounds based on the batch transform, the available widget area and the camera transform. We need to // project those to screen coordinates for OpenGL ES to consume. getStage().calculateScissors(widgetAreaBounds, scissorBounds); // Enable scissors for widget area and draw the widget. batch.flush(); if (ScissorStack.pushScissors(scissorBounds)) { drawChildren(batch, parentAlpha); batch.flush(); ScissorStack.popScissors(); } // Render scrollbars and knobs on top if they will be visible float alpha = color.a * parentAlpha * Interpolation.fade.apply(fadeAlpha / fadeAlphaSeconds); drawScrollBars(batch, color.r, color.g, color.b, alpha); resetTransform(batch); }
@Override public void draw (Batch batch, float parentAlpha) { if (widget == null) return; validate(); // Setup transform for this group. applyTransform(batch, computeTransform()); if (scrollX) hKnobBounds.x = hScrollBounds.x + (int)((hScrollBounds.width - hKnobBounds.width) * getVisualScrollPercentX()); if (scrollY) vKnobBounds.y = vScrollBounds.y + (int)((vScrollBounds.height - vKnobBounds.height) * (1 - getVisualScrollPercentY())); updateWidgetPosition(); // Draw the background ninepatch. Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); if (style.background != null) style.background.draw(batch, 0, 0, getWidth(), getHeight()); // Caculate the scissor bounds based on the batch transform, the available widget area and the camera transform. We need to // project those to screen coordinates for OpenGL ES to consume. getStage().calculateScissors(widgetAreaBounds, scissorBounds); // Enable scissors for widget area and draw the widget. batch.flush(); if (ScissorStack.pushScissors(scissorBounds)) { drawChildren(batch, parentAlpha); batch.flush(); ScissorStack.popScissors(); } // Render scrollbars and knobs on top if they will be visible float alpha = color.a * parentAlpha * Interpolation.fade.apply(fadeAlpha / fadeAlphaSeconds); drawScrollBars(batch, color.r, color.g, color.b, alpha); resetTransform(batch); }
/** 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 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); }
public void drawDebug (ShapeRenderer shapes) { shapes.flush(); applyTransform(shapes, computeTransform()); if (ScissorStack.pushScissors(scissorBounds)) { drawDebugChildren(shapes); ScissorStack.popScissors(); } resetTransform(shapes); }
@Override public void draw(Batch batch, float parentAlpha) { batch.flush(); getStage().calculateScissors(widgetAreaBounds.set(getX(), getY(), getWidth(), getHeight()), scissorBounds); if (ScissorStack.pushScissors(scissorBounds)) { super.draw(batch, parentAlpha); batch.flush(); ScissorStack.popScissors(); } }
@Override public void draw (Batch batch, float parentAlpha) { validate(); Color color = getColor(); applyTransform(batch, computeTransform()); // Matrix4 transform = batch.getTransformMatrix(); if (firstWidget != null) { getStage().calculateScissors(firstWidgetBounds, firstScissors); if (ScissorStack.pushScissors(firstScissors)) { if (firstWidget.isVisible()) firstWidget.draw(batch, parentAlpha * color.a); batch.flush(); ScissorStack.popScissors(); } } if (secondWidget != null) { getStage().calculateScissors(secondWidgetBounds, secondScissors); if (ScissorStack.pushScissors(secondScissors)) { if (secondWidget.isVisible()) secondWidget.draw(batch, parentAlpha * color.a); batch.flush(); ScissorStack.popScissors(); } } Drawable handle = style.handle; if (mouseOnHandle && isTouchable() && style.handleOver != null) handle = style.handleOver; batch.setColor(color.r, color.g, color.b, parentAlpha * color.a); handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height); resetTransform(batch); }
@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); }
@Override public void draw(Batch batch, float parentAlpha) { validate(); Color color = getColor(); applyTransform(batch, computeTransform()); // Matrix4 transform = batch.getTransformMatrix(); if (firstWidget != null) { getStage().calculateScissors(firstWidgetBounds, firstScissors); if (ScissorStack.pushScissors(firstScissors)) { if (firstWidget.isVisible()) firstWidget.draw(batch, parentAlpha * color.a); batch.flush(); ScissorStack.popScissors(); } } if (secondWidget != null) { getStage().calculateScissors(secondWidgetBounds, secondScissors); if (ScissorStack.pushScissors(secondScissors)) { if (secondWidget.isVisible()) secondWidget.draw(batch, parentAlpha * color.a); batch.flush(); ScissorStack.popScissors(); } } Drawable handle = style.handle; if (mouseOnHandle && isTouchable() && style.handleOver != null) handle = style.handleOver; batch.setColor(color.r, color.g, color.b, parentAlpha * color.a); handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height); resetTransform(batch); }
@Override public void draw (Batch batch, float parentAlpha) { validate(); Color color = getColor(); applyTransform(batch, computeTransform()); SnapshotArray<Actor> actors = getChildren(); for (int i = 0; i < actors.size; i++) { Actor actor = actors.get(i); Rectangle bounds = widgetBounds.get(i); Rectangle scissor = scissors.get(i); getStage().calculateScissors(bounds, scissor); if (ScissorStack.pushScissors(scissor)) { if (actor.isVisible()) actor.draw(batch, parentAlpha * color.a); batch.flush(); ScissorStack.popScissors(); } } batch.setColor(color.r, color.g, color.b, parentAlpha * color.a); Drawable handle = style.handle; Drawable handleOver = style.handle; if (isTouchable() && style.handleOver != null) handleOver = style.handleOver; for (Rectangle rect : handleBounds) { if (this.handleOver == rect) { handleOver.draw(batch, rect.x, rect.y, rect.width, rect.height); } else { handle.draw(batch, rect.x, rect.y, rect.width, rect.height); } } resetTransform(batch); }
@Override public void draw (Batch batch, float parentAlpha) { if (widget == null) return; validate(); // Setup transform for this group. applyTransform(batch, computeTransform()); if (scrollX) hKnobBounds.x = hScrollBounds.x + (int)((hScrollBounds.width - hKnobBounds.width) * getVisualScrollPercentX()); if (scrollY) vKnobBounds.y = vScrollBounds.y + (int)((vScrollBounds.height - vKnobBounds.height) * (1 - getVisualScrollPercentY())); updateWidgetPosition(); // Draw the background ninepatch. Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); if (style.background != null) style.background.draw(batch, 0, 0, getWidth(), getHeight()); // Caculate the scissor bounds based on the batch transform, the available widget area and the camera transform. We need to // project those to screen coordinates for OpenGL ES to consume. getStage().calculateScissors(widgetAreaBounds, scissorBounds); // Enable scissors for widget area and draw the widget. batch.flush(); if (ScissorStack.pushScissors(scissorBounds)) { drawChildren(batch, parentAlpha); batch.flush(); ScissorStack.popScissors(); } // Render scrollbars and knobs on top if they will be visible float alpha = color.a * parentAlpha * Interpolation.fade.apply(fadeAlpha / fadeAlphaSeconds); drawScrollBars(batch, color.r, color.g, color.b, alpha); resetTransform(batch); }
@Override public void draw(Batch batch, float parentAlpha) { validate(); Color color = getColor(); applyTransform(batch, computeTransform()); SnapshotArray<Actor> actors = getChildren(); for (int i = 0; i < actors.size; i++) { Actor actor = actors.get(i); Rectangle bounds = widgetBounds.get(i); Rectangle scissor = scissors.get(i); getStage().calculateScissors(bounds, scissor); if (ScissorStack.pushScissors(scissor)) { if (actor.isVisible()) actor.draw(batch, parentAlpha * color.a); batch.flush(); ScissorStack.popScissors(); } } batch.setColor(color.r, color.g, color.b, parentAlpha * color.a); Drawable handle = style.handle; Drawable handleOver = style.handle; if (isTouchable() && style.handleOver != null) handleOver = style.handleOver; for (Rectangle rect : handleBounds) { if (this.handleOver == rect) { handleOver.draw(batch, rect.x, rect.y, rect.width, rect.height); } else { handle.draw(batch, rect.x, rect.y, rect.width, rect.height); } } resetTransform(batch); }
batchTransform.translate(camera.position.x/background.getDepth(), camera.position.y/background.getDepth(), 0); ScissorStack.calculateScissors(camera, batchTransform, clipBounds, scissors); scissorCheck = ScissorStack.pushScissors(scissors);
if (ScissorStack.pushScissors(scissors)) {