xtd 0.2.0
Loading...
Searching...
No Matches
matrix.h
Go to the documentation of this file.
1
4#pragma once
5#include "../../drawing_export.h"
6#include "../point.h"
7#include "../point_f.h"
8#include "../rectangle.h"
9#include "../rectangle_f.h"
10#include "matrix_order.h"
11#include <xtd/iequatable>
12#include <xtd/object>
13#include <xtd/string>
14#include <cstdint>
15#include <ostream>
16
18namespace xtd {
20 namespace drawing {
22 class graphics;
24
26 namespace drawing_2d {
73 class drawing_export_ matrix final : public object, public xtd::iequatable<matrix> {
74 struct data;
75
76 public:
78
89 matrix(float m11, float m12, float m21, float m22, float dx, float dy);
94 matrix(const xtd::drawing::rectangle& rect, const std::vector<xtd::drawing::point>& plgpts);
99 matrix(const xtd::drawing::rectangle_f& rect, const std::vector<xtd::drawing::point_f>& plgpts);
101
104 matrix& operator =(const xtd::drawing::drawing_2d::matrix& value);
105 ~matrix();
107
109
114 std::vector<float> elements() const;
115
118 intptr handle() const noexcept;
119
122 bool is_identity() const;
123
126 bool is_invertible() const;
127
130 float offset_x() const;
131
134 float offset_y() const;
136
138
140 using object::equals;
141 bool equals(const xtd::drawing::drawing_2d::matrix& value) const noexcept override;
142
144 void invert();
145
148 void multiply(const xtd::drawing::drawing_2d::matrix& matrix);
152 void multiply(const xtd::drawing::drawing_2d::matrix& matrix, xtd::drawing::drawing_2d::matrix_order order);
153
156 void reset();
157
160 void rotate(float angle);
164 void rotate(float angle, xtd::drawing::drawing_2d::matrix_order order);
165
169 void rotate_at(float angle, const xtd::drawing::point_f& point);
174 void rotate_at(float angle, const xtd::drawing::point_f& point, xtd::drawing::drawing_2d::matrix_order order);
175
179 void scale(float scale_x, float scale_y);
184 void scale(float scale_x, float scale_y, xtd::drawing::drawing_2d::matrix_order order);
185
190 void shear(float scale_x, float scale_y);
196 void shear(float scale_x, float scale_y, xtd::drawing::drawing_2d::matrix_order order);
197
200 void transform_points(std::vector<xtd::drawing::point>& points);
203 void transform_points(std::vector<xtd::drawing::point_f>& points);
204
207 void transform_vectors(std::vector<xtd::drawing::point>& points);
210 void transform_vectors(std::vector<xtd::drawing::point_f>& points);
211
215 void translate(float offset_x, float offset_y);
220 void translate(float offset_x, float offset_y, xtd::drawing::drawing_2d::matrix_order order);
221
224 void vector_transform_points(std::vector<xtd::drawing::point>& points);
225
226 xtd::string to_string() const noexcept override;
228
229 private:
230 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);
231 friend class xtd::drawing::graphics;
232 explicit matrix(intptr handle);
233
234 xtd::sptr<data> data_;
235 };
236 }
237 }
238}
Encapsulates a 3-by-3 affine matrix that represents a geometric transform. This class cannot be inher...
Definition matrix.h:73
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.
std::vector< float > elements() const
Gets an array of floating-point values that represents the elements of this xtd::drawing::drawing_2d:...
matrix()
Initializes a new instance of the xtd::drawing::drawing_2d::matrix class as the identity matrix.
matrix(const xtd::drawing::rectangle &rect, const std::vector< xtd::drawing::point > &plgpts)
Initializes a new instance of the xtd::drawing::drawing_2d::matrix class to the geometric transform d...
matrix(const xtd::drawing::rectangle_f &rect, const std::vector< xtd::drawing::point_f > &plgpts)
Initializes a new instance of the xtd::drawing::drawing_2d::matrix class to the geometric transform d...
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.h:70
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.h:35
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.h:54
Stores a set of four floating-point numbers that represent the location and size of a rectangle....
Definition rectangle_f.h:34
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.h:44
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
matrix_order
Specifies the order for matrix transform operations.
Definition matrix_order.h:20
Contains xtd::drawing::drawing_2d::matrix_order enum class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10