Surface

Trait Surface 

Source
pub trait Surface<T> {
    // Required methods
    fn surface_size(&self) -> Size;
    fn surface_get(&self, pt: Point) -> Option<&T>;

    // Provided methods
    fn sub_surface(&self, offset: Point, size: Size) -> SubSurface<&Self, T>
       where Self: Sized { ... }
    fn offset_surface(&self, offset: Point) -> SubSurface<&Self, T>
       where Self: Sized { ... }
    fn sub_surface_mut(
        &mut self,
        offset: Point,
        size: Size,
    ) -> SubSurface<&mut Self, T>
       where Self: Sized { ... }
    fn offset_surface_mut(&mut self, offset: Point) -> SubSurface<&mut Self, T>
       where Self: Sized { ... }
    fn into_sub_surface(self, offset: Point, size: Size) -> SubSurface<Self, T>
       where Self: Sized { ... }
    fn into_offset_surface(self, offset: Point) -> SubSurface<Self, T>
       where Self: Sized { ... }
}
Expand description

2D immutable surface trait.

Required Methods§

Source

fn surface_size(&self) -> Size

Surface size.

Source

fn surface_get(&self, pt: Point) -> Option<&T>

Get a value at (pt.x, pt.y).

Provided Methods§

Source

fn sub_surface(&self, offset: Point, size: Size) -> SubSurface<&Self, T>
where Self: Sized,

Create a SubSurface that only uses a rectangular part of this surface.

Source

fn offset_surface(&self, offset: Point) -> SubSurface<&Self, T>
where Self: Sized,

Create a SubSurface that only uses a rectangular part of this surface starting from (offset.x, offset.y).

Source

fn sub_surface_mut( &mut self, offset: Point, size: Size, ) -> SubSurface<&mut Self, T>
where Self: Sized,

Create a SubSurface that only uses a rectangular part of this surface.

Source

fn offset_surface_mut(&mut self, offset: Point) -> SubSurface<&mut Self, T>
where Self: Sized,

Create a SubSurface that only uses a rectangular part of this surface starting from (offset.x, offset.y).

Source

fn into_sub_surface(self, offset: Point, size: Size) -> SubSurface<Self, T>
where Self: Sized,

Create a SubSurface that only uses a rectangular part of this surface.

Source

fn into_offset_surface(self, offset: Point) -> SubSurface<Self, T>
where Self: Sized,

Create a SubSurface that only uses a rectangular part of this surface starting from (offset.x, offset.y).

Implementations on Foreign Types§

Source§

impl<S, T> Surface<T> for &S
where S: Surface<T>,

Source§

impl<S, T> Surface<T> for &mut S
where S: Surface<T>,

Implementors§

Source§

impl<S, Item> Surface<Item> for SubSurface<S, Item>
where S: Surface<Item>,

Source§

impl<Slice, Item> Surface<Item> for GenericSurface<Slice, Item>
where Slice: AsRef<[Item]>,

Source§

impl<T> Surface<T> for SingleValueSurface<T>