26 constexpr
Point(
int xpos,
int ypos)
42 bool operator==(
const Point &lhs,
const Point &rhs);
43 static inline bool operator!=(
const Point &lhs,
const Point &rhs)
48 std::ostream &
operator<<(std::ostream &out,
const Point &p);
58 constexpr
Size(
unsigned int w,
unsigned int h)
78 width = (
width + hAlignment - 1) / hAlignment * hAlignment;
79 height = (
height + vAlignment - 1) / vAlignment * vAlignment;
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
173 bool operator==(
const Size &lhs,
const Size &rhs);
174 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)
196 std::ostream &
operator<<(std::ostream &out,
const Size &s);
217 unsigned int hstep,
unsigned int vstep)
235 return !(lhs == rhs);
238 std::ostream &
operator<<(std::ostream &out,
const SizeRange &sr);
253 constexpr
Rectangle(
int xpos,
int ypos,
unsigned int w,
unsigned int h)
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)))
298 const Size &denominator)
const;
305 bool operator==(
const Rectangle &lhs,
const Rectangle &rhs);
306 static inline bool operator!=(
const Rectangle &lhs,
const Rectangle &rhs)
308 return !(lhs == rhs);
311 std::ostream &
operator<<(std::ostream &out,
const Rectangle &r);
Describe a point in two-dimensional space.
Definition: geometry.h:19
int y
The y-coordinate of the Point.
Definition: geometry.h:32
constexpr Point()
Construct a Point with x and y set to 0.
Definition: geometry.h:21
constexpr Point operator-() const
Negate a Point by negating both its x and y coordinates.
Definition: geometry.h:36
int x
The x-coordinate of the Point.
Definition: geometry.h:31
constexpr Point(int xpos, int ypos)
Construct a Point at given xpos and ypos values.
Definition: geometry.h:26
const std::string toString() const
Assemble and return a string describing the point.
Definition: geometry.cpp:56
Describe a rectangle's position and dimensions.
Definition: geometry.h:241
Rectangle & scaleBy(const Size &numerator, const Size &denominator)
Apply a non-uniform rational scaling in place to this Rectangle.
Definition: geometry.cpp:722
int y
The vertical coordinate of the rectangle's top-left corner.
Definition: geometry.h:273
Point center() const
Retrieve the center point of this rectangle.
Definition: geometry.cpp:691
Rectangle translatedBy(const Point &point) const
Translate a Rectangle by the given amounts.
Definition: geometry.cpp:835
constexpr Rectangle(const Point &point1, const Point &point2)
Construct a Rectangle from two opposite corners.
Definition: geometry.h:263
unsigned int height
The distance between the top and bottom sides.
Definition: geometry.h:275
constexpr Rectangle(const Size &size)
Construct a Rectangle of size with its top left corner located at (0,0)
Definition: geometry.h:258
constexpr Rectangle(int xpos, int ypos, const Size &size)
Construct a Rectangle with the given position and size.
Definition: geometry.h:248
const std::string toString() const
Assemble and return a string describing the rectangle.
Definition: geometry.cpp:679
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
Point topLeft() const
Retrieve the coordinates of the top left corner of this Rectangle.
Definition: geometry.h:287
Rectangle enclosedIn(const Rectangle &boundary) const
Enclose a Rectangle so as not to exceed another Rectangle.
Definition: geometry.cpp:792
bool isNull() const
Check if the rectangle is null.
Definition: geometry.h:277
unsigned int width
The distance between the left and right sides.
Definition: geometry.h:274
Rectangle transformedBetween(const Rectangle &source, const Rectangle &target) const
Transform a Rectangle from one reference rectangle to another.
Definition: geometry.cpp:874
Rectangle & translateBy(const Point &point)
Translate this Rectangle in place by the given Point.
Definition: geometry.cpp:741
Size size() const
Retrieve the size of this rectangle.
Definition: geometry.h:282
constexpr Rectangle()
Construct a Rectangle with all coordinates set to 0.
Definition: geometry.h:243
int x
The horizontal coordinate of the rectangle's top-left corner.
Definition: geometry.h:272
Rectangle boundedTo(const Rectangle &bound) const
Calculate the intersection of this Rectangle with another.
Definition: geometry.cpp:761
Rectangle scaledBy(const Size &numerator, const Size &denominator) const
Apply a non-uniform rational scaling to this Rectangle.
Definition: geometry.cpp:816
Describe a range of sizes.
Definition: geometry.h:199
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
SizeRange(const Size &minSize, const Size &maxSize)
Construct a size range with specified min and max, and steps of 1.
Definition: geometry.h:211
unsigned int vStep
The vertical step.
Definition: geometry.h:229
SizeRange(const Size &size)
Construct a size range representing a single size.
Definition: geometry.h:206
Size max
The maximum size.
Definition: geometry.h:227
unsigned int hStep
The horizontal step.
Definition: geometry.h:228
SizeRange()
Construct a size range initialized to 0.
Definition: geometry.h:201
Size min
The minimum size.
Definition: geometry.h:226
bool contains(const Size &size) const
Test if a size is contained in the range.
Definition: geometry.cpp:539
std::string toString() const
Assemble and return a string describing the size range.
Definition: geometry.cpp:554
Describe a two-dimensional size.
Definition: geometry.h:51
Size & operator/=(float factor)
Scale this size down by the given factor in place.
Definition: geometry.cpp:372
constexpr Size shrunkBy(const Size &margins) const
Shrink the size by margins.
Definition: geometry.h:153
Size & alignUpTo(unsigned int hAlignment, unsigned int vAlignment)
Align the size up horizontally and vertically in place.
Definition: geometry.h:76
Size & shrinkBy(const Size &margins)
Shrink the size by margins in place.
Definition: geometry.h:104
const std::string toString() const
Assemble and return a string describing the size.
Definition: geometry.cpp:136
Size operator/(float factor) const
Scale size down by the given factor.
Definition: geometry.cpp:350
constexpr Size expandedTo(const Size &expand) const
Expand the size to expand.
Definition: geometry.h:137
constexpr Size()
Construct a Size with width and height set to 0.
Definition: geometry.h:53
constexpr Size alignedDownTo(unsigned int hAlignment, unsigned int vAlignment) const
Align the size down horizontally and vertically.
Definition: geometry.h:111
Size & boundTo(const Size &bound)
Bound the size to bound in place.
Definition: geometry.h:83
constexpr Size grownBy(const Size &margins) const
Grow the size by margins.
Definition: geometry.h:145
unsigned int width
The Size width.
Definition: geometry.h:63
Size & alignDownTo(unsigned int hAlignment, unsigned int vAlignment)
Align the size down horizontally and vertically in place.
Definition: geometry.h:69
Rectangle centeredTo(const Point ¢er) const
Center a rectangle of this size at a given Point.
Definition: geometry.cpp:327
constexpr Size(unsigned int w, unsigned int h)
Construct a Size with given width and height.
Definition: geometry.h:58
bool isNull() const
Check if the size is null.
Definition: geometry.h:66
Size & expandTo(const Size &expand)
Expand the size to expand.
Definition: geometry.h:90
constexpr Size boundedTo(const Size &bound) const
Bound the size to bound.
Definition: geometry.h:129
Size boundedToAspectRatio(const Size &ratio) const
Bound the size down to match the aspect ratio given by ratio.
Definition: geometry.cpp:278
Size expandedToAspectRatio(const Size &ratio) const
Expand the size to match the aspect ratio given by ratio.
Definition: geometry.cpp:303
Size operator*(float factor) const
Scale size up by the given factor.
Definition: geometry.cpp:340
constexpr Size alignedUpTo(unsigned int hAlignment, unsigned int vAlignment) const
Align the size up horizontally and vertically.
Definition: geometry.h:120
unsigned int height
The Size height.
Definition: geometry.h:64
Size & growBy(const Size &margins)
Grow the size by margins in place.
Definition: geometry.h:97
Size & operator*=(float factor)
Scale this size up by the given factor in place.
Definition: geometry.cpp:360
Top-level libcamera namespace.
Definition: bound_method.h:15
std::ostream & operator<<(std::ostream &out, const Point &p)
Insert a text representation of a Point into an output stream.
Definition: geometry.cpp:91
bool operator==(const ColorSpace &lhs, const ColorSpace &rhs)
Compare color spaces for equality.
Definition: color_space.cpp:506
bool operator<(const Size &lhs, const Size &rhs)
Compare sizes for smaller than order.
Definition: geometry.cpp:399