Exemple #1
0
        public override void Draw(Batcher batcher, float parentAlpha)
        {
            Validate();

            if (transform)
            {
                ApplyTransform(batcher, ComputeTransform());
            }
            if (_firstWidget != null && _firstWidget.IsVisible())
            {
                var scissor = ScissorStack.CalculateScissors(_stage?.Camera, batcher.TransformMatrix, _firstWidgetBounds);
                if (ScissorStack.PushScissors(scissor))
                {
                    batcher.EnableScissorTest(true);
                    _firstWidget.Draw(batcher, parentAlpha * color.A);
                    batcher.EnableScissorTest(false);
                    ScissorStack.PopScissors();
                }
            }

            if (_secondWidget != null && _secondWidget.IsVisible())
            {
                var scissor = ScissorStack.CalculateScissors(_stage?.Camera, batcher.TransformMatrix,
                                                             _secondWidgetBounds);
                if (ScissorStack.PushScissors(scissor))
                {
                    batcher.EnableScissorTest(true);
                    _secondWidget.Draw(batcher, parentAlpha * color.A);
                    batcher.EnableScissorTest(false);
                    ScissorStack.PopScissors();
                }
            }

            _style.Handle.Draw(batcher, _handleBounds.X, _handleBounds.Y, _handleBounds.Width, _handleBounds.Height,
                               new Color(color, (int)(color.A * parentAlpha)));

            if (transform)
            {
                ResetTransform(batcher);
            }
        }
Exemple #2
0
        /// <summary>
        /// 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 clipEnd() if true is returned.
        /// </summary>
        public bool ClipBegin(Batcher batcher, float x, float y, float width, float height)
        {
            if (width <= 0 || height <= 0)
            {
                return(false);
            }

            var tableBounds   = RectangleExt.FromFloats(x, y, width, height);
            var scissorBounds = ScissorStack.CalculateScissors(stage?.Entity?.Scene?.Camera, batcher.TransformMatrix, tableBounds);

            if (ScissorStack.PushScissors(scissorBounds))
            {
                batcher.EnableScissorTest(true);
                return(true);
            }

            return(false);
        }
Exemple #3
0
 /// <summary>
 /// Ends clipping begun by clipBegin(Batcher, float, float, float, float)
 /// </summary>
 /// <returns>The end.</returns>
 public void ClipEnd(Batcher batcher)
 {
     batcher.EnableScissorTest(false);
     ScissorStack.PopScissors();
 }