Molybden API
Loading...
Searching...
No Matches
geometry.hpp
1// Copyright (c) 2000-2023 TeamDev Ltd. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_GEOMETRY_HPP
6#define MOLYBDEN_GEOMETRY_HPP
7
8#include <cstdint>
9
10namespace molybden {
11
16struct Point {
17 Point();
18 Point(int32_t x, int32_t y);
19
23 int32_t x;
24
28 int32_t y;
29};
30
35struct Size {
39 static Size empty() { return {0, 0}; }
40
41 Size();
42 Size(uint32_t width, uint32_t height);
43
47 bool isEmpty() const { return width == 0 && height == 0; }
48
52 bool operator==(const Size& other) const {
53 return width == other.width && height == other.height;
54 }
55
59 bool operator!=(const Size& other) const { return !(*this == other); }
60
64 uint32_t width;
65
69 uint32_t height;
70};
71
75struct Rect {
76 Rect();
78 Rect(Size size);
80
85
90};
91
92} // namespace molybden
93
94#endif // MOLYBDEN_GEOMETRY_HPP
A pair of numbers that in general are used to define coordinates in the two-dimensional space.
Definition geometry.hpp:16
int32_t y
The vertical coordinate.
Definition geometry.hpp:28
int32_t x
The horizontal coordinate.
Definition geometry.hpp:23
A rectangle described by the location and dimensions.
Definition geometry.hpp:75
Point origin
The upper-left corner of the rectangle.
Definition geometry.hpp:84
Size size
The rectangle dimensions.
Definition geometry.hpp:89
A pair of numbers that in general are used to define dimensions in the two-dimensional space.
Definition geometry.hpp:35
bool operator==(const Size &other) const
Two sizes are equal if their width and height are equal.
Definition geometry.hpp:52
static Size empty()
Creates an empty Size with zero width and height.
Definition geometry.hpp:39
bool isEmpty() const
Returns true if this size is empty.
Definition geometry.hpp:47
bool operator!=(const Size &other) const
Two sizes are unequal if either their width or height are unequal.
Definition geometry.hpp:59
uint32_t width
The horizontal dimension.
Definition geometry.hpp:64
uint32_t height
The vertical dimension.
Definition geometry.hpp:69