MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ row_pixel_dims()

MAYAFLUX_API glm::uvec2 MayaFlux::Portal::Forma::row_pixel_dims ( const std::shared_ptr< Core::Window > &  window,
float  x_min,
float  x_max,
float  row_h 
)

Convert an NDC row rect into integer pixel dimensions.

Clamps width to at least 1 pixel and height to at least the default atlas pixel size to avoid degenerate layouts.

Parameters
windowTarget window for pixel dimension calculation.
x_minLeft edge in NDC.
x_maxRight edge in NDC.
row_hRow height in NDC units.

Definition at line 12 of file Entry.cpp.

15{
16 const auto& ws = window->get_state();
17 const auto w = static_cast<uint32_t>(
18 (x_max - x_min) * 0.5F * static_cast<float>(ws.current_width));
19 const auto h = static_cast<uint32_t>(
20 row_h * 0.5F * static_cast<float>(ws.current_height));
21 auto atlas = Text::TypeFaceFoundry::instance().get_default_glyph_atlas();
22 if (!atlas) {
23 error<std::runtime_error>(Journal::Component::Portal, Journal::Context::Runtime,
24 std::source_location::current(),
25 "Failed to get default glyph atlas for row pixel dimension calculation");
26 }
27 const uint32_t min_h = atlas->pixel_size();
28
29 return { std::max(w, 1U), std::max(h, min_h) };
30}
uint32_t h
Definition InkPress.cpp:29
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23

References MayaFlux::Portal::Text::TypeFaceFoundry::get_default_glyph_atlas(), h, MayaFlux::Portal::Text::TypeFaceFoundry::instance(), MayaFlux::Journal::Portal, MayaFlux::Journal::Runtime, and window.

Referenced by make_entry(), MayaFlux::Portal::Forma::Collapsible::place(), and MayaFlux::Portal::Forma::Dropdown::place().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: