Example #1
0
        public NinePatch(NinePatch ninePatch, Color color)
            : this()
        {
            Texture = ninePatch.Texture;

            _bottomLeft   = ninePatch._bottomLeft;
            _bottomCenter = ninePatch._bottomCenter;
            _bottomRight  = ninePatch._bottomRight;
            _middleLeft   = ninePatch._middleLeft;
            _middleCenter = ninePatch._middleCenter;
            _middleRight  = ninePatch._middleRight;
            _topLeft      = ninePatch._topLeft;
            _topCenter    = ninePatch._topCenter;
            _topRight     = ninePatch._topRight;

            LeftWidth    = ninePatch.LeftWidth;
            RightWidth   = ninePatch.RightWidth;
            MiddleWidth  = ninePatch.MiddleWidth;
            MiddleHeight = ninePatch.MiddleHeight;
            TopHeight    = ninePatch.TopHeight;
            BottomHeight = ninePatch.BottomHeight;

            _vertices = new VertexPositionColorTexture[ninePatch._vertices.Length];
            _index    = ninePatch._index;
            Array.Copy(ninePatch._vertices, _vertices, _vertices.Length);

            Color = ninePatch.Color;
        }
Example #2
0
        public NinePatch CreatePatch(string name)
        {
            foreach (AtlasRegion region in Regions)
            {
                if (region.Name == name)
                {
                    int[] splits = region.Splits;
                    if (splits == null)
                    {
                        throw new ArgumentException("Region does not have ninepatch splits: " + name);
                    }

                    NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
                    if (region.Pads != null)
                    {
                        patch.SetPadding(region.Pads[0], region.Pads[1], region.Pads[2], region.Pads[3]);
                    }

                    return(patch);
                }
            }

            return(null);
        }
Example #3
0
 public NinePatch(NinePatch ninePatch)
     : this(ninePatch, ninePatch.Color)
 {
 }
Example #4
0
 public Image(NinePatch patch)
     : this(new NinePatchDrawable(patch), Scaling.Stretch, Alignment.Center)
 {
 }
Example #5
0
        public NinePatch CreatePatch(string name)
        {
            foreach (AtlasRegion region in Regions) {
                if (region.Name == name) {
                    int[] splits = region.Splits;
                    if (splits == null)
                        throw new ArgumentException("Region does not have ninepatch splits: " + name);

                    NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
                    if (region.Pads != null)
                        patch.SetPadding(region.Pads[0], region.Pads[1], region.Pads[2], region.Pads[3]);

                    return patch;
                }
            }

            return null;
        }
Example #6
0
 public NinePatchDrawable(NinePatch patch)
 {
     Patch = patch;
 }
Example #7
0
        public NinePatch(NinePatch ninePatch, Color color)
            : this()
        {
            Texture = ninePatch.Texture;

            _bottomLeft = ninePatch._bottomLeft;
            _bottomCenter = ninePatch._bottomCenter;
            _bottomRight = ninePatch._bottomRight;
            _middleLeft = ninePatch._middleLeft;
            _middleCenter = ninePatch._middleCenter;
            _middleRight = ninePatch._middleRight;
            _topLeft = ninePatch._topLeft;
            _topCenter = ninePatch._topCenter;
            _topRight = ninePatch._topRight;

            LeftWidth = ninePatch.LeftWidth;
            RightWidth = ninePatch.RightWidth;
            MiddleWidth = ninePatch.MiddleWidth;
            MiddleHeight = ninePatch.MiddleHeight;
            TopHeight = ninePatch.TopHeight;
            BottomHeight = ninePatch.BottomHeight;

            _vertices = new VertexPositionColorTexture[ninePatch._vertices.Length];
            _index = ninePatch._index;
            Array.Copy(ninePatch._vertices, _vertices, _vertices.Length);

            Color = ninePatch.Color;
        }
Example #8
0
 public NinePatch(NinePatch ninePatch)
     : this(ninePatch, ninePatch.Color)
 {
 }