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

◆ fit()

GlyphMap MayaFlux::Portal::Text::GlyphMap::fit ( Kinesis::AABB2D  region,
glm::vec2  source_px 
)
staticnoexcept

Map layout pixels [0, source_px] onto region, y flipped.

Pixel (0, 0) lands on the region's top left and source_px on its bottom right, the same placement a texture of that size gets on a quad.

Parameters
regionDestination bounds, y up.
source_pxLayout size in pixels. Components below one count as one.

Definition at line 5 of file GlyphMesh.cpp.

6{
7 const glm::vec2 source = glm::max(source_px, glm::vec2(1.F));
8 return {
9 .origin = { region.min.x, region.max.y },
10 .scale = { region.width() / source.x, -region.height() / source.y },
11 };
12}
Source source()
Begin a Source chain.
Definition Plot.hpp:127

Referenced by MayaFlux::Portal::Forma::internal::TextSlice::map().

+ Here is the caller graph for this function: