pub trait Surface {
// Required method
fn as_ptr(&self) -> NonNull<RawSurface>;
// Provided methods
fn cloned(&self) -> Cloned { ... }
fn clipped(self, area: Rect) -> Clipped<Self>
where Self: Sized { ... }
fn blend(self, mode: BlendMode) -> Blended<Self>
where Self: Sized { ... }
fn alpha_mod(self, alpha: u8) -> AlphaMod<Self>
where Self: Sized { ... }
fn color_mod(self, color: Rgb) -> ColorMod<Self>
where Self: Sized { ... }
fn fill_rect(&self, area: Option<Rect>, color: Pixel) { ... }
fn fill_rects(&self, areas: impl IntoIterator<Item = Rect>, color: Pixel) { ... }
fn set_palette(&self, palette: &Palette) { ... }
fn copy_to<S: Surface>(&self, src_area: Rect, dst: &S, dst_pos: Point) { ... }
fn rle(&mut self) -> Rle<'_, Self>
where Self: Sized { ... }
}
Expand description
A trait that provides flexible modification methods.
Required Methods§
Sourcefn as_ptr(&self) -> NonNull<RawSurface>
fn as_ptr(&self) -> NonNull<RawSurface>
Returns the raw non-null pointer.
Provided Methods§
Sourcefn blend(self, mode: BlendMode) -> Blended<Self>where
Self: Sized,
fn blend(self, mode: BlendMode) -> Blended<Self>where
Self: Sized,
Changes blend mode of the surface.
Sourcefn alpha_mod(self, alpha: u8) -> AlphaMod<Self>where
Self: Sized,
fn alpha_mod(self, alpha: u8) -> AlphaMod<Self>where
Self: Sized,
Modifies the alpha of the surface.
Sourcefn color_mod(self, color: Rgb) -> ColorMod<Self>where
Self: Sized,
fn color_mod(self, color: Rgb) -> ColorMod<Self>where
Self: Sized,
Modifies the color of the surface.
Sourcefn fill_rect(&self, area: Option<Rect>, color: Pixel)
fn fill_rect(&self, area: Option<Rect>, color: Pixel)
Fills in the area
with the color
, or whole if area
is None
.
Sourcefn fill_rects(&self, areas: impl IntoIterator<Item = Rect>, color: Pixel)
fn fill_rects(&self, areas: impl IntoIterator<Item = Rect>, color: Pixel)
Fills in the areas
with the color
.
Sourcefn set_palette(&self, palette: &Palette)
fn set_palette(&self, palette: &Palette)
Overwrites the palette of the surface.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.