Method CreateSlice
CreateSlice(string, Rectangle, Vector2, Color)
Creates and adds a new Slice element to this TextureRegion.
public Slice CreateSlice(string name, Rectangle bounds, Vector2 origin, Color color)
Parameters
name
stringThe name to assign the Slice that is created by this method. The name must be unique across all Slice elements in this TextureRegion.
bounds
RectangleThe bounds to assign the Slice created by this method. This should be relative to the bounds of this TextureRegion.
origin
Vector2The x- and y-coordinate origin point to assign the Slice 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 Slice created by this method.
Returns
Exceptions
- InvalidOperationException
Thrown if this TextureRegion already contains a Slice with the specified name.