pub struct GridScale(/* private fields */);Expand description
The fraction of the render target every internal grid is drawn at — the post chain’s grid and the attractor’s trail field (ADR-0245).
A validated value: only new and parse make
one, and both refuse anything outside MIN..=MAX,
NaN included. That is what makes the Eq below honest — a GridScale is
never NaN, so it equals itself.
A capacity, not a look value, in the sense the module docs use: it sets how many texels a field holds, and a grid is a resolution rather than a shape (ADR-0037), so the picture’s geometry does not move with it. What does move is sharpness, which is the trade.
Implementations§
Source§impl GridScale
impl GridScale
Sourcepub const MIN: f32 = 0.25
pub const MIN: f32 = 0.25
The smallest fraction accepted. Below a quarter a 1080p field is under
480x270 and the grid floor (grid::MIN_AXIS) starts deciding the size
instead of the scale.
Sourcepub const MAX: f32 = 1.0
pub const MAX: f32 = 1.0
The largest: the target’s own resolution. A grid is never drawn above it.
Sourcepub const FULL: Self
pub const FULL: Self
The whole target — every row of the table but Rich on an integrated adapter, and what a headless renderer resolves unless it is told otherwise.
Sourcepub fn new(value: f32) -> Option<Self>
pub fn new(value: f32) -> Option<Self>
value as a scale, or None when it is outside MIN..=MAX or not a
number.
Sourcepub fn parse(text: &str) -> Result<Self, String>
pub fn parse(text: &str) -> Result<Self, String>
Parse a scale from its written form — the flag’s value, the environment variable’s, or a settings value. The error names the accepted range, because a caller surfaces it as a usage error verbatim.
Sourcepub fn texels(self, px: u32) -> u32
pub fn texels(self, px: u32) -> u32
px target pixels, as the texels a grid at this scale asks for before it
is quantized: round(px * scale^2), saturating.
Exactly px at FULL, because 1.0 * 1.0 is exact and
every u32 is exact in f64 — so a count derived from this at scale 1.0
is the count derived from the target, byte for byte.
Trait Implementations§
Source§impl PartialOrd for GridScale
impl PartialOrd for GridScale
impl Copy for GridScale
impl Eq for GridScale
impl StructuralPartialEq for GridScale
Auto Trait Implementations§
impl Freeze for GridScale
impl RefUnwindSafe for GridScale
impl Send for GridScale
impl Sync for GridScale
impl Unpin for GridScale
impl UnsafeUnpin for GridScale
impl UnwindSafe for GridScale
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.