pub struct Chunk {
pub x: usize,
pub y: usize,
pub width: usize,
pub height: usize,
pub halo: usize,
pub data: Vec<f32>,
}Expand description
A chunk of raster data extracted from a RasterSource, including surrounding
halo (ghost/overlap) cells.
The data field holds (width + 2 * halo) × (height + 2 * halo) pixels
in row-major order. Coordinate (0, 0) in data corresponds to raster
position (x.saturating_sub(halo), y.saturating_sub(halo)); pixels that
would fall outside the source raster are zero-padded.
Fields§
§x: usizeTop-left x of the core region (without halo) in source coordinates.
y: usizeTop-left y of the core region (without halo) in source coordinates.
width: usizeWidth of the core region (pixels, without halo columns).
height: usizeHeight of the core region (pixels, without halo rows).
halo: usizeHalo size on each of the four sides (in pixels).
data: Vec<f32>Row-major data of size (width + 2*halo) × (height + 2*halo).
Row 0 and row height + 2*halo - 1 are halo rows; column 0 and
column width + 2*halo - 1 are halo columns. The origin (0, 0)
maps to source position (x.saturating_sub(halo), y.saturating_sub(halo)).
Implementations§
Source§impl Chunk
impl Chunk
Sourcepub fn get_core(&self, col: usize, row: usize) -> f32
pub fn get_core(&self, col: usize, row: usize) -> f32
Returns the value at (col, row) within the core region, applying
the halo offset transparently.
col must be in 0..self.width and row in 0..self.height.
Sourcepub fn full_width(&self) -> usize
pub fn full_width(&self) -> usize
Returns the full width of data (core width + 2 * halo).
Sourcepub fn full_height(&self) -> usize
pub fn full_height(&self) -> usize
Returns the full height of data (core height + 2 * halo).