10 public sequence_type < NUMBER, 2 >
20 using UNIT_TYPE = NUMBER;
27 constexpr size_type() {}
41 template < prototype_number C >
42 constexpr size_type(C c)
45 this->set_all((NUMBER)c);
49 template < prototype_number CX, prototype_number CY >
50 constexpr size_type(CX cx, CY cy)
52 this->m_coordinatea[0] = (UNIT_TYPE) cx;
53 this->m_coordinatea[1] = (UNIT_TYPE) cy;
56 template < prototype_number NUMBER1 >
57 constexpr size_type(
const sequence_type < NUMBER1, 2 > & sequence) :
58 sequence_type < UNIT_TYPE, 2 >(sequence)
109 size_type& Null() { this->cx = (UNIT_TYPE)0; this->cy = (UNIT_TYPE)0;
return *
this; }
111 template < prototype_po
int POINT >
112 POINT operator +(
const POINT& point1)
const noexcept { POINT point(point1); ::offset(point, this->cx, this->cy);
return point; }
113 template < prototype_po
int POINT >
114 POINT operator-(
const POINT & point1)
const noexcept { POINT point(this->cx, this->cy); ::offset(point, -point1.x, -point1.y);
return point; }
119 UNIT_TYPE area()
const noexcept { return ::area(this->cx, this->cy); }
120 inline bool is_empty()
const noexcept {
return this->cx <= 0 || this->cy <= 0; }
121 inline bool is_set()
const noexcept {
return !is_empty(); }
122 inline bool has_area()
const noexcept {
return is_set(); }
125 consteval size2_t semantic_t()
const {
return {}; }
127 ::u32 as_u32()
const noexcept {
return as_u32(this->cx, this->cy); }
128 ::u64 as_u64()
const noexcept {
return as_u64(this->cx, this->cy); }
129 class lparam lparam() const noexcept {
return make_u32(this->cx, this->cy); }
131 inline UNIT_TYPE width()
const noexcept {
return this->cx; }
132 inline UNIT_TYPE height()
const noexcept {
return this->cy; }
149 inline void set(UNIT_TYPE c)
noexcept { this->cx = this->cy = c; }
150 inline void set(UNIT_TYPE cx, UNIT_TYPE cy)
noexcept { this->cx = cx; this->cy = cy; }
152 inline UNIT_TYPE minimum()
const {
return sequence_type <UNIT_TYPE, 2>::minimum();}
153 inline UNIT_TYPE maximum()
const {
return sequence_type <UNIT_TYPE, 2>::maximum();}
154 inline size_type minimum(
const size_type & s)
const noexcept {
return size_type(::minimum(this->cx, s.cx), ::minimum(this->cy, s.cy)); }
155 inline size_type maximum(
const size_type& s)
const noexcept {
return size_type(::maximum(this->cx, s.cx), ::maximum(this->cy, s.cy)); }
157 inline size_type & ensure_at_most(
const size_type & s)
noexcept { this->cx = ::minimum(this->cx, s.cx); this->cy = ::minimum(this->cy, s.cy);
return *
this; }
158 inline size_type & ensure_at_least(
const size_type & s)
noexcept { this->cx = ::maximum(this->cx, s.cx); this->cy = ::maximum(this->cy, s.cy);
return *
this; }
160 inline static size_type unit_size() {
return size_type(1, 1); }
162 inline size_type transposed()
const {
return size_type(this->cy, this->cx); }
164 inline size_type aspect_width(UNIT_TYPE w) {
return size_type(w, w * this->cy / this->cx); }
165 inline size_type aspect_height(UNIT_TYPE h) {
return size_type(h * this->cx / this->cy, h); }
166 inline ::design::enum_fit get_fit(size_type s) {
return (::design::enum_fit) ::numeric::sign(s.cx *this->cy - s.cy * this->cx); }
167 inline size_type fit(size_type s)
169 if (get_fit(s) == ::design::e_fit_height)
return aspect_height(s.cy);
else return aspect_width(s.cx);
171 inline ::design::enum_match get_expand(size_type s) {
return (::design::enum_match)(-(::i32)get_fit(s)); }
172 inline size_type expand(size_type s)
174 if (get_expand(s) == ::design::e_match_height)
return aspect_height(s.cy);
else return aspect_width(s.cx);
177 inline size_type & operator =(
const size_type & size)
noexcept { this->cx = size.cx; this->cy = size.cy;
return *
this; }
179 template < prototype_size SIZE >
180 inline size_type & operator +=(
const SIZE & size)
noexcept { this->cx += size.cx; this->cy += size.cy;
return *
this; }
182 template < prototype_size SIZE >
183 inline size_type & operator-=(
const SIZE & size)
noexcept { this->cx -= size.cx; this->cy -= size.cy;
return *
this; }
188 template < prototype_number NUMBER1 >
189 inline size_type & operator +=(
const sequence_type < NUMBER1, 2 > & sequence)
noexcept { this->cx = (UNIT_TYPE) (this->cx + sequence.x); this->cy = (UNIT_TYPE) (this->cy + sequence.y);
return *
this; }
191 template < prototype_number NUMBER1 >
192 inline size_type & operator -=(
const sequence_type < NUMBER1, 2 > & sequence)
noexcept { this->cx = (UNIT_TYPE) (this->cx - sequence.x); this->cy = (UNIT_TYPE) (this->cy - sequence.y);
return *
this; }
197 template < prototype_number NUMBER1 >
198 inline size_type & operator +=(NUMBER1 n)
noexcept { this->cx = UNIT_TYPE(this->cx + n); this->cy = UNIT_TYPE(this->cy + n);
return *
this; }
200 template < prototype_number NUMBER1 >
201 inline size_type & operator -=(NUMBER1 n)
noexcept { this->cx = UNIT_TYPE(this->cx - n); this->cy = UNIT_TYPE(this->cy - n);
return *
this; }
203 template < prototype_number NUMBER1 >
204 inline size_type & operator *=(NUMBER1 n)
noexcept { this->cx = UNIT_TYPE(this->cx * n); this->cy = UNIT_TYPE(this->cy * n);
return *
this; }
206 template < prototype_number NUMBER1 >
207 inline size_type & operator /=(NUMBER1 n)
noexcept { this->cx = UNIT_TYPE(this->cx / n); this->cy = UNIT_TYPE(this->cy / n);
return *
this; }
209 inline void set_size(UNIT_TYPE cx, UNIT_TYPE cy)
noexcept {this->cx = cx; this->cy = cy; }
210 inline void set_size(
const size_type & size_type)
noexcept { set_size(size_type.cx, size_type.cy); }
212 template < prototype_number NUMBER1 >
213 inline size_type < largest_number < UNIT_TYPE, NUMBER1 > > operator +(
const sequence_type < NUMBER1, 2 > & sequence)
const noexcept {
return size_type < largest_number < UNIT_TYPE, NUMBER1 > > ((largest_number < UNIT_TYPE, NUMBER1 >) (this->cx + sequence.x), (largest_number < UNIT_TYPE, NUMBER1 >) (this->cy + sequence.y)); }
215 template < prototype_number NUMBER1 >
216 inline size_type < largest_number < UNIT_TYPE, NUMBER1 > > operator -(
const sequence_type < NUMBER1, 2 > & sequence)
const noexcept {
return size_type < largest_number < UNIT_TYPE, NUMBER1 > > ((largest_number < UNIT_TYPE, NUMBER1 >) (this->cx - sequence.x), (largest_number < UNIT_TYPE, NUMBER1 >) (this->cy - sequence.y)); }
218 inline size_type operator-()
const noexcept {
return size_type(-this->cx, -this->cy); }
224 template < prototype_number NUMBER1 >
225 inline size_type < largest_number < UNIT_TYPE, NUMBER1 > > operator /(NUMBER1 l)
const noexcept {
return size_type < largest_number < UNIT_TYPE, NUMBER1 > >((largest_number < UNIT_TYPE, NUMBER1 >)(this->cx / l), (largest_number < UNIT_TYPE, NUMBER1 >)(this->cy / l)); }
229 template < prototype_number NUMBER1 >
230 inline size_type < largest_number < UNIT_TYPE, NUMBER1 > > operator /(
const sequence_type <NUMBER1, 2> & sequence)
const {
return size_type < largest_number < UNIT_TYPE, NUMBER1 > >((largest_number < UNIT_TYPE, NUMBER1 >)(this->cx / sequence.x), (largest_number < UNIT_TYPE, NUMBER1 >)(this->cy / sequence.y)); }
232 template < prototype_number NUMBER1 >
233 inline size_type < largest_number < UNIT_TYPE, NUMBER1 > > operator *(NUMBER1 d)
const noexcept {
return size_type < largest_number < UNIT_TYPE, NUMBER1 > >((largest_number < UNIT_TYPE, NUMBER1 >)(this->cx * d), (largest_number < UNIT_TYPE, NUMBER1 >)(this->cy * d)); }
236 template < prototype_number NUMBER1 >
237 inline size_type<largest_number < UNIT_TYPE, NUMBER1 >> operator +(NUMBER1 d)
const noexcept {
return size_type < largest_number < UNIT_TYPE, NUMBER1 > >((largest_number < UNIT_TYPE, NUMBER1 >)(this->cx + d), (largest_number < UNIT_TYPE, NUMBER1 >)(this->cy + d)); }
240 template < prototype_number NUMBER1 >
241 inline size_type < largest_number < UNIT_TYPE, NUMBER1 > > operator -(NUMBER1 d)
const noexcept {
return size_type < largest_number < UNIT_TYPE, NUMBER1 > >((largest_number < UNIT_TYPE, NUMBER1 >)(this->cx - d), (largest_number < UNIT_TYPE, NUMBER1 >)(this->cy - d)); }
244 template < prototype_number NUMBER1 >
245 inline size_type < largest_number < UNIT_TYPE, NUMBER1 > > half_away(
const size_type < NUMBER1 >& size) {
return size_type < largest_number < UNIT_TYPE, NUMBER1 > >((this->cx - size.cx) / (largest_number < UNIT_TYPE, NUMBER1 >) 2, (this->cy - size.cy) / (largest_number < UNIT_TYPE, NUMBER1 >) 2); }
250 inline bool operator == (
const size_type & size)
const noexcept {
return this->cx == size.cx && this->cy == size.cy; }
256 inline bool operator >= (
const size_type & size)
const noexcept
259 return this->cx >= size.cx && this->cy >= size.cy;
264 inline bool operator > (
const size_type & size)
const noexcept
267 return *
this >= size && *
this != size;
272 inline bool operator <= (
const size_type & size)
const noexcept
275 return this->cx <= size.cx && this->cy <= size.cy;
280 inline bool operator < (
const size_type & size)
const noexcept
283 return *
this <= size && *
this != size;
291 inline bool any_gt (
const size_type & size)
const noexcept {
return this->cx > size.cx || this->cy > size.cy; }
292 inline bool any_ge (
const size_type & size)
const noexcept {
return this->cx >= size.cx || this->cy >= size.cy; }
293 inline bool any_lt (
const size_type & size)
const noexcept {
return this->cx < size.cx || this->cy < size.cy; }
294 inline bool any_le (
const size_type & size)
const noexcept {
return this->cx <= size.cx || this->cy <= size.cy; }
302 constexpr operator hash32()
const
305 return ::hash32(this->cx) +
::hash32(this->cy);