libcamera
v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
|
Describe a two-dimensional size. More...
Public Member Functions | |
constexpr | Size () |
Construct a Size with width and height set to 0. | |
constexpr | Size (unsigned int w, unsigned int h) |
Construct a Size with given width and height. More... | |
bool | isNull () const |
Check if the size is null. More... | |
const std::string | toString () const |
Assemble and return a string describing the size. More... | |
Size & | alignDownTo (unsigned int hAlignment, unsigned int vAlignment) |
Align the size down horizontally and vertically in place. More... | |
Size & | alignUpTo (unsigned int hAlignment, unsigned int vAlignment) |
Align the size up horizontally and vertically in place. More... | |
Size & | boundTo (const Size &bound) |
Bound the size to bound in place. More... | |
Size & | expandTo (const Size &expand) |
Expand the size to expand. More... | |
Size & | growBy (const Size &margins) |
Grow the size by margins in place. More... | |
Size & | shrinkBy (const Size &margins) |
Shrink the size by margins in place. More... | |
__nodiscard constexpr Size | alignedDownTo (unsigned int hAlignment, unsigned int vAlignment) const |
Align the size down horizontally and vertically. More... | |
__nodiscard constexpr Size | alignedUpTo (unsigned int hAlignment, unsigned int vAlignment) const |
Align the size up horizontally and vertically. More... | |
__nodiscard constexpr Size | boundedTo (const Size &bound) const |
Bound the size to bound. More... | |
__nodiscard constexpr Size | expandedTo (const Size &expand) const |
Expand the size to expand. More... | |
__nodiscard constexpr Size | grownBy (const Size &margins) const |
Grow the size by margins. More... | |
__nodiscard constexpr Size | shrunkBy (const Size &margins) const |
Shrink the size by margins. More... | |
__nodiscard Size | boundedToAspectRatio (const Size &ratio) const |
Bound the size down to match the aspect ratio given by ratio. More... | |
__nodiscard Size | expandedToAspectRatio (const Size &ratio) const |
Expand the size to match the aspect ratio given by ratio. More... | |
__nodiscard Rectangle | centeredTo (const Point ¢er) const |
Center a rectangle of this size at a given Point. More... | |
Size | operator* (float factor) const |
Scale size up by the given factor. More... | |
Size | operator/ (float factor) const |
Scale size down by the given factor. More... | |
Size & | operator*= (float factor) |
Scale this size up by the given factor in place. More... | |
Size & | operator/= (float factor) |
Scale this size down by the given factor in place. More... | |
Public Attributes | |
unsigned int | width |
The Size width. | |
unsigned int | height |
The Size height. | |
Describe a two-dimensional size.
The Size class defines a two-dimensional size with integer precision.
|
inline |
|
inline |
Align the size down horizontally and vertically in place.
[in] | hAlignment | Horizontal alignment |
[in] | vAlignment | Vertical alignment |
This functions rounds the width and height down to the nearest multiple of hAlignment and vAlignment respectively.
|
inline |
Align the size down horizontally and vertically.
[in] | hAlignment | Horizontal alignment |
[in] | vAlignment | Vertical alignment |
|
inline |
Align the size up horizontally and vertically.
[in] | hAlignment | Horizontal alignment |
[in] | vAlignment | Vertical alignment |
|
inline |
Align the size up horizontally and vertically in place.
[in] | hAlignment | Horizontal alignment |
[in] | vAlignment | Vertical alignment |
This functions rounds the width and height up to the nearest multiple of hAlignment and vAlignment respectively.
|
inline |
Bound the size to bound.
[in] | bound | The maximum size |
Bound the size down to match the aspect ratio given by ratio.
[in] | ratio | The size whose aspect ratio must be matched |
The behaviour of this function is undefined if either the width or the height of the ratio is zero.
|
inline |
Bound the size to bound in place.
[in] | bound | The maximum size |
This function sets the width and height to the minimum of this size and the bound size.
|
inline |
Expand the size to expand.
[in] | expand | The minimum size |
Expand the size to match the aspect ratio given by ratio.
[in] | ratio | The size whose aspect ratio must be matched |
The behaviour of this function is undefined if either the width or the height of the ratio is zero.
|
inline |
Expand the size to expand.
[in] | expand | The minimum size |
This function sets the width and height to the maximum of this size and the expand size.
|
inline |
Grow the size by margins in place.
[in] | margins | The margins to add to the size |
This function adds the width and height of the margin size to this size.
|
inline |
Grow the size by margins.
[in] | margins | The margins to add to the size |
|
inline |
Check if the size is null.
Size libcamera::Size::operator* | ( | float | factor | ) | const |
Size & libcamera::Size::operator*= | ( | float | factor | ) |
Scale this size up by the given factor in place.
[in] | factor | The factor |
Size libcamera::Size::operator/ | ( | float | factor | ) | const |
Size & libcamera::Size::operator/= | ( | float | factor | ) |
Scale this size down by the given factor in place.
[in] | factor | The factor |
|
inline |
Shrink the size by margins in place.
[in] | margins | The margins to subtract to the size |
This function subtracts the width and height of the margin size from this size. If the width or height of the size are smaller than those of margins, the result is clamped to 0.
|
inline |
Shrink the size by margins.
[in] | margins | The margins to subtract to the size |
If the width or height of the size are smaller than those of margins, the resulting size has its width or height clamped to 0.
const std::string libcamera::Size::toString | ( | ) | const |
Assemble and return a string describing the size.