class
#include <bn_fixed_size.h>
fixed_size Defines the size of a two-dimensional object using fixed point precision.
Constructors, destructors, conversion operators
- fixed_size() defaulted constexpr
- Default constructor.
- fixed_size(fixed width, fixed height) constexpr
- Constructor.
- fixed_size(const size& size) constexpr
- Constructor.
Public functions
- auto width() const -> fixed constexpr
- Returns the width.
- void set_width(fixed width) constexpr
- Sets the width.
- auto height() const -> fixed constexpr
- Returns the height.
- void set_height(fixed height) constexpr
- Sets the height.
-
auto multiplication(int value) const -> fixed_
size constexpr - Returns the multiplication of this size by the given integer value.
-
auto multiplication(fixed value) const -> fixed_
size constexpr - Returns the multiplication of this size by the given fixed point value, using half precision to try to avoid overflow.
-
auto safe_multiplication(int value) const -> fixed_
size constexpr - Returns the multiplication of this size by the given integer value.
-
auto safe_multiplication(fixed value) const -> fixed_
size constexpr - Returns the multiplication of this size by the given fixed point value, casting them to int64_t to try to avoid overflow.
-
auto unsafe_multiplication(int value) const -> fixed_
size constexpr - Returns the multiplication of this size by the given integer value.
-
auto unsafe_multiplication(fixed value) const -> fixed_
size constexpr - Returns the multiplication of this size by the given fixed point value without trying to avoid overflow.
-
auto division(int value) const -> fixed_
size constexpr - Returns the division of this size by the given integer value.
-
auto division(fixed value) const -> fixed_
size constexpr - Returns the division of this size by the given fixed point value, using half precision to try to avoid overflow.
-
auto safe_division(int value) const -> fixed_
size constexpr - Returns the division of this value by the given integer value.
-
auto safe_division(fixed value) const -> fixed_
size constexpr - Returns the division of this size by the given fixed point value, casting them to int64_t to try to avoid overflow.
-
auto unsafe_division(int value) const -> fixed_
size constexpr - Returns the division of this value by the given integer value.
-
auto unsafe_division(fixed value) const -> fixed_
size constexpr - Returns the division of this size by the given fixed point value without trying to avoid overflow.
-
auto operator+=(const fixed_
size& other) -> fixed_ size& constexpr - Adds the given fixed_
size to this one. -
auto operator-=(const fixed_
size& other) -> fixed_ size& constexpr - Subtracts the given fixed_
size to this one. -
auto operator*=(int value) -> fixed_
size& constexpr - Multiplies both width and height by the given factor.
-
auto operator*=(fixed value) -> fixed_
size& constexpr - Multiplies both width and height by the given factor.
-
auto operator/=(int value) -> fixed_
size& constexpr - Divides both width and height by the given divisor.
-
auto operator/=(fixed value) -> fixed_
size& constexpr - Divides both width and height by the given divisor.
Friends
-
auto operator+(const fixed_
size& a, const fixed_ size& b) -> fixed_ size constexpr - Returns the sum of a and b.
-
auto operator-(const fixed_
size& a, const fixed_ size& b) -> fixed_ size constexpr - Returns b subtracted from a.
-
auto operator*(const fixed_
size& a, int b) -> fixed_ size constexpr - Returns a multiplied by b.
-
auto operator*(const fixed_
size& a, fixed b) -> fixed_ size constexpr - Returns a multiplied by b.
-
auto operator/(const fixed_
size& a, int b) -> fixed_ size constexpr - Returns a divided by b.
-
auto operator/(const fixed_
size& a, fixed b) -> fixed_ size constexpr - Returns a divided by b.
-
auto operator==(const fixed_
size& a, const fixed_ size& b) -> bool defaulted constexpr - Default equal operator.
Function documentation
bn:: fixed_size:: fixed_size(fixed width,
fixed height) constexpr
Constructor.
Parameters | |
---|---|
width | Valid width (>= 0). |
height | Valid height (>= 0). |
void bn:: fixed_size:: set_height(fixed height) constexpr
Sets the height.
Parameters | |
---|---|
height | Valid height (>= 0). |
fixed_ size& bn:: fixed_size:: operator+=(const fixed_ size& other) constexpr
Adds the given fixed_
Parameters | |
---|---|
other | fixed_ |
Returns | Reference to this. |
fixed_ size& bn:: fixed_size:: operator-=(const fixed_ size& other) constexpr
Subtracts the given fixed_
Parameters | |
---|---|
other | fixed_ |
Returns | Reference to this. |
fixed_ size& bn:: fixed_size:: operator*=(int value) constexpr
Multiplies both width and height by the given factor.
Parameters | |
---|---|
value | Valid integer multiplication factor (>= 0). |
Returns | Reference to this. |
fixed_ size& bn:: fixed_size:: operator*=(fixed value) constexpr
Multiplies both width and height by the given factor.
Parameters | |
---|---|
value | Valid fixed point multiplication factor (>= 0). |
Returns | Reference to this. |
fixed_ size& bn:: fixed_size:: operator/=(int value) constexpr
Divides both width and height by the given divisor.
Parameters | |
---|---|
value | Valid integer divisor (> 0). |
Returns | Reference to this. |
fixed_ size& bn:: fixed_size:: operator/=(fixed value) constexpr
Divides both width and height by the given divisor.
Parameters | |
---|---|
value | Valid fixed point divisor (> 0). |
Returns | Reference to this. |