xtd 0.2.0
matrix.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "../point.hpp"
7#include "../point_f.hpp"
8#include "../rectangle.hpp"
9#include "../rectangle_f.hpp"
10#include "matrix_order.hpp"
11#include <xtd/array>
12#include <xtd/iequatable>
13#include <xtd/object>
14#include <xtd/string>
15
17namespace xtd {
19 namespace drawing {
21 class graphics;
23
25 namespace drawing_2d {
72 class drawing_export_ matrix final : public object, public xtd::iequatable<matrix> {
73 struct data;
74
75 public:
77
88 matrix(float m11, float m12, float m21, float m22, float dx, float dy);
100
103 matrix& operator =(const xtd::drawing::drawing_2d::matrix& value);
104 ~matrix();
106
108
114
117 intptr handle() const noexcept;
118
121 bool is_identity() const;
122
125 bool is_invertible() const;
126
129 float offset_x() const;
130
133 float offset_y() const;
135
137
142 bool equals(const xtd::object& obj) const noexcept override;
146 bool equals(const xtd::drawing::drawing_2d::matrix& value) const noexcept override;
147
150 xtd::size get_hash_code() const noexcept override;
151
153 void invert();
154
162
165 void reset();
166
169 void rotate(float angle);
173 void rotate(float angle, xtd::drawing::drawing_2d::matrix_order order);
174
178 void rotate_at(float angle, const xtd::drawing::point_f& point);
183 void rotate_at(float angle, const xtd::drawing::point_f& point, xtd::drawing::drawing_2d::matrix_order order);
184
188 void scale(float scale_x, float scale_y);
193 void scale(float scale_x, float scale_y, xtd::drawing::drawing_2d::matrix_order order);
194
199 void shear(float scale_x, float scale_y);
205 void shear(float scale_x, float scale_y, xtd::drawing::drawing_2d::matrix_order order);
206
213
220
224 void translate(float offset_x, float offset_y);
230
234
235 xtd::string to_string() const noexcept override;
237
238 private:
239 void init_from_rect_3points(const xtd::drawing::rectangle_f& rect, const xtd::drawing::point_f pt1, const xtd::drawing::point_f pt2, const xtd::drawing::point_f pt3);
240 friend class xtd::drawing::graphics;
241 explicit matrix(intptr handle);
242
243 xtd::sptr<data> data_;
244 };
245 }
246 }
247}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Encapsulates a 3-by-3 affine matrix that represents a geometric transform. This class cannot be inher...
Definition matrix.hpp:72
bool is_identity() const
Gets a value indicating whether this xtd::drawing::drawing_2d::matrix is the identity matrix.
void shear(float scale_x, float scale_y)
Applies the specified shear vector to this xtd::drawing::drawing_2d::matrix.
void translate(float offset_x, float offset_y)
Applies the specified translation vector (offset_x and offset_y) to this xtd::drawing::drawing_2d::ma...
matrix(float m11, float m12, float m21, float m22, float dx, float dy)
Initializes a new instance of the xtd::drawing::drawing_2d::matrix class with the specified elements.
intptr handle() const noexcept
Gets the handle of the matrix.
void reset()
Resets this xtd::drawing::drawing_2d::matrix to have the elements of the identity matrix.
void vector_transform_points(xtd::array< xtd::drawing::point > &points)
Multiplies each vector in an array by the matrix. The translation elements of this matrix (third row)...
void transform_points(xtd::array< xtd::drawing::point > &points)
Applies the geometric transform represented by this xtd::drawing::drawing_2d::matrix to a specified a...
void invert()
Inverts this xtd::drawing::drawing_2d::matrix, if it is invertible.
bool is_invertible() const
Gets a value indicating whether this xtd::drawing::drawing_2d::matrix is invertible.
xtd::array< float > elements() const
Gets an array of floating-point values that represents the elements of this xtd::drawing::drawing_2d:...
void multiply(const xtd::drawing::drawing_2d::matrix &matrix)
Multiplies this xtd::drawing::drawing_2d::matrix by the matrix specified in the matrix parameter,...
void transform_vectors(xtd::array< xtd::drawing::point > &points)
Applies only the scale and rotate components of this xtd::drawing::drawing_2d::matrix to the specifie...
float offset_x() const
Gets the x translation value (the dx value, or the element in the third row and first column) of this...
matrix(const xtd::drawing::rectangle_f &rect, const xtd::array< xtd::drawing::point_f > &plgpts)
Initializes a new instance of the xtd::drawing::drawing_2d::matrix class to the geometric transform d...
float offset_y() const
Gets the y translation value (the dy value, or the element in the third row and second column) of thi...
void rotate_at(float angle, const xtd::drawing::point_f &point)
Applies a clockwise rotation to this xtd::drawing::drawing_2d::matrix around the point specified in t...
void scale(float scale_x, float scale_y)
Applies the specified scale vector to this xtd::drawing::drawing_2d::matrix by prepending the scale v...
bool equals(const xtd::object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
matrix(const xtd::drawing::rectangle &rect, const xtd::array< xtd::drawing::point > &plgpts)
Initializes a new instance of the xtd::drawing::drawing_2d::matrix class to the geometric transform d...
matrix()
Initializes a new instance of the xtd::drawing::drawing_2d::matrix class as the identity matrix.
void rotate(float angle)
repend to this xtd::drawing::drawing_2d::matrix a clockwise rotation, around the origin and by the sp...
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.hpp:67
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
object()=default
Create a new instance of the ultimate base class object.
Contains drawing_export_ keyword.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
matrix_order
Specifies the order for matrix transform operations.
Definition matrix_order.hpp:20
Contains xtd::drawing::drawing_2d::matrix_order enum class.
The xtd::drawing::drawing_2d namespace provides advanced two-dimensional and vector graphics function...
Definition compositing_mode.hpp:12
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::drawing::point class.
Contains xtd::drawing::point_f class.
Contains xtd::drawing::rectangle class.
Contains xtd::drawing::rectangle_f class.
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.hpp:35
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.hpp:54
Stores a set of four floating-point numbers that represent the location and size of a rectangle....
Definition rectangle_f.hpp:34
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.hpp:44
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:31