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§
Sourcefn surface_size(&self) -> Size
fn surface_size(&self) -> Size
Surface size.
Sourcefn surface_get(&self, pt: Point) -> Option<&T>
fn surface_get(&self, pt: Point) -> Option<&T>
Get a value at (pt.x, pt.y).
Provided Methods§
Sourcefn sub_surface(&self, offset: Point, size: Size) -> SubSurface<&Self, T>where
Self: Sized,
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.
Sourcefn offset_surface(&self, offset: Point) -> SubSurface<&Self, T>where
Self: Sized,
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).
Sourcefn sub_surface_mut(
&mut self,
offset: Point,
size: Size,
) -> SubSurface<&mut Self, T>where
Self: Sized,
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.
Sourcefn offset_surface_mut(&mut self, offset: Point) -> SubSurface<&mut Self, T>where
Self: Sized,
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).
Sourcefn into_sub_surface(self, offset: Point, size: Size) -> SubSurface<Self, T>where
Self: Sized,
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.
Sourcefn into_offset_surface(self, offset: Point) -> SubSurface<Self, T>where
Self: Sized,
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).