예제 #1
0
        public void RenderBorderBack(AGSBoundingBox square)
        {
            runAnimation();

            if (!FillBackground)
            {
                return;
            }

            var slice  = Slice.ToPercentage(_width, _height);
            var width  = Width.ToPixels(_width, _height);
            var outset = Outset.ToPixels(_width, _height);

            float farLeft   = square.TopLeft.X - outset.Left.Value;
            float farRight  = square.TopRight.X + outset.Right.Value;
            float farTop    = square.TopLeft.Y + outset.Top.Value;
            float farBottom = square.BottomLeft.Y - outset.Bottom.Value;

            var quad = new AGSBoundingBox(new Vector2(farLeft + width.Left.Value, farBottom + width.Bottom.Value),
                                          new Vector2(farRight - width.Right.Value, farBottom + width.Bottom.Value),
                                          new Vector2(farLeft + width.Left.Value, farTop - width.Top.Value),
                                          new Vector2(farRight - width.Right.Value, farTop - width.Top.Value));

            drawQuad(quad, new FourCorners <Vector2> (new Vector2(slice.Left.Value, slice.Bottom.Value),
                                                      new Vector2(1f - slice.Right.Value, slice.Bottom.Value), new Vector2(slice.Left.Value, 1f - slice.Top.Value),
                                                      new Vector2(1f - slice.Right.Value, 1f - slice.Top.Value)));

            if (DrawBorderBehind)
            {
                drawBorders(square);
            }
        }
예제 #2
0
        private void drawBorders(AGSBoundingBox square)
        {
            var slice  = Slice.ToPercentage(_width, _height);
            var width  = Width.ToPixels(_width, _height);
            var outset = Outset.ToPixels(_width, _height);

            float       farLeft   = square.TopLeft.X - outset.Left.Value;
            float       farRight  = square.TopRight.X + outset.Right.Value;
            float       farTop    = square.TopLeft.Y + outset.Top.Value;
            float       farBottom = square.BottomLeft.Y - outset.Bottom.Value;
            SliceValues border    = new SliceValues(SliceMeasurement.Pixels, farLeft, farRight, farTop, farBottom);

            drawCorners(border, slice, width);
            switch (Repeat)
            {
            case BorderRepeat.Repeat:
            case BorderRepeat.Round:
            case BorderRepeat.Space:
                drawEdges(border, slice, width, Repeat);
                break;

            case BorderRepeat.Stretch:
                drawStretch(border, slice, width);
                break;

            default:
                throw new NotSupportedException(Repeat.ToString());
            }
        }