PixelStrictPositionInterface

Trait PixelStrictPositionInterface 

Source
pub trait PixelStrictPositionInterface<const H: usize, const W: usize> {
Show 14 methods // Required methods fn row(&self) -> usize; fn column(&self) -> usize; // Provided methods fn expand(&self) -> (usize, usize) { ... } fn unbound(&self) -> PixelPosition { ... } fn checked_up(&self, amount: usize) -> StrictPositionValidationResult<H, W> { ... } fn checked_left( &self, amount: usize, ) -> StrictPositionValidationResult<H, W> { ... } fn checked_down( &self, amount: usize, ) -> StrictPositionValidationResult<H, W> { ... } fn checked_right( &self, amount: usize, ) -> StrictPositionValidationResult<H, W> { ... } fn checked_direction( &self, dir: Direction, amount: usize, ) -> StrictPositionValidationResult<H, W> { ... } fn bounding_up(&self, amount: usize) -> PixelStrictPosition<H, W> { ... } fn bounding_left(&self, amount: usize) -> PixelStrictPosition<H, W> { ... } fn bounding_down(&self, amount: usize) -> PixelStrictPosition<H, W> { ... } fn bounding_right(&self, amount: usize) -> PixelStrictPosition<H, W> { ... } fn bounding_direction( &self, dir: Direction, amount: usize, ) -> PixelStrictPosition<H, W> { ... }
}
Expand description

Interface for a pixel position.

This type of position is limited between a H (height) and W (width).

Required Methods§

Source

fn row(&self) -> usize

Row number of the position starting from 0.

Source

fn column(&self) -> usize

Column number of the position starting from 0.

Provided Methods§

Source

fn expand(&self) -> (usize, usize)

Expand this type to a tuple of (row, column).

Source

fn unbound(&self) -> PixelPosition

Convert this PixelStrictPosition to a PixelPosition, breaking the bounds.

Source

fn checked_up(&self, amount: usize) -> StrictPositionValidationResult<H, W>

Returns a PixelStrictPosition above this one IF its possible.

Source

fn checked_left(&self, amount: usize) -> StrictPositionValidationResult<H, W>

Returns a PixelStrictPosition at the left side of this one IF its possible.

Source

fn checked_down(&self, amount: usize) -> StrictPositionValidationResult<H, W>

Returns a PixelStrictPosition below this one IF its possible.

Source

fn checked_right(&self, amount: usize) -> StrictPositionValidationResult<H, W>

Returns a PixelStrictPosition at the right side of this one IF its possible.

Source

fn checked_direction( &self, dir: Direction, amount: usize, ) -> StrictPositionValidationResult<H, W>

Returns a PixelStrictPosition at the Direction side of this one IF its possible.

Source

fn bounding_up(&self, amount: usize) -> PixelStrictPosition<H, W>

Returns a PixelStrictPosition above this one as far as possible (0).

Source

fn bounding_left(&self, amount: usize) -> PixelStrictPosition<H, W>

Returns a PixelStrictPosition at the left side of this one as far as possible (0).

Source

fn bounding_down(&self, amount: usize) -> PixelStrictPosition<H, W>

Returns a PixelStrictPosition below this one as far as possible.

Source

fn bounding_right(&self, amount: usize) -> PixelStrictPosition<H, W>

Returns a PixelStrictPosition at the right side of this one as far as possible.

Source

fn bounding_direction( &self, dir: Direction, amount: usize, ) -> PixelStrictPosition<H, W>

Returns a PixelStrictPosition at the Direction side of this one as far as possible.

Implementors§

Source§

impl<const H: usize, const W: usize> PixelStrictPositionInterface<H, W> for &PixelStrictPosition<H, W>

Source§

impl<const H: usize, const W: usize> PixelStrictPositionInterface<H, W> for &mut PixelStrictPosition<H, W>

Source§

impl<const H: usize, const W: usize> PixelStrictPositionInterface<H, W> for StrictPositions

Source§

impl<const H: usize, const W: usize> PixelStrictPositionInterface<H, W> for PixelStrictPosition<H, W>