Comment units functions

This commit is contained in:
patrick96 2022-03-14 22:45:48 +01:00 committed by Patrick Ziegler
parent 11a644548b
commit 705845e5d3

View File

@ -45,6 +45,9 @@ namespace units_utils {
return static_cast<int>(math_util::percentage_to_value<double, double>(g_format.percentage, max) + offset_pixel);
}
/**
* Same as percentage_with_offset_to_pixel but capped below at 0 pixels
*/
unsigned percentage_with_offset_to_pixel_nonnegative(percentage_with_offset g_format, double max, double dpi) {
return std::max<int>(0, percentage_with_offset_to_pixel(g_format, max, dpi));
}
@ -135,6 +138,11 @@ namespace units_utils {
return {type, size_value};
}
/**
* Creates an extent from a spacing value.
*
* @param spacing Value to convert, must not be SPACE
*/
extent_val spacing_to_extent(spacing_val spacing) {
extent_type t;