Skip to main content

Chunk

Struct Chunk 

Source
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: usize

Top-left x of the core region (without halo) in source coordinates.

§y: usize

Top-left y of the core region (without halo) in source coordinates.

§width: usize

Width of the core region (pixels, without halo columns).

§height: usize

Height of the core region (pixels, without halo rows).

§halo: usize

Halo 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

Source

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.

Source

pub fn full_width(&self) -> usize

Returns the full width of data (core width + 2 * halo).

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.