SFML 2.5.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Transform.hpp
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef SFML_TRANSFORM_HPP
26#define SFML_TRANSFORM_HPP
27
29// Headers
31#include <SFML/Graphics/Export.hpp>
32#include <SFML/Graphics/Rect.hpp>
33#include <SFML/System/Vector2.hpp>
34
35
36 namespace sf
37{
42 class SFML_GRAPHICS_API Transform
43{
44 public:
45
52 Transform();
53
68 Transform(float a00, float a01, float a02,
69 float a10, float a11, float a12,
70 float a20, float a21, float a22);
71
87 const float* getMatrix() const;
88
98 Transform getInverse() const;
99
109 Vector2f transformPoint(float x, float y) const;
110
119 Vector2f transformPoint(const Vector2f& point) const;
120
135 FloatRect transformRect(const FloatRect& rectangle) const;
136
149 Transform& combine(const Transform& transform);
150
169 Transform& translate(float x, float y);
170
188 Transform& translate(const Vector2f& offset);
189
207 Transform& rotate(float angle);
208
233 Transform& rotate(float angle, float centerX, float centerY);
234
258 Transform& rotate(float angle, const Vector2f& center);
259
278 Transform& scale(float scaleX, float scaleY);
279
305 Transform& scale(float scaleX, float scaleY, float centerX, float centerY);
306
324 Transform& scale(const Vector2f& factors);
325
349 Transform& scale(const Vector2f& factors, const Vector2f& center);
350
352 // Static member data
354 static const Transform Identity;
355
356 private:
357
359 // Member data
361 float m_matrix[16];
362};
363
376SFML_GRAPHICS_API Transform operator *(const Transform& left, const Transform& right);
377
390SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right);
391
404SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& right);
405
419SFML_GRAPHICS_API bool operator ==(const Transform& left, const Transform& right);
420
433SFML_GRAPHICS_API bool operator !=(const Transform& left, const Transform& right);
434
435} // namespace sf
436
437
438#endif // SFML_TRANSFORM_HPP
439
440
sf::Rect< float >
sf::Transform
Define a 3x3 transform matrix.
Definition: Transform.hpp:43
sf::Transform::translate
Transform & translate(float x, float y)
Combine the current transform with a translation.
sf::Transform::rotate
Transform & rotate(float angle, const Vector2f &center)
Combine the current transform with a rotation.
sf::Transform::getInverse
Transform getInverse() const
Return the inverse of the transform.
sf::Transform::scale
Transform & scale(const Vector2f &factors)
Combine the current transform with a scaling.
sf::Transform::translate
Transform & translate(const Vector2f &offset)
Combine the current transform with a translation.
sf::Transform::transformRect
FloatRect transformRect(const FloatRect &rectangle) const
Transform a rectangle.
sf::Transform::scale
Transform & scale(const Vector2f &factors, const Vector2f &center)
Combine the current transform with a scaling.
sf::Transform::Transform
Transform(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22)
Construct a transform from a 3x3 matrix.
sf::Transform::scale
Transform & scale(float scaleX, float scaleY)
Combine the current transform with a scaling.
sf::Transform::Identity
static const Transform Identity
The identity transform (does nothing)
Definition: Transform.hpp:354
sf::Transform::transformPoint
Vector2f transformPoint(const Vector2f &point) const
Transform a 2D point.
sf::Transform::getMatrix
const float * getMatrix() const
Return the transform as a 4x4 matrix.
sf::Transform::Transform
Transform()
Default constructor.
sf::Transform::rotate
Transform & rotate(float angle)
Combine the current transform with a rotation.
sf::Transform::rotate
Transform & rotate(float angle, float centerX, float centerY)
Combine the current transform with a rotation.
sf::Transform::combine
Transform & combine(const Transform &transform)
Combine the current transform with another one.
sf::Transform::scale
Transform & scale(float scaleX, float scaleY, float centerX, float centerY)
Combine the current transform with a scaling.
sf::Transform::transformPoint
Vector2f transformPoint(float x, float y) const
Transform a 2D point.
sf::Vector2< float >