Difference between revisions of "Transform"
m (0.11.0 -> 11.0) |
|||
(21 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{newin|[[11.0]]|110|type=type}} | |
+ | Object containing a coordinate system transformation. | ||
− | + | The [[love.graphics]] module has several functions and function variants which accept Transform objects. | |
− | + | == Constructors == | |
+ | {{#ask: [[Category:Functions]] [[Constructs::Transform]] | ||
+ | | headers=hide | ||
+ | | default=None. | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
+ | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | }} | ||
+ | == Functions == | ||
+ | {{#ask: [[Category:Functions]] [[parent::Transform||Object]] | ||
+ | | headers=hide | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
+ | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | }} | ||
+ | == Enums == | ||
+ | {{#ask: [[Category:Enums]] [[parent::Transform]] | ||
+ | | headers=hide | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
+ | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | }} | ||
+ | == Supertypes == | ||
+ | * [[parent::Object]] | ||
+ | == Notes == | ||
+ | Transform objects have a custom <code>*</code> (multiplication) operator. <code>result = tA * tB</code> is equivalent to <code>result = tA:clone():apply(tB)</code>. It maps to the matrix multiplication operation that [[Transform:apply]] performs. | ||
− | + | The <code>*</code> operator creates a new Transform object, so it is not recommended to use it heavily in per-frame code. | |
− | + | == See Also == | |
− | {{#set:Description= | + | * [[parent::love.math]] |
− | {{ | + | * [[love.graphics.applyTransform]] |
− | + | * [[love.graphics.replaceTransform]] | |
− | + | * [[love.graphics.draw]] | |
+ | * [[love.graphics.print]] | ||
+ | * [[SpriteBatch:add]] | ||
+ | * [[Text:add]] | ||
+ | * [[Shader:send]] | ||
+ | [[Category:Types]] | ||
+ | {{#set:Description=Object containing a coordinate system transformation.}} | ||
+ | == Other Languages == | ||
+ | {{i18n|Transform}} |
Latest revision as of 08:05, 12 January 2019
Available since LÖVE 11.0 |
This type is not supported in earlier versions. |
Object containing a coordinate system transformation.
The love.graphics module has several functions and function variants which accept Transform objects.
Constructors
love.math.newTransform | Creates a new Transform object. | 11.0 |
Functions
Object:release | Immediately destroys the object's Lua reference. | 11.0 | |
Object:type | Gets the type of the object as a string. | ||
Object:typeOf | Checks whether an object is of a certain type. | ||
Transform:apply | Applies the given other Transform object to this one. | 11.0 | |
Transform:clone | Creates a new copy of this Transform. | 11.0 | |
Transform:getMatrix | Gets the internal transformation matrix stored by this Transform. | 11.0 | |
Transform:inverse | Creates a new Transform containing the inverse of this Transform. | 11.0 | |
Transform:inverseTransformPoint | Applies the reverse of the Transform object's transformation to the given 2D position. | 11.0 | |
Transform:isAffine2DTransform | Checks whether the Transform is an affine transformation. | 11.0 | |
Transform:reset | Resets the Transform to an identity state. | 11.0 | |
Transform:rotate | Applies a rotation to the Transform's coordinate system. | 11.0 | |
Transform:scale | Scales the Transform's coordinate system. | 11.0 | |
Transform:setMatrix | Directly sets the Transform's internal transformation matrix. | 11.0 | |
Transform:setTransformation | Resets the Transform to the specified transformation parameters. | 11.0 | |
Transform:shear | Applies a shear factor (skew) to the Transform's coordinate system. | 11.0 | |
Transform:transformPoint | Applies the Transform object's transformation to the given 2D position. | 11.0 | |
Transform:translate | Applies a translation to the Transform's coordinate system. | 11.0 |
Enums
MatrixLayout | The layout of matrix elements (row-major or column-major). | 11.0 |
Supertypes
Notes
Transform objects have a custom *
(multiplication) operator. result = tA * tB
is equivalent to result = tA:clone():apply(tB)
. It maps to the matrix multiplication operation that Transform:apply performs.
The *
operator creates a new Transform object, so it is not recommended to use it heavily in per-frame code.
See Also
- love.math
- love.graphics.applyTransform
- love.graphics.replaceTransform
- love.graphics.draw
- love.graphics.print
- SpriteBatch:add
- Text:add
- Shader:send
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info