Trait ImageCoordinate

Source
pub trait ImageCoordinate {
    // Required methods
    fn image_coordinate(&self) -> Option<(u32, u32)>;
    fn image_coordinate_clamped(&self, right: u32, bottom: u32) -> (u32, u32);
}
Expand description

Trait for types that can represent image coordinates

Required Methods§

Source

fn image_coordinate(&self) -> Option<(u32, u32)>

Return the (x, y) pixel indices, or None if the coordinate is invalid.

Source

fn image_coordinate_clamped(&self, right: u32, bottom: u32) -> (u32, u32)

Return clamped (x, y) pixel indices within the given bounds. Bounds are (0, 0) and (right, bottom).

Implementations on Foreign Types§

Source§

impl<T: ImageAxisIndex + Clone> ImageCoordinate for &[T; 2]

Source§

fn image_coordinate(&self) -> Option<(u32, u32)>

Source§

fn image_coordinate_clamped(&self, right: u32, bottom: u32) -> (u32, u32)

Source§

impl<T: ImageAxisIndex + Copy> ImageCoordinate for [T; 2]

Source§

fn image_coordinate(&self) -> Option<(u32, u32)>

Source§

fn image_coordinate_clamped(&self, right: u32, bottom: u32) -> (u32, u32)

Source§

impl<T: ImageAxisIndex + Copy> ImageCoordinate for (T, T)

Source§

fn image_coordinate(&self) -> Option<(u32, u32)>

Source§

fn image_coordinate_clamped(&self, right: u32, bottom: u32) -> (u32, u32)

Implementors§