Go to the documentation of this file.
19 #ifndef MIR_GEOMETRY_LENGTH_H_
20 #define MIR_GEOMETRY_LENGTH_H_
42 constexpr
Length(
float mag,
Units units) : magnitude(mag * units) {}
47 return static_cast<float>(magnitude) / units;
57 return magnitude == rhs.magnitude;
62 return magnitude != rhs.magnitude;
69 inline constexpr
Length operator"" _mm(
long double mag)
74 inline constexpr
Length operator"" _mm(
unsigned long long mag)
79 inline constexpr
Length operator"" _cm(
long double mag)
84 inline constexpr
Length operator"" _cm(
unsigned long long mag)
89 inline constexpr
Length operator"" _in(
long double mag)
94 inline constexpr
Length operator"" _in(
unsigned long long mag)
102 #endif // MIR_GEOMETRY_LENGTH_H_
constexpr Length()
Definition: length.h:40
constexpr bool operator==(Length const &rhs) const
Definition: length.h:55
constexpr Length(Length const &)=default
@ centimetres
Definition: length.h:36
constexpr float as_pixels(float dpi) const
Definition: length.h:50
constexpr bool operator!=(Length const &rhs) const
Definition: length.h:60
Length & operator=(Length const &)=default
@ inches
Definition: length.h:37
Units
Definition: length.h:33
Definition: splash_session.h:24
@ millimetres
Definition: length.h:35
constexpr Length(float mag, Units units)
Definition: length.h:42
Length represents a physical length in the real world. The number of pixels this equates to can then ...
Definition: length.h:30
constexpr float as(Units units) const
Definition: length.h:45
@ micrometres
Definition: length.h:34
Copyright © 2012-2021
Canonical Ltd.
Generated on Thu Jun 24 19:55:23 UTC 2021
This documentation is licensed under the GPL version 2 or 3.