draw() public method

If this method is overridden, the super method or {@link #validate()} should be called to ensure the widget is laid out.
public draw ( Graphics graphics, float parentAlpha ) : void
graphics Graphics Graphics.
parentAlpha float Parent alpha.
return void
Esempio n. 1
0
        public override void draw(Graphics graphics, float parentAlpha)
        {
            validate();

            if (transform)
            {
                applyTransform(graphics, computeTransform());
            }
            if (_firstWidget != null && _firstWidget.isVisible())
            {
                var scissor = ScissorStack.calculateScissors(
                    stage?.camera,
                    graphics.batcher.transformMatrix,
                    _firstWidgetBounds);
                if (ScissorStack.pushScissors(scissor))
                {
                    graphics.batcher.enableScissorTest(true);
                    _firstWidget.draw(graphics, parentAlpha * color.A);
                    graphics.batcher.enableScissorTest(false);
                    ScissorStack.popScissors();
                }
            }

            if (_secondWidget != null && _secondWidget.isVisible())
            {
                var scissor = ScissorStack.calculateScissors(
                    stage?.camera,
                    graphics.batcher.transformMatrix,
                    _secondWidgetBounds);
                if (ScissorStack.pushScissors(scissor))
                {
                    graphics.batcher.enableScissorTest(true);
                    _secondWidget.draw(graphics, parentAlpha * color.A);
                    graphics.batcher.enableScissorTest(false);
                    ScissorStack.popScissors();
                }
            }

            _style.handle.draw(
                graphics,
                _handleBounds.x,
                _handleBounds.y,
                _handleBounds.width,
                _handleBounds.height,
                new Color(color, (int)(color.A * parentAlpha)));

            if (transform)
            {
                resetTransform(graphics);
            }
        }
Esempio n. 2
0
        public override void draw(Graphics graphics, float parentAlpha)
        {
            validate();

            if (transform)
            {
                applyTransform(graphics, computeTransform());
            }
            if (_firstWidget != null)
            {
                //batch.flush();
                //getStage().calculateScissors(firstWidgetBounds, firstScissors);
                //if (ScissorStack.pushScissors(firstScissors))
                {
                    if (_firstWidget.isVisible())
                    {
                        _firstWidget.draw(graphics, parentAlpha * color.A);
                    }
                    //batch.flush();
                    //ScissorStack.popScissors();
                }
            }

            if (_secondWidget != null)
            {
                //batch.flush();
                //getStage().calculateScissors( secondWidgetBounds, secondScissors );
                //if( ScissorStack.pushScissors( secondScissors ) )
                {
                    if (_secondWidget.isVisible())
                    {
                        _secondWidget.draw(graphics, parentAlpha * color.A);
                    }
                    //batch.flush();
                    //ScissorStack.popScissors();
                }
            }

            _style.handle.draw(graphics, _handleBounds.x, _handleBounds.y, _handleBounds.width, _handleBounds.height, new Color(color, color.A * parentAlpha));

            if (transform)
            {
                resetTransform(graphics);
            }
        }