26 constexpr
Point(
int xpos,
int ypos)
43 static inline bool operator!=(
const Point &lhs,
const Point &rhs)
58 constexpr
Size(
unsigned int w,
unsigned int h)
66 bool isNull()
const {
return !width && !height; }
71 width = width / hAlignment * hAlignment;
72 height = height / vAlignment * vAlignment;
78 width = (width + hAlignment - 1) / hAlignment * hAlignment;
79 height = (height + vAlignment - 1) / vAlignment * vAlignment;
85 width = std::min(width, bound.
width);
86 height = std::min(height, bound.
height);
92 width = std::max(width, expand.
width);
93 height = std::max(height, expand.
height);
99 width += margins.
width;
106 width = width > margins.
width ? width - margins.
width : 0;
107 height = height > margins.
height ? height - margins.
height : 0;
112 unsigned int vAlignment)
const 115 width / hAlignment * hAlignment,
116 height / vAlignment * vAlignment
121 unsigned int vAlignment)
const 124 (width + hAlignment - 1) / hAlignment * hAlignment,
125 (height + vAlignment - 1) / vAlignment * vAlignment
132 std::min(width, bound.
width),
133 std::min(height, bound.
height)
140 std::max(width, expand.
width),
141 std::max(height, expand.
height)
148 width + margins.
width,
156 width > margins.
width ? width - margins.
width : 0,
161 [[nodiscard]]
Size boundedToAspectRatio(
const Size &ratio)
const;
162 [[nodiscard]]
Size expandedToAspectRatio(
const Size &ratio)
const;
169 Size &operator*=(
float factor);
170 Size &operator/=(
float factor);
173 bool operator==(
const Size &lhs,
const Size &rhs);
176 static inline bool operator!=(
const Size &lhs,
const Size &rhs)
178 return !(lhs == rhs);
181 static inline bool operator<=(
const Size &lhs,
const Size &rhs)
183 return lhs < rhs || lhs == rhs;
186 static inline bool operator>(
const Size &lhs,
const Size &rhs)
188 return !(lhs <= rhs);
191 static inline bool operator>=(
const Size &lhs,
const Size &rhs)
207 : min(size), max(size), hStep(1), vStep(1)
212 : min(minSize), max(maxSize), hStep(1), vStep(1)
217 unsigned int hstep,
unsigned int vstep)
218 : min(minSize), max(maxSize), hStep(hstep), vStep(vstep)
222 bool contains(
const Size &size)
const;
235 return !(lhs == rhs);
244 : Rectangle(0, 0, 0, 0)
249 :
x(xpos),
y(ypos), width(size.width), height(size.height)
253 constexpr
Rectangle(
int xpos,
int ypos,
unsigned int w,
unsigned int h)
254 :
x(xpos),
y(ypos), width(w), height(h)
259 :
x(0),
y(0), width(size.width), height(size.height)
264 : Rectangle(std::min(point1.
x, point2.
x), std::min(point1.
y, point2.
y),
265 static_cast<unsigned int>(std::max(point1.
x, point2.
x)) -
266 static_cast<unsigned int>(std::min(point1.
x, point2.
x)),
267 static_cast<unsigned int>(std::max(point1.
y, point2.
y)) -
268 static_cast<unsigned int>(std::min(point1.
y, point2.
y)))
277 bool isNull()
const {
return !width && !height; }
280 Point center()
const;
284 return { width, height };
298 const Size &denominator)
const;
308 return !(lhs == rhs);
constexpr Size expandedTo(const Size &expand) const
Expand the size to expand.
Definition: geometry.h:137
constexpr Point operator-() const
Negate a Point by negating both its x and y coordinates.
Definition: geometry.h:36
bool operator==(const ColorSpace &lhs, const ColorSpace &rhs)
Compare color spaces for equality.
Definition: color_space.cpp:506
Point topLeft() const
Retrieve the coordinates of the top left corner of this Rectangle.
Definition: geometry.h:287
constexpr Rectangle(const Size &size)
Construct a Rectangle of size with its top left corner located at (0,0)
Definition: geometry.h:258
unsigned int vStep
The vertical step.
Definition: geometry.h:229
constexpr Size alignedUpTo(unsigned int hAlignment, unsigned int vAlignment) const
Align the size up horizontally and vertically.
Definition: geometry.h:120
Size & alignUpTo(unsigned int hAlignment, unsigned int vAlignment)
Align the size up horizontally and vertically in place.
Definition: geometry.h:76
Size & expandTo(const Size &expand)
Expand the size to expand.
Definition: geometry.h:90
SizeRange(const Size &size)
Construct a size range representing a single size.
Definition: geometry.h:206
Top-level libcamera namespace.
Definition: bound_method.h:15
unsigned int hStep
The horizontal step.
Definition: geometry.h:228
int y
The vertical coordinate of the rectangle's top-left corner.
Definition: geometry.h:273
SizeRange(const Size &minSize, const Size &maxSize, unsigned int hstep, unsigned int vstep)
Construct a size range with specified min, max and step.
Definition: geometry.h:216
constexpr Rectangle(int xpos, int ypos, unsigned int w, unsigned int h)
Construct a Rectangle with the given position and size.
Definition: geometry.h:253
Describe a point in two-dimensional space.
Definition: geometry.h:18
Describe a two-dimensional size.
Definition: geometry.h:50
SizeRange()
Construct a size range initialized to 0.
Definition: geometry.h:201
Transform operator/(const Orientation &o1, const Orientation &o2)
Return the Transform that applied to o2 gives o1.
Definition: transform.cpp:347
bool isNull() const
Check if the rectangle is null.
Definition: geometry.h:277
constexpr Size boundedTo(const Size &bound) const
Bound the size to bound.
Definition: geometry.h:129
int x
The horizontal coordinate of the rectangle's top-left corner.
Definition: geometry.h:272
Size & alignDownTo(unsigned int hAlignment, unsigned int vAlignment)
Align the size down horizontally and vertically in place.
Definition: geometry.h:69
bool isNull() const
Check if the size is null.
Definition: geometry.h:66
int x
The x-coordinate of the Point.
Definition: geometry.h:31
constexpr Rectangle()
Construct a Rectangle with all coordinates set to 0.
Definition: geometry.h:243
Size size() const
Retrieve the size of this rectangle.
Definition: geometry.h:282
bool operator<(const Size &lhs, const Size &rhs)
Compare sizes for smaller than order.
Definition: geometry.cpp:399
Describe a rectangle's position and dimensions.
Definition: geometry.h:240
constexpr Point(int xpos, int ypos)
Construct a Point at given xpos and ypos values.
Definition: geometry.h:26
Transform operator*(Transform t0, Transform t1)
Compose two transforms by applying t0 first then t1.
Definition: transform.cpp:209
Size & growBy(const Size &margins)
Grow the size by margins in place.
Definition: geometry.h:97
Size & shrinkBy(const Size &margins)
Shrink the size by margins in place.
Definition: geometry.h:104
unsigned int width
The Size width.
Definition: geometry.h:63
constexpr Size grownBy(const Size &margins) const
Grow the size by margins.
Definition: geometry.h:145
constexpr Size()
Construct a Size with width and height set to 0.
Definition: geometry.h:53
Size & boundTo(const Size &bound)
Bound the size to bound in place.
Definition: geometry.h:83
Size min
The minimum size.
Definition: geometry.h:226
unsigned int height
The Size height.
Definition: geometry.h:64
constexpr Size(unsigned int w, unsigned int h)
Construct a Size with given width and height.
Definition: geometry.h:58
std::ostream & operator<<(std::ostream &out, const Point &p)
Insert a text representation of a Point into an output stream.
Definition: geometry.cpp:91
SizeRange(const Size &minSize, const Size &maxSize)
Construct a size range with specified min and max, and steps of 1.
Definition: geometry.h:211
Describe a range of sizes.
Definition: geometry.h:198
const std::string toString() const
Assemble and return a string describing the point.
Definition: geometry.cpp:56
unsigned int width
The distance between the left and right sides.
Definition: geometry.h:274
constexpr Rectangle(const Point &point1, const Point &point2)
Construct a Rectangle from two opposite corners.
Definition: geometry.h:263
constexpr Point()
Construct a Point with x and y set to 0.
Definition: geometry.h:21
constexpr Rectangle(int xpos, int ypos, const Size &size)
Construct a Rectangle with the given position and size.
Definition: geometry.h:248
unsigned int height
The distance between the top and bottom sides.
Definition: geometry.h:275
constexpr Size alignedDownTo(unsigned int hAlignment, unsigned int vAlignment) const
Align the size down horizontally and vertically.
Definition: geometry.h:111
constexpr Size shrunkBy(const Size &margins) const
Shrink the size by margins.
Definition: geometry.h:153
int y
The y-coordinate of the Point.
Definition: geometry.h:32
Size max
The maximum size.
Definition: geometry.h:227