Пример #1
0
        public NinePatch(TextureSlice tex, int left, int right, int top, int bottom)
        {
            size        = new Point2D(tex.Width, tex.Height);
            patchBounds = Rect.FromLTRB(left, top, right, bottom);
            var textureBounds = new Rect(0, 0, tex.Width, tex.Height);

            patches = SplitToPatches(textureBounds, patchBounds)
                      .Select(x => tex.Slice(x))
                      .ToArray();
        }
Пример #2
0
        public Picture(TextureSlice tex, BitArray hitmask)
        {
            if (hitmask != null && hitmask.Count != tex.Width * tex.Height)
            {
                throw new ArgumentException("Invalid hitmask size");
            }

            this.tex     = tex;
            this.hitmask = hitmask;
            this.size    = new Point2D(tex.Width, tex.Height);
        }