namespace
LiteralsMath literals.
Contents
- Reference
Literals for easy construction of angle and color values.
This library is built as part of Magnum by default. To use this library with CMake, you need to find the Magnum
package and link to the Magnum::Magnum
target:
find_package(Magnum REQUIRED) # ... target_link_libraries(your-app Magnum::Magnum)
See Downloading and building, Usage with CMake and Type system for more information.
Functions
- auto operator"" _deg(long double value) -> Deg<Double> constexpr
- Double-precision degree value literal.
- auto operator"" _degf(long double value) -> Deg<Float> constexpr
- Single-precision degree value literal.
- auto operator"" _rad(long double value) -> Rad<Double> constexpr
- Double-precision radian value literal.
- auto operator"" _radf(long double value) -> Rad<Float> constexpr
- Single-precision radian value literal.
- auto operator"" _rgb(unsigned long long value) -> Color3<UnsignedByte> constexpr
- 8bit-per-channel linear RGB literal
- auto operator"" _srgb(unsigned long long value) -> Vector3<UnsignedByte> constexpr
- 8bit-per-channel sRGB literal
- auto operator"" _rgba(unsigned long long value) -> Color4<UnsignedByte> constexpr
- 8bit-per-channel linear RGBA literal
- auto operator"" _srgba(unsigned long long value) -> Vector4<UnsignedByte> constexpr
- 8bit-per-channel sRGB + alpha literal
- auto operator"" _rgbf(unsigned long long value) -> Color3<Float>
- Float linear RGB literal.
- auto operator"" _srgbf(unsigned long long value) -> Color3<Float>
- Float sRGB literal.
- auto operator"" _rgbaf(unsigned long long value) -> Color4<Float>
- Float linear RGBA literal.
- auto operator"" _srgbaf(unsigned long long value) -> Color4<Float>
- Float sRGB + alpha literal.
- auto operator"" _h(long double value) -> Half
- Half-float literal.
Function documentation
Deg<Double> Magnum:: Math:: Literals:: operator"" _deg(long double value) constexpr
Double-precision degree value literal.
Example usage:
Double cosine = Math::cos(60.0_deg); // cosine = 0.5 Double cosine = Math::cos(1.047_rad); // cosine = 0.5
Deg<Float> Magnum:: Math:: Literals:: operator"" _degf(long double value) constexpr
Single-precision degree value literal.
Example usage:
Float tangent = Math::tan(60.0_degf); // tangent = 1.732f Float tangent = Math::tan(1.047_radf); // tangent = 1.732f
Rad<Double> Magnum:: Math:: Literals:: operator"" _rad(long double value) constexpr
Double-precision radian value literal.
See operator""_
Rad<Float> Magnum:: Math:: Literals:: operator"" _radf(long double value) constexpr
Single-precision radian value literal.
See operator""_
Color3<UnsignedByte> Magnum:: Math:: Literals:: operator"" _rgb(unsigned long long value) constexpr
8bit-per-channel linear RGB literal
Unpacks the literal into three 8-bit values. Example usage:
Color3ub a = 0x33b27f_rgb; // {0x33, 0xb2, 0x7f}
Vector3<UnsignedByte> Magnum:: Math:: Literals:: operator"" _srgb(unsigned long long value) constexpr
8bit-per-channel sRGB literal
Unpacks the literal into three 8-bit values without any colorspace conversion. Behaves identically to operator""_
Math::Vector3<UnsignedByte> a = 0x33b27f_srgb; // {0x33, 0xb2, 0x7f}
Color4<UnsignedByte> Magnum:: Math:: Literals:: operator"" _rgba(unsigned long long value) constexpr
8bit-per-channel linear RGBA literal
Unpacks the literal into four 8-bit values. Example usage:
Color4ub a = 0x33b27fcc_rgba; // {0x33, 0xb2, 0x7f, 0xcc}
Vector4<UnsignedByte> Magnum:: Math:: Literals:: operator"" _srgba(unsigned long long value) constexpr
8bit-per-channel sRGB + alpha literal
Unpacks the literal into four 8-bit values without any colorspace conversion. Behaves identically to operator""_
Math::Vector4<UnsignedByte> a = 0x33b27fcc_srgba; // {0x33, 0xb2, 0x7f, 0xcc}
Color3<Float> Magnum:: Math:: Literals:: operator"" _rgbf(unsigned long long value)
Float linear RGB literal.
Unpacks the 8-bit values into three floats. Example usage:
Color3 a = 0x33b27f_rgbf; // {0.2f, 0.698039f, 0.498039f}
Color3<Float> Magnum:: Math:: Literals:: operator"" _srgbf(unsigned long long value)
Float sRGB literal.
Unpacks the 8-bit values into three floats and converts the color space from sRGB to linear RGB. See Color3::
Color3 a = 0x33b27f_srgbf; // {0.0331048f, 0.445201f, 0.212231f}
Color4<Float> Magnum:: Math:: Literals:: operator"" _rgbaf(unsigned long long value)
Float linear RGBA literal.
Unpacks the 8-bit values into four floats. Example usage:
Color4 a = 0x33b27fcc_rgbaf; // {0.2f, 0.698039f, 0.498039f, 0.8f}
Color4<Float> Magnum:: Math:: Literals:: operator"" _srgbaf(unsigned long long value)
Float sRGB + alpha literal.
Unpacks the 8-bit values into four floats and converts the color space from sRGB + alpha to linear RGBA. See Color4::
Color4 a = 0x33b27fcc_srgbaf; // {0.0331048f, 0.445201f, 0.212231f, 0.8f}
Half Magnum:: Math:: Literals:: operator"" _h(long double value)
Half-float literal.
See Half for more information.