[−][src]Struct sfml::graphics::Transform
Define a 3x3 transform matrix.
A Transform
specifies how to translate,
rotate, scale, shear, project, whatever things.
Methods
impl Transform
[src]
pub fn new(
a00: f32,
a01: f32,
a02: f32,
a10: f32,
a11: f32,
a12: f32,
a20: f32,
a21: f32,
a22: f32
) -> Transform
[src]
a00: f32,
a01: f32,
a02: f32,
a10: f32,
a11: f32,
a12: f32,
a20: f32,
a21: f32,
a22: f32
) -> Transform
Creates a new transform from a 3x3 matrix.
Arguments
- 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
pub fn get_matrix(&self, matrix: &mut [f32; 16])
[src]
Return the matrix
pub const IDENTITY: Self
[src]
The identity transform (does nothing)
pub fn inverse(&self) -> Transform
[src]
Return the inverse of a transform
If the inverse cannot be computed, a new identity transform is returned.
Return the inverse matrix
pub fn combine(&mut self, other: &Transform)
[src]
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.
Arguments
- other - Transform to combine to transform
pub fn translate(&mut self, x: f32, y: f32)
[src]
Combine a transform with a translation
Arguments
- x - Offset to apply on X axis
- y - Offset to apply on Y axis
pub fn rotate(&mut self, angle: f32)
[src]
pub fn rotate_with_center(&mut self, angle: f32, center_x: f32, center_y: f32)
[src]
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)].
Arguments
- angle - Rotation angle, in degrees
- center_x - X coordinate of the center of rotation
- center_y - Y coordinate of the center of rotation
pub fn scale(&mut self, scale_x: f32, scale_y: f32)
[src]
Combine the current transform with a scaling
Arguments
- scale_x - Scaling factor on the X axis
- scale_y - Scaling factor on the Y axis
pub fn scale_with_center(
&mut self,
scale_x: f32,
scale_y: f32,
center_x: f32,
center_y: f32
)
[src]
&mut self,
scale_x: f32,
scale_y: f32,
center_x: f32,
center_y: f32
)
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)]
Arguments
- scale_x - Scaling factor on X axis
- scale_y - Scaling factor on Y axis
- center_x - X coordinate of the center of scaling
- center_y - Y coordinate of the center of scaling
pub fn transform_point(&self, point: Vector2f) -> Vector2f
[src]
pub fn transform_rect(&self, rectangle: &FloatRect) -> FloatRect
[src]
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.
Arguments
rectangle - Rectangle to transform
Return the transformed rectangle
Trait Implementations
impl From<Transform> for Mat3
[src]
impl From<Transform> for Mat4
[src]
impl Clone for Transform
[src]
impl Copy for Transform
[src]
impl Default for Transform
[src]
impl Debug for Transform
[src]
Auto Trait Implementations
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
impl RefUnwindSafe for Transform
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,