Click or drag to resize
DigitalRunePackedTexture Class
Defines a texture which has been packed into a texture atlas.
Inheritance Hierarchy
SystemObject
  DigitalRune.GraphicsPackedTexture

Namespace: DigitalRune.Graphics
Assembly: DigitalRune.Graphics (in DigitalRune.Graphics.dll) Version: 1.2.0.0 (1.2.1.14562)
Syntax
public class PackedTexture : INamedObject

The PackedTexture type exposes the following members.

Constructors
  NameDescription
Public methodPackedTexture(Texture2D)
Initializes a new instance of the PackedTexture class for a single texture.
Public methodPackedTexture(String, Texture2D, Vector2F, Vector2F)
Initializes a new instance of the PackedTexture class.
Public methodPackedTexture(String, Texture2D, Vector2F, Vector2F, Int32, Int32)
Initializes a new instance of the PackedTexture class.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetBounds
Gets the bounds of the packed texture in pixel.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetTextureCoordinates
Converts texture coordinates.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyName
Gets or sets the name of the texture.
Public propertyNumberOfColumns
Gets or sets the number of columns in the tile set.
Public propertyNumberOfRows
Gets or sets the number of rows in the tile set.
Public propertyOffset
Gets or sets the offset of the packed texture in the texture atlas in UV coordinates.
Public propertyScale
Gets or sets the scale of the packed texture relative to the texture atlas.
Public propertyTextureAtlas
Gets or sets the texture atlas containing the packed texture.
Top
Remarks

A texture atlas is a large image containing a collection of textures. It is often more efficient to pack multiple textures into a texture atlas which can be treated as a single unit by the graphics hardware. The PackedTexture represents a single texture within the texture atlas.

Tile Sets:
A packed texture can further be divided into tiles (= tile set). A tile set is a collection of images ("sprites" or "tiles"). All tiles have the same size and are packed in a regular grid: NumberOfColumns defines the number of tiles in x direction and NumberOfRows defines the number of tiles in y direction.

2D Animations:
A tile set can be used for 2D animations ("flipbook animations", "sprite sheet animations"): The tile set contains a sequence of images (animation frames). Cycling through the images in rapid succession creates the illusion of movement.

When a tile set is used for animation, the top-left tile contains the first animation frame, the second tile in the upper row contains the second animation frame, and so on. The bottom-right tile contains the last animation frame.

Important: Most renderers require that the animation frames are tightly packed and the tile set does not contain empty tiles. For example, an animation consisting of 3 frames can be packed as a 1x3 or 3x1 tile set, but not as 2x2!

See Also