MonoGdx.Graphics.G2D.NinePatch.Draw C# (CSharp) Method

Draw() public method

public Draw ( GdxSpriteBatch spriteBatch, float x, float y, float width, float height ) : void
spriteBatch GdxSpriteBatch
x float
y float
width float
height float
return void
        public void Draw(GdxSpriteBatch spriteBatch, float x, float y, float width, float height)
        {
            float centerColX = x + LeftWidth;
            float rightColX = x + width - RightWidth;
            float middleRowY = y + BottomHeight;
            float topRowY = y + height - TopHeight;

            Color color = ColorExt.Multiply(Color, spriteBatch.Color);
            color = Color.FromNonPremultiplied(color.R, color.G, color.B, color.A);

            if (_bottomLeft != -1)
                Set(_bottomLeft, x, y, centerColX - x, middleRowY - y, color);
            if (_bottomCenter != -1)
                Set(_bottomCenter, centerColX, y, rightColX - centerColX, middleRowY - y, color);
            if (_bottomRight != -1)
                Set(_bottomRight, rightColX, y, x + width - rightColX, middleRowY - y, color);
            if (_middleLeft != -1)
                Set(_middleLeft, x, middleRowY, centerColX - x, topRowY - middleRowY, color);
            if (_middleCenter != -1)
                Set(_middleCenter, centerColX, middleRowY, rightColX - centerColX, topRowY - middleRowY, color);
            if (_middleRight != -1)
                Set(_middleRight, rightColX, middleRowY, x + width - rightColX, topRowY - middleRowY, color);
            if (_topLeft != -1)
                Set(_topLeft, x, topRowY, centerColX - x, y + height - topRowY, color);
            if (_topCenter != -1)
                Set(_topCenter, centerColX, topRowY, rightColX - centerColX, y + height - topRowY, color);
            if (_topRight != -1)
                Set(_topRight, rightColX, topRowY, x + width - rightColX, y + height - topRowY, color);

            spriteBatch.Draw(Texture, _vertices, 0, _index);
        }