Struct TextureRegion
A named rectangle within a texture, in pixels.
public readonly struct TextureRegion
- Inherited Members
Constructors
TextureRegion(int, int, int, int)
Creates an unnamed region.
public TextureRegion(int x, int y, int width, int height)
Parameters
TextureRegion(int, int, Vector2)
Creates an unnamed region of size, with the size truncated to whole pixels.
public TextureRegion(int x, int y, Vector2 size)
Parameters
TextureRegion(Vector2, int, int)
Creates an unnamed region at position, with the position truncated to whole pixels.
public TextureRegion(Vector2 position, int width, int height)
Parameters
TextureRegion(Vector2, Vector2)
Creates an unnamed region at position of size, both truncated to whole pixels.
public TextureRegion(Vector2 position, Vector2 size)
Parameters
TextureRegion(string, int, int, int, int)
Creates a region named name.
public TextureRegion(string name, int x, int y, int width, int height)
Parameters
TextureRegion(string, int, int, Vector2)
Creates a region named name of size, with the size truncated to whole pixels.
public TextureRegion(string name, int x, int y, Vector2 size)
Parameters
TextureRegion(string, Vector2, int, int)
Creates a region named name at position, with the position truncated to whole pixels.
public TextureRegion(string name, Vector2 position, int width, int height)
Parameters
TextureRegion(string, Vector2, Vector2)
Creates a region named name at position of size, both truncated to whole pixels.
public TextureRegion(string name, Vector2 position, Vector2 size)
Parameters
Properties
Bounds
The region as a Rectangle.
public Rectangle Bounds { get; }
Property Value
Height
The height.
public int Height { get; }
Property Value
Name
The name of the region. Empty when the region is unnamed.
public string Name { get; }
Property Value
Position
public Vector2 Position { get; }
Property Value
Size
The width and height, as a vector.
public Vector2 Size { get; }
Property Value
Width
The width.
public int Width { get; }
Property Value
X
The x coordinate of the left edge.
public int X { get; }
Property Value
Y
The y coordinate of the top edge.
public int Y { get; }
Property Value
Operators
implicit operator Rectangle(TextureRegion)
Converts the region to its Rectangle bounds.
public static implicit operator Rectangle(TextureRegion region)
Parameters
regionTextureRegion