HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
numbers.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
10#pragma once
11
12#include "concepts.hpp"
13#include <concepts>
14
15namespace hi::inline v1 {
16
21template<typename T> requires (std::numeric_limits<T>::max() >= 16777215)
22constexpr auto large_number_v = T{16777215};
23
26template<std::floating_point T>
27constexpr auto points_per_inch_v = T{72.0};
28
38template<std::floating_point T>
39constexpr auto dp_per_inch_v = T{80.0};
40
41template<std::floating_point T>
42constexpr auto points_to_dp_scale_v = dp_per_inch_v<T> / points_per_inch_v<T>;
43
46template<std::floating_point T>
47constexpr T points_to_dp(T x) noexcept
48{
49 return x * points_to_dp_scale_v<T>;
50}
51
54constexpr double points_per_inch = points_per_inch_v<double>;
55
58constexpr double dp_per_inch = dp_per_inch_v<double>;
59
60} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:15
constexpr auto points_per_inch_v
The number of points (typography) per inch.
Definition numbers.hpp:27
constexpr auto dp_per_inch_v
The number of device independent pixels per inch.
Definition numbers.hpp:39
constexpr double points_per_inch
Definition numbers.hpp:54
constexpr double dp_per_inch
Definition numbers.hpp:58
constexpr T points_to_dp(T x) noexcept
Convert points to device independent pixels.
Definition numbers.hpp:47
T max(T... args)