pub struct Region {
pub origin: [u32; 2],
pub size: [u32; 2],
pub scale: Scale,
}Expand description
A physical-pixel rectangle carrying its own logical→physical Scale. Construct with a
struct literal so the two [u32; 2] fields are named at the call site (no positional
origin/size swap is possible).
Fields§
§origin: [u32; 2]Top-left corner in physical pixels.
size: [u32; 2]Width and height in physical pixels.
scale: ScaleThis region’s logical→physical scale.
Implementations§
Source§impl Region
impl Region
Sourcepub fn clip_to(&self, source_extent: [u32; 2]) -> Option<Region>
pub fn clip_to(&self, source_extent: [u32; 2]) -> Option<Region>
Clip this region to a source texture of size source_extent, returning the in-bounds
intersection (its scale preserved).
Returns None when the intersection is empty — i.e. the region is zero-area or lies
fully outside the texture. That None is the blur no-op: prepare returns
Ok(None) and record is never called (DESIGN §4.4/§4.5). A partially offscreen
region is clipped to the in-bounds sub-rect rather than dropped, so the backend never
samples outside the source (the “Region clipping” core operation, DESIGN §11). All
arithmetic saturates, so an origin + size past u32::MAX cannot overflow.