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).
Auto Trait Implementations§
impl Freeze for Chunk
impl RefUnwindSafe for Chunk
impl Send for Chunk
impl Sync for Chunk
impl Unpin for Chunk
impl UnsafeUnpin for Chunk
impl UnwindSafe for Chunk
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more