#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
Go to the source code of this file.
Classes | |
struct | sfTransform |
Encapsulate a 3x3 transform matrix. More... | |
Functions | |
sfTransform | sfTransform_fromMatrix (float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22) |
Create a new transform from a matrix. | |
void | sfTransform_getMatrix (const sfTransform *transform, float *matrix) |
Return the 4x4 matrix of a transform. | |
sfTransform | sfTransform_getInverse (const sfTransform *transform) |
Return the inverse of a transform. | |
sfVector2f | sfTransform_transformPoint (const sfTransform *transform, sfVector2f point) |
Apply a transform to a 2D point. | |
sfFloatRect | sfTransform_transformRect (const sfTransform *transform, sfFloatRect rectangle) |
Apply a transform to a rectangle. | |
void | sfTransform_combine (sfTransform *transform, const sfTransform *other) |
Combine two transforms. | |
void | sfTransform_translate (sfTransform *transform, float x, float y) |
Combine a transform with a translation. | |
void | sfTransform_rotate (sfTransform *transform, float angle) |
Combine the current transform with a rotation. | |
void | sfTransform_rotateWithCenter (sfTransform *transform, float angle, float centerX, float centerY) |
Combine the current transform with a rotation. | |
void | sfTransform_scale (sfTransform *transform, float scaleX, float scaleY) |
Combine the current transform with a scaling. | |
void | sfTransform_scaleWithCenter (sfTransform *transform, float scaleX, float scaleY, float centerX, float centerY) |
Combine the current transform with a scaling. | |
sfBool | sfTransform_equal (sfTransform *left, sfTransform *right) |
Compare two transforms for equality. | |
Variables | |
const sfTransform | sfTransform_Identity |
Identity transform (does nothing) | |
Function Documentation
◆ sfTransform_combine()
void sfTransform_combine | ( | sfTransform * | transform, |
const sfTransform * | other | ||
) |
Combine two transforms.
The result is a transform that is equivalent to applying transform followed by other. Mathematically, it is equivalent to a matrix multiplication.
- Parameters
-
transform Transform object other Transform to combine to transform
◆ sfTransform_equal()
sfBool sfTransform_equal | ( | sfTransform * | left, |
sfTransform * | right | ||
) |
Compare two transforms for equality.
Performs an element-wise comparison of the elements of the left transform with the elements of the right transform.
- Parameters
-
left Left operand (the first transform) right Right operand (the second transform)
- Returns
- true if the transforms are equal, false otherwise
◆ sfTransform_fromMatrix()
sfTransform sfTransform_fromMatrix | ( | float | a00, |
float | a01, | ||
float | a02, | ||
float | a10, | ||
float | a11, | ||
float | a12, | ||
float | a20, | ||
float | a21, | ||
float | a22 | ||
) |
Create a new transform from a matrix.
- Parameters
-
a00 Element (0, 0) of the matrix a01 Element (0, 1) of the matrix a02 Element (0, 2) of the matrix a10 Element (1, 0) of the matrix a11 Element (1, 1) of the matrix a12 Element (1, 2) of the matrix a20 Element (2, 0) of the matrix a21 Element (2, 1) of the matrix a22 Element (2, 2) of the matrix
- Returns
- A new sfTransform object
◆ sfTransform_getInverse()
sfTransform sfTransform_getInverse | ( | const sfTransform * | transform | ) |
Return the inverse of a transform.
If the inverse cannot be computed, a new identity transform is returned.
- Parameters
-
transform Transform object
- Returns
- The inverse matrix
◆ sfTransform_getMatrix()
void sfTransform_getMatrix | ( | const sfTransform * | transform, |
float * | matrix | ||
) |
Return the 4x4 matrix of a transform.
This function fills an array of 16 floats with the transform converted as a 4x4 matrix, which is directly compatible with OpenGL functions.
- Parameters
-
transform Transform object matrix Pointer to the 16-element array to fill with the matrix
◆ sfTransform_rotate()
void sfTransform_rotate | ( | sfTransform * | transform, |
float | angle | ||
) |
Combine the current transform with a rotation.
- Parameters
-
transform Transform object angle Rotation angle, in degrees
◆ sfTransform_rotateWithCenter()
void sfTransform_rotateWithCenter | ( | sfTransform * | transform, |
float | angle, | ||
float | centerX, | ||
float | centerY | ||
) |
Combine the current transform with a rotation.
The center of rotation is provided for convenience as a second argument, so that you can build rotations around arbitrary points more easily (and efficiently) than the usual [translate(-center), rotate(angle), translate(center)].
- Parameters
-
transform Transform object angle Rotation angle, in degrees centerX X coordinate of the center of rotation centerY Y coordinate of the center of rotation
◆ sfTransform_scale()
void sfTransform_scale | ( | sfTransform * | transform, |
float | scaleX, | ||
float | scaleY | ||
) |
Combine the current transform with a scaling.
- Parameters
-
transform Transform object scaleX Scaling factor on the X axis scaleY Scaling factor on the Y axis
◆ sfTransform_scaleWithCenter()
void sfTransform_scaleWithCenter | ( | sfTransform * | transform, |
float | scaleX, | ||
float | scaleY, | ||
float | centerX, | ||
float | centerY | ||
) |
Combine the current transform with a scaling.
The center of scaling is provided for convenience as a second argument, so that you can build scaling around arbitrary points more easily (and efficiently) than the usual [translate(-center), scale(factors), translate(center)]
- Parameters
-
transform Transform object scaleX Scaling factor on X axis scaleY Scaling factor on Y axis centerX X coordinate of the center of scaling centerY Y coordinate of the center of scaling
◆ sfTransform_transformPoint()
sfVector2f sfTransform_transformPoint | ( | const sfTransform * | transform, |
sfVector2f | point | ||
) |
Apply a transform to a 2D point.
- Parameters
-
transform Transform object point Point to transform
- Returns
- Transformed point
◆ sfTransform_transformRect()
sfFloatRect sfTransform_transformRect | ( | const sfTransform * | transform, |
sfFloatRect | rectangle | ||
) |
Apply a transform to a rectangle.
Since SFML doesn't provide support for oriented rectangles, the result of this function is always an axis-aligned rectangle. Which means that if the transform contains a rotation, the bounding rectangle of the transformed rectangle is returned.
- Parameters
-
transform Transform object rectangle Rectangle to transform
- Returns
- Transformed rectangle
◆ sfTransform_translate()
void sfTransform_translate | ( | sfTransform * | transform, |
float | x, | ||
float | y | ||
) |
Combine a transform with a translation.
- Parameters
-
transform Transform object x Offset to apply on X axis y Offset to apply on Y axis
Variable Documentation
◆ sfTransform_Identity
const sfTransform sfTransform_Identity |
Identity transform (does nothing)
Definition at line 52 of file Transform.h.