xtd 1.0.0
Loading...
Searching...
No Matches
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
113 [[nodiscard]] auto elements() const -> xtd::array<float>;
114
117 [[nodiscard]] auto handle() const noexcept -> xtd::intptr;
118
121 [[nodiscard]] auto is_identity() const -> bool;
122
125 [[nodiscard]] auto is_invertible() const -> bool;
126
129 [[nodiscard]] auto offset_x() const -> float;
130
133 [[nodiscard]] auto offset_y() const -> float;
135
137
142 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
146 [[nodiscard]] auto equals(const xtd::drawing::drawing_2d::matrix& value) const noexcept -> bool override;
147
150 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
151
153 auto invert() -> void;
154
157 auto multiply(const xtd::drawing::drawing_2d::matrix& matrix) -> void;
162
165 auto reset() -> void;
166
169 auto rotate(float angle) -> void;
173 auto rotate(float angle, xtd::drawing::drawing_2d::matrix_order order) -> void;
174
178 auto rotate_at(float angle, const xtd::drawing::point_f& point) -> void;
183 auto rotate_at(float angle, const xtd::drawing::point_f& point, xtd::drawing::drawing_2d::matrix_order order) -> void;
184
188 auto scale(float scale_x, float scale_y) -> void;
193 auto scale(float scale_x, float scale_y, xtd::drawing::drawing_2d::matrix_order order) -> void;
194
199 auto shear(float scale_x, float scale_y) -> void;
205 auto shear(float scale_x, float scale_y, xtd::drawing::drawing_2d::matrix_order order) -> void;
206
209 auto transform_points(xtd::array<xtd::drawing::point>& points) -> void;
212 auto transform_points(xtd::array<xtd::drawing::point_f>& points) -> void;
213
216 auto transform_vectors(xtd::array<xtd::drawing::point>& points) -> void;
219 auto transform_vectors(xtd::array<xtd::drawing::point_f>& points) -> void;
220
224 auto translate(float offset_x, float offset_y) -> void;
229 auto translate(float offset_x, float offset_y, xtd::drawing::drawing_2d::matrix_order order) -> void;
230
234
235 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
237
238 private:
239 auto 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) -> void;
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:64
Encapsulates a 3-by-3 affine matrix that represents a geometric transform. This class cannot be inher...
Definition matrix.hpp:72
auto reset() -> void
Resets this xtd::drawing::drawing_2d::matrix to have the elements of the identity matrix.
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
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.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto offset_y() const -> float
Gets the y translation value (the dy value, or the element in the third row and second column) of thi...
auto rotate(float angle) -> void
repend to this xtd::drawing::drawing_2d::matrix a clockwise rotation, around the origin and by the sp...
auto is_invertible() const -> bool
Gets a value indicating whether this xtd::drawing::drawing_2d::matrix is invertible.
auto transform_vectors(xtd::array< xtd::drawing::point > &points) -> void
Applies only the scale and rotate components of this xtd::drawing::drawing_2d::matrix to the specifie...
auto vector_transform_points(xtd::array< xtd::drawing::point > &points) -> void
Multiplies each vector in an array by the matrix. The translation elements of this matrix (third row)...
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...
auto offset_x() const -> float
Gets the x translation value (the dx value, or the element in the third row and first column) of this...
auto shear(float scale_x, float scale_y) -> void
Applies the specified shear vector to this xtd::drawing::drawing_2d::matrix.
auto elements() const -> xtd::array< float >
Gets an array of floating-point values that represents the elements of this xtd::drawing::drawing_2d:...
auto multiply(const xtd::drawing::drawing_2d::matrix &matrix) -> void
Multiplies this xtd::drawing::drawing_2d::matrix by the matrix specified in the matrix parameter,...
auto is_identity() const -> bool
Gets a value indicating whether this xtd::drawing::drawing_2d::matrix is the identity matrix.
auto transform_points(xtd::array< xtd::drawing::point > &points) -> void
Applies the geometric transform represented by this xtd::drawing::drawing_2d::matrix to a specified a...
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...
auto invert() -> void
Inverts this xtd::drawing::drawing_2d::matrix, if it is invertible.
matrix()
Initializes a new instance of the xtd::drawing::drawing_2d::matrix class as the identity matrix.
auto handle() const noexcept -> xtd::intptr
Gets the handle of the matrix.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto translate(float offset_x, float offset_y) -> void
Applies the specified translation vector (offset_x and offset_y) to this xtd::drawing::drawing_2d::ma...
auto rotate_at(float angle, const xtd::drawing::point_f &point) -> void
Applies a clockwise rotation to this xtd::drawing::drawing_2d::matrix around the point specified in t...
auto scale(float scale_x, float scale_y) -> void
Applies the specified scale vector to this xtd::drawing::drawing_2d::matrix by prepending the scale v...
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:23
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
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
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 auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Contains xtd::drawing::point struct.
Contains xtd::drawing::point_f struct.
Contains xtd::drawing::rectangle struct.
Contains xtd::drawing::rectangle_f struct.
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