CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
rectangle_f.h
1
2#ifndef _aspose_system_drawing_rectangle_f_h_
3#define _aspose_system_drawing_rectangle_f_h_
4
5#include "fwd.h"
6#include "system/object_ext.h"
7#include "drawing/size_f.h"
8#include "drawing/point_f.h"
9
10namespace System { namespace Drawing {
14class ASPOSECPP_SHARED_CLASS RectangleF
15{
16 RTTI_INFO_VALUE_TYPE(RectangleF);
17
18public:
20 ASPOSECPP_SHARED_API RectangleF();
26 ASPOSECPP_SHARED_API RectangleF(float x, float y, float width, float height);
31 ASPOSECPP_SHARED_API RectangleF(const PointF & location, const SizeF & size);
35 explicit ASPOSECPP_SHARED_API RectangleF(const Rectangle &rect);
42 inline static RectangleF FromLTRB(float left, float top, float right, float bottom) { return RectangleF(left, top, right - left, bottom - top); }
43
46 inline PointF get_Location() const { return PointF(m_x, m_y); }
49 inline void set_Location(PointF value) { m_x = value.get_X(); m_y = value.get_Y(); }
50
53 inline SizeF get_Size() const { return SizeF(m_width, m_height); }
56 inline void set_Size(SizeF value) { m_width = value.get_Width(); m_height = value.get_Height(); }
58 inline float get_X() const { return m_x; }
61 inline void set_X(float value) { m_x = value; }
62
64 inline float get_Y() const { return m_y; }
67 inline void set_Y(float value) { m_y = value; }
68
70 inline float get_Width() const { return m_width; }
73 inline void set_Width(float value) { m_width = value; }
74
76 inline float get_Height() const { return m_height; }
79 inline void set_Height(float value) { m_height = value; }
81 inline float get_Left() const { return m_x; }
83 inline float get_Top() const { return m_y; }
85 inline float get_Right() const { return (m_x + m_width); }
87 inline float get_Bottom() const { return (m_y + m_height); }
92 inline bool get_IsEmpty() const { return ((m_width <= 0) || (m_height <= 0)); }
93
97 ASPOSECPP_SHARED_API bool Equals(const RectangleF & rect) const;
98
104 ASPOSECPP_SHARED_API bool Contains(float x, float y);
109 ASPOSECPP_SHARED_API bool Contains(const PointF & point);
114 ASPOSECPP_SHARED_API bool Contains(const RectangleF & rect);
115
121 ASPOSECPP_SHARED_API void Inflate(float width, float height);
126 ASPOSECPP_SHARED_API void Inflate(const SizeF & size);
134 static ASPOSECPP_SHARED_API RectangleF Inflate(const RectangleF & rect, float x, float y);
135
140 ASPOSECPP_SHARED_API void Intersect(const RectangleF & rect);
145 static ASPOSECPP_SHARED_API RectangleF Intersect(const RectangleF & a, const RectangleF & b);
149 ASPOSECPP_SHARED_API bool IntersectsWith(const RectangleF & rect);
150
155 static ASPOSECPP_SHARED_API RectangleF Union(const RectangleF & a, const RectangleF & b);
156
161 ASPOSECPP_SHARED_API void Offset(const PointF & pos);
165 ASPOSECPP_SHARED_API void Offset(float x, float y);
166
171 friend ASPOSECPP_SHARED_API bool operator==(const RectangleF & rect1, const RectangleF & rect2);
176 friend ASPOSECPP_SHARED_API bool operator!=(const RectangleF & rect1, const RectangleF & rect2);
177
179 bool operator == (std::nullptr_t) const { return false; }
181 bool operator != (std::nullptr_t) const { return true; }
182
184 static const ASPOSECPP_SHARED_API RectangleF Empty;
186 ASPOSECPP_SHARED_API int GetHashCode() const;
188 System::String ToString() const { return String::Format(u"{{X={0},Y={1},Width={2},Height={3}}}", m_x, m_y, m_width, m_height); }
189
190private:
192 float m_x;
194 float m_y;
196 float m_width;
198 float m_height;
199
200};
201
206inline std::ostream& operator<<(std::ostream& stream, const RectangleF& rectangle)
207{
208 stream << rectangle.ToString();
209 return stream;
210}
211
216inline std::wostream& operator<<(std::wostream& stream, const RectangleF& rectangle)
217{
218 stream << rectangle.ToString();
219 return stream;
220}
221
222}} // System::Drawing
223
224namespace System
225{
227
229 template<> struct IsBoxable<Drawing::RectangleF> : std::true_type {};
230
232 template <>
233 class BoxedValue<System::Drawing::RectangleF> : public DefaultBoxedValue<System::Drawing::RectangleF>
234 {
235 public:
239 : DefaultBoxedValue<System::Drawing::RectangleF>(value)
240 {}
241 };
242
244}
245
246namespace std
247{
249 template <>
250 struct hash<System::Drawing::RectangleF>
251 {
254 std::size_t operator()(const System::Drawing::RectangleF& rect) const
255 {
256 return rect.GetHashCode();
257 }
258 };
259}
260
261#endif // _aspose_system_drawing_rectangle_f_h_
BoxedValue(const T &value)
Constructs an object that represents the specified value boxed.
Definition: boxed_value.h:192
Represents a pair of single-precision floating point X and Y coordinates of a point on a 2-dimensiona...
Definition: point_f.h:14
float get_X() const
Returns the value of X coordinate represented by the current object.
Definition: point_f.h:34
float get_Y() const
Returns the value of Y coordinate represented by the current object.
Definition: point_f.h:36
Represents a rectangular area of an image defined as single-precision floating point X and Y coordina...
Definition: rectangle_f.h:15
void set_Location(PointF value)
Sets the location of the upper left corner of the rectangle represented by the current object.
Definition: rectangle_f.h:49
float get_Left() const
Returns the X coordinate of the left edge of the rectangle represented by the current object.
Definition: rectangle_f.h:81
void Offset(const PointF &pos)
Offsets the position of the rectangle represented by the current object by the specified amounts.
void set_X(float value)
Sets the X coordinate of the upper left corner of the rectangle represented by the current object.
Definition: rectangle_f.h:61
void set_Y(float value)
Sets the Y coordinate of the upper left corner of the rectangle represented by the current object.
Definition: rectangle_f.h:67
RectangleF()
Constructs a new instance of RectangleF object that represents a rectangle with X and Y coordinates a...
float get_X() const
Returns the X coordinate of the upper left corner of the rectangle represented by the current object.
Definition: rectangle_f.h:58
void Inflate(float width, float height)
Increases the width and height of the rectangle represented by the current object,...
System::String ToString() const
Returns the string representation of the current object.
Definition: rectangle_f.h:188
float get_Bottom() const
Returns the y coordinate of the bottom edge of the rectangle represented by the current object.
Definition: rectangle_f.h:87
bool Contains(const PointF &point)
Determines if the specified point is located within the rectangle represented by the current object.
bool Contains(float x, float y)
Determines if the specified point is located within the rectangle represented by the current object.
RectangleF(const PointF &location, const SizeF &size)
Constructs a new instance of RectangleF object that represents a rectangle with the coordinates of it...
static const RectangleF Empty
An empty rectangle i.e. a rectangle whose location and size values have zero values.
Definition: rectangle_f.h:184
bool Contains(const RectangleF &rect)
Determines if the specified rectangle is located within the rectangle represented by the current obje...
RectangleF(const Rectangle &rect)
Constructs a new instance of RectangleF object that represents the rectangle equivalent to the specif...
bool get_IsEmpty() const
Determines if X and Y coordinates of the upper left corner of the recangle represented by the current...
Definition: rectangle_f.h:92
RectangleF(float x, float y, float width, float height)
Constructs a new instance of RectangleF object that represents a rectangle with the specified coordin...
float get_Y() const
Returns the Y coordinate of the upper left corner of the rectangle represented by the current object.
Definition: rectangle_f.h:64
PointF get_Location() const
Returns an instance of the PointF class that specifies the location of the upper left corner of the r...
Definition: rectangle_f.h:46
void set_Width(float value)
Sets the width of the rectangle represented by the current object.
Definition: rectangle_f.h:73
static RectangleF Intersect(const RectangleF &a, const RectangleF &b)
Returns a rectangle that is a result of intersection of the specified rectangles.
float get_Top() const
Returns the Y coordinate of the top edge of the rectangle represented by the current object.
Definition: rectangle_f.h:83
SizeF get_Size() const
Returns an instance of the SizeF class that specifies the width and height of the rectangle represent...
Definition: rectangle_f.h:53
float get_Height() const
Returns the height of the rectangle represented by the current object.
Definition: rectangle_f.h:76
static RectangleF Inflate(const RectangleF &rect, float x, float y)
Increases the width and height of the rectangle represented by the specified object,...
bool Equals(const RectangleF &rect) const
Determines if the rectangles represented by the current and the specified objects are identical.
void set_Height(float value)
Sets the height of the rectangle represented by the current object.
Definition: rectangle_f.h:79
friend bool operator==(const RectangleF &rect1, const RectangleF &rect2)
Determines if the rectangles represented by the specified objects are identical.
static RectangleF Union(const RectangleF &a, const RectangleF &b)
Returns a rectangle that is a result of union of the specified rectangles.
bool IntersectsWith(const RectangleF &rect)
Determines if the rectangles represented by the current and specified objects intesect.
float get_Width() const
Returns the width of the rectangle represented by the current object.
Definition: rectangle_f.h:70
friend bool operator!=(const RectangleF &rect1, const RectangleF &rect2)
Determines if the rectangles represented by the specified objects are not identical.
void set_Size(SizeF value)
Sets the width and height of the rectangle represented by the current object.
Definition: rectangle_f.h:56
void Offset(float x, float y)
Offsets the position of the rectangle represented by the current object by the specified amounts.
static RectangleF FromLTRB(float left, float top, float right, float bottom)
Constructs a new RectangleF object that represents a rectangle with the specified edge locations.
Definition: rectangle_f.h:42
void Intersect(const RectangleF &rect)
Replaces the rectangle represented by the current object with the rectangle that results from the its...
void Inflate(const SizeF &size)
Increases the width and height of the rectangle represented by the current object,...
int GetHashCode() const
Returns a hash code of the current object.
float get_Right() const
Returns the X coordinate of the right edge of the rectangle represented by the current object.
Definition: rectangle_f.h:85
Represents a rectangular area of an image defined as integer X and Y coordinates of its upper left co...
Definition: rectangle.h:19
Represents a pair of single-precision floating point values that represent width and height of an ima...
Definition: size_f.h:14
float get_Height() const
Returns the value of height represented by the current object.
Definition: size_f.h:36
float get_Width() const
Returns the value of width represented by the current object.
Definition: size_f.h:34
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
static String Format(const SharedPtr< IFormatProvider > &fp, const String &format, const Args &... args)
Formats string in C# style.
Definition: string.h:1405
std::ostream & operator<<(std::ostream &stream, Color color)
Insert data into the stream using UTF-8 encoding.
Definition: color.h:427
Definition: db_command.h:9
bool operator!=(ArraySegment< T > a, ArraySegment< T > b)
Definition: array_segment.h:157
bool operator==(ArraySegment< T > a, ArraySegment< T > b)
Definition: array_segment.h:151