HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
numbers.hpp
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>
13
14namespace hi::inline v1 {
15
18template<std::floating_point T>
19constexpr auto points_per_inch_v = T{72.0};
20
30template<std::floating_point T>
31constexpr auto dp_per_inch_v = T{80.0};
32
33template<std::floating_point T>
34constexpr auto points_to_dp_scale_v = dp_per_inch_v<T> / points_per_inch_v<T>;
35
38template<std::floating_point T>
39constexpr T points_to_dp(T x) noexcept
40{
41 return x * points_to_dp_scale_v<T>;
42}
43
46constexpr double points_per_inch = points_per_inch_v<double>;
47
50constexpr double dp_per_inch = dp_per_inch_v<double>;
51
52} // namespace hi::inline v1