Method CreateNinePatchSlice
CreateNinePatchSlice(string, Rectangle, Rectangle, Vector2, Color)
Creates and adds a new NinePatchSlice element to this TextureRegion.
public NinePatchSlice CreateNinePatchSlice(string name, Rectangle bounds, Rectangle centerBounds, Vector2 origin, Color color)
Parameters
name
stringThe name to assign the NinePatchSlice that is created by this method. The name must be unique across all Slice elements in this TextureRegion.
bounds
RectangleThe bounds to assign the NinePatchSlice created by this method. This should be relative to the bounds of this TextureRegion.
centerBounds
RectangleThe center bounds to assign the NinePatchSlice created by this method. This should be relative to the
bounds
.origin
Vector2The x- and y-coordinate origin point to assign the NinePatchSlice created by this method. This should be relative to the upper-left corner of the bounds of this TextureRegion.
color
ColorA Microsoft.Xna.Framework.Color value to assign the NinePatchSlice created by this method.
Returns
- NinePatchSlice
The NinePatchSlice created by this method.
Exceptions
- InvalidOperationException
Thrown if this TextureRegion already contains a Slice with the specified name.