Click or drag to resize
DigitalRuneRenderTransform Structure
Represents a render transformation.

Namespace: DigitalRune.Game.UI.Rendering
Assembly: DigitalRune.Game.UI (in DigitalRune.Game.UI.dll) Version: 1.8.0.0 (1.8.0.14553)
Syntax
[SerializableAttribute]
public struct RenderTransform : IEquatable<RenderTransform>

The RenderTransform type exposes the following members.

Constructors
  NameDescription
Public methodRenderTransform(Vector2F, Vector2F, Single, Vector2F)
Initializes a new instance of the RenderTransform struct.
Public methodRenderTransform(Vector2F, Single, Single, Vector2F, Vector2F, Single, Vector2F)
Initializes a new instance of the RenderTransform struct.
Top
Methods
  NameDescription
Public methodDraw(SpriteBatch, Texture2D, Vector2F, Color)
Transforms a sprite and adds it to a batch of sprites for rendering using the specified texture, position and color.
Public methodDraw(SpriteBatch, Texture2D, RectangleF, NullableRectangle, Color)
Transforms a sprite and adds it to a batch of sprites for rendering using the specified texture, position, source rectangle and color.
Public methodDraw(SpriteBatch, Texture2D, Vector2F, NullableRectangle, Color)
Transforms a sprite and adds it to a batch of sprites for rendering using the specified texture, position, source rectangle and color.
Public methodDrawString(SpriteBatch, SpriteFont, String, Vector2F, Color)
Transforms a string and adds it to a batch of sprites for rendering using the specified font, text, position, and color.
Public methodDrawString(SpriteBatch, SpriteFont, StringBuilder, Vector2F, Color)
Transforms a string and adds it to a batch of sprites for rendering using the specified font, text, position, and color.
Public methodEquals(Object)
Indicates whether this instance and a specified object are equal.
(Overrides ValueTypeEquals(Object).)
Public methodEquals(RenderTransform)
Indicates whether the current object is equal to another object of the same type.
Public methodFromRenderDirection
Transforms a direction by the inverse of this render transformation.
Public methodFromRenderPosition
Transforms a position by the inverse of this render transformation.
Public methodGetHashCode
Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberMultiply
Multiplies two render transformation.
Public methodToMatrix22F
Converts this render transformation to a 2x2 matrix that only represents the scaling and the rotation (no translation).
Public methodToMatrix33F
Converts this render transformation to a 3x3 matrix.
Public methodToRenderDirection
Transforms a direction.
Public methodToRenderPosition
Transforms a position.
Public methodToString
Returns the string representation of this render transform.
(Overrides ValueTypeToString.)
Public methodToString(IFormatProvider)
Returns the string representation of this pose using the specified culture-specific format information.
Public methodTransform
Transforms the specified rectangle. (Does not work with rotations!)
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Compares two RenderTransforms to determine whether they are the same.
Public operatorStatic member(RenderTransform to Matrix33F)
Converts a render transformation to a 3x3 matrix.
Public operatorStatic member(RenderTransform to Matrix22F)
Converts a render transformation to a 2x2 matrix that only represents the scaling and the rotation (no translation).
Public operatorStatic memberInequality
Compares two RenderTransforms to determine whether they are the different.
Public operatorStatic memberMultiply
Multiplies two render transformation.
Top
Fields
  NameDescription
Public fieldStatic memberIdentity
The identity transform.
Public fieldOrigin
The origin of the render transformations in screen coordinates.
Public fieldRotation
The rotation given as the angle in radians.
Public fieldScale
The scale.
Public fieldTranslation
The translation.
Top
Remarks

The render transformation defines a 2D SRT transformation: Scaling followed by a rotation followed by a translation. The center of the scaling and rotation can be set explicitly.

Note that a render transformation cannot be inverted. The inverse is not an SRT transformation. But you can convert the render transformation to a 3x3 matrix.

Render transformations can be combined using multiplication. The order of the transformations is right-to-left - the same as when using matrices (Matrix22F, etc.).

SpriteBatch Rendering: The render transformation also provides wrapper methods for the Draw-routines of the SpriteBatch. The render transformation will be automatically applied to all sprites and strings that are drawn.

Important: The combination of rotations and non-uniform scaling can be problematic. Non-uniform scaling should only be used if the non-uniform scale is set by the last render transform in a hierarchy. (E.g. if an element in a visual tree has a rotation and the parent element has a non-uniform scaling, the child element won't be rendered correctly.)

See Also