Documentation de SFML 2.1

Attention: cette page se réfère à une ancienne version de SFML. Cliquez ici pour passer à la dernière version.
Transform.hpp
1 
2 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
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 
376 SFML_GRAPHICS_API Transform operator *(const Transform& left, const Transform& right);
377 
390 SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right);
391 
404 SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& right);
405 
406 } // namespace sf
407 
408 
409 #endif // SFML_TRANSFORM_HPP
410 
411