pub struct Surface<'s, S: AsRef<[P]> + AsMut<[P]>, P: Copy + Clone + Sized + Default> { /* private fields */ }Expand description
A Surface is a pixel buffer, a size, and some underlying data describing how to blit it to a given destination Surface.
§Type aliases
There are type aliases for surface of common buffer and pixel types. Consider using them!
use blittle::{Rgba8Surface, Size};
let _ = Rgba8Surface::new(Size::new(512, 512));Sometimes, you will need to use a buffer that isn’t a vec or is an uncommon pixel type. In those cases, see below:
§Generics
A Surface has a lifetime and two generics: Surface<'s, S, P>.
- The lifetime is only relevant if the buffer is a reference, e.g.
&mut [[u8; 3]] Sis the type of underlying pixel buffer. This could be, for example, a vec, or a mutable slice.Pis the type of pixel.Smust be a buffer with elements of typeP.
So, Rgba8Surface is a type alias for: Surface<'s, Vec<[u8; 4]>, [u8; 4]>
use blittle::{Size, Surface};
let _ = Surface::<'_, Vec<[u8; 4]>, [u8; 4]>::new(Size::new(512, 512));Implementations§
Source§impl<'s> Surface<'s, &'s mut [Zrgb], Zrgb>
impl<'s> Surface<'s, &'s mut [Zrgb], Zrgb>
Sourcepub fn from_softbuffer<D: HasDisplayHandle, W: HasWindowHandle>(
buffer: &'s mut Buffer<'_, D, W>,
) -> Self
Available on crate feature softbuffer only.
pub fn from_softbuffer<D: HasDisplayHandle, W: HasWindowHandle>( buffer: &'s mut Buffer<'_, D, W>, ) -> Self
softbuffer only.Convert a softbuffer Buffer to a surface.
The underlying pixel buffer is a mutable reference to buffer.
Source§impl<'s, S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> Surface<'s, S, Zrgb>
impl<'s, S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> Surface<'s, S, Zrgb>
Sourcepub fn blit_to_softbuffer<D: HasDisplayHandle, W: HasWindowHandle>(
&self,
buffer: &'s mut Buffer<'_, D, W>,
) -> Result<(), Error>
Available on crate feature softbuffer only.
pub fn blit_to_softbuffer<D: HasDisplayHandle, W: HasWindowHandle>( &self, buffer: &'s mut Buffer<'_, D, W>, ) -> Result<(), Error>
softbuffer only.Blit to a softbuffer Buffer.
Source§impl<P: Copy + Clone + Sized + Default> Surface<'_, Vec<P>, P>
impl<P: Copy + Clone + Sized + Default> Surface<'_, Vec<P>, P>
Sourcepub fn new(size: Size) -> Self
Available on crate feature std only.
pub fn new(size: Size) -> Self
std only.Get a new surface.
The position defaults to (0, 0).
The underlying pixel buffer is set to the pixel’s default value (i.e. [0, 0, 0]), length size.width * size.height.
Sourcepub fn new_filled(size: Size, color: P) -> Self
Available on crate feature std only.
pub fn new_filled(size: Size, color: P) -> Self
std only.Get a new surface with color color.
The position defaults to (0, 0).
The underlying pixel buffer is set to vec![color; size.width * size.height].
Source§impl<'s, P: Copy + Clone + Sized + Default> Surface<'s, &'s mut [P], P>
impl<'s, P: Copy + Clone + Sized + Default> Surface<'s, &'s mut [P], P>
Sourcepub fn new(size: Size, buffer: &'s mut [P]) -> Result<Self, Error>
pub fn new(size: Size, buffer: &'s mut [P]) -> Result<Self, Error>
Get a new surface from a mutable slice.
The position defaults to (0, 0).
The underlying pixel buffer is set to the pixel’s default value (i.e. [0, 0, 0]), length size.width * size.height.
Returns an error if size.width * size.height != buffer.len()
Source§impl<S: AsRef<[P]> + AsMut<[P]>, P: Copy + Clone + Sized + Default> Surface<'_, S, P>
impl<S: AsRef<[P]> + AsMut<[P]>, P: Copy + Clone + Sized + Default> Surface<'_, S, P>
Sourcepub fn blit<B: AsRef<[P]> + AsMut<[P]>>(
&self,
other: &mut Surface<'_, B, P>,
) -> Result<(), Error>
pub fn blit<B: AsRef<[P]> + AsMut<[P]>>( &self, other: &mut Surface<'_, B, P>, ) -> Result<(), Error>
Blit onto other.
There are three constraints for blitting to other.
-
othermust have the same pixel type asself. For example, you can’t blit anRgba8Surfaceonto anL8Surface. However,othercan have a different buffer type. For example, you can blitSurface<'_, Vec<u8>, u8>ontoSurface<'s, &'s mut[u8], u8> -
You must call Self::set_position before blitting. This is because Self::set_position not only sets the position, but also defines the region in which pixels in
srcactually overlap withdst. If you have called Self::set_position for one destination, and you are blitting to a different destination, you must call Self::set_position again. -
Having called Self::set_position, some pixels of
srcmust overlap withdst.
For example, this returns an error:
use blittle::*;
let mut src = Rgb8Surface::new(Size::new(512, 512));
let mut dst = Rgb8Surface::new(Size::new(1920, 1080));
// This works. Some, or all, of src is within dst.
src.set_position(PositionI::new(100, 100), &dst).unwrap();
src.blit(&mut dst).unwrap();
// Set a new destination.
let mut dst = Rgb8Surface::new(Size::new(64, 64));
// The position of `src` is obsolete, and is out of bounds.
assert!(src.blit(&mut dst).is_err());Sourcepub const fn set_position<B: AsRef<[P]> + AsMut<[P]>>(
&mut self,
position: PositionI,
destination: &Surface<'_, B, P>,
) -> Result<RectU, Error>
pub const fn set_position<B: AsRef<[P]> + AsMut<[P]>>( &mut self, position: PositionI, destination: &Surface<'_, B, P>, ) -> Result<RectU, Error>
Set the top-left position of the surface, relative to the surface it will blit to destination.
destination must be of the same pixel type and can be of a different buffer type.
For example, if self is of type Surface<'_, Vec<[u8; 4]>, [u8; 4]>>:
selfcan set its position relative to aSurface<'s, &'s mut [u8], [u8; 4]>>selfcan’t set its position relative to aSurface<'_, Vec<[u8; 3]>, [u8; 3]>>
This will also set the region of pixels of self.buffer that otherlap with destination.buffer.
Returns an error if the clipped blitting area is not within destination.
Sourcepub const fn get_position(&self) -> Option<PositionU>
pub const fn get_position(&self) -> Option<PositionU>
Returns the top-left position of self relative to a destination surface,
or None if Self::set_position hasn’t been called.
Sourcepub const fn set_area(
&mut self,
area: Option<RectI>,
) -> Result<Option<RectU>, Error>
pub const fn set_area( &mut self, area: Option<RectI>, ) -> Result<Option<RectU>, Error>
Set an area within the pixel buffer to blit.
You must call Self::set_position before calling this.
If area is None, then the entirety of this surface will blit (this is the default behavior).
If area is out of bounds of self’s underlying buffer, this will return an error.
Otherwise, this returns a RectU describing the clipped area
(i.e. which pixels within the area overlap with dst).
use blittle::*;
let mut src = Rgb8Surface::new(Size::new(512, 512));
let dst = Rgb8Surface::new(Size::new(1920, 1080));
// Set the position.
src.set_position(PositionI::new(0, 0), &dst).unwrap();
// Blit only the pixels in this region.
src.set_area(Some(RectI { position: PositionI::new(1, 3), size: Size::new(60, 80)})).unwrap();
// Reset the area. Now, all pixels will blit.
src.set_area(None).unwrap();
// Invalid area.
assert!(src.set_area(Some(RectI { position: PositionI::new(-2000, -2000), size: Size::new(60, 80)})).is_err());Sourcepub fn rows(&self) -> impl Iterator<Item = &[P]>
pub fn rows(&self) -> impl Iterator<Item = &[P]>
Iterate through the pixel buffer per-row, top to bottom.
Sourcepub fn rows_mut(&mut self) -> impl Iterator<Item = &mut [P]>
pub fn rows_mut(&mut self) -> impl Iterator<Item = &mut [P]>
Iterate through the pixel buffer per-row, top to bottom.
Sourcepub fn get_pixel_checked(&self, position: PositionU) -> Result<P, Error>
pub fn get_pixel_checked(&self, position: PositionU) -> Result<P, Error>
Returns the color of the pixel at position.
Returns an error if position is out of bounds.
use blittle::*;
let src = Rgb8Surface::new(Size::new(64, 64));
// Get the pixel at this position.
let _ = src.get_pixel_checked(PositionU::new(3, 15));
// This position is out of bounds.
assert!(src.get_pixel_checked(PositionU::new(102, 15)).is_err());Sourcepub fn get_pixel_unchecked(&self, position: PositionU) -> P
pub fn get_pixel_unchecked(&self, position: PositionU) -> P
Returns the color of the pixel at position.
use blittle::*;
let src = Rgb8Surface::new(Size::new(64, 64));
let _ = src.get_pixel_unchecked(PositionU::new(3, 15));Sourcepub fn set_pixel_checked(
&mut self,
position: PositionU,
color: P,
) -> Result<(), Error>
pub fn set_pixel_checked( &mut self, position: PositionU, color: P, ) -> Result<(), Error>
Set the color of the pixel at position.
Returns an error if position is out of bounds.
use blittle::*;
let mut src = Rgb8Surface::new(Size::new(64, 64));
// Set the pixel at this position.
src.set_pixel_checked(PositionU::new(3, 15), [50, 0, 220]).unwrap();
// This pixel is out of bounds.
assert!(src.set_pixel_checked(PositionU::new(120, 15), [50, 0, 220]).is_err());Sourcepub fn set_pixel_unchecked(&mut self, position: PositionU, color: P)
pub fn set_pixel_unchecked(&mut self, position: PositionU, color: P)
Set the color of the pixel at position.
use blittle::*;
let mut src = Rgb8Surface::new(Size::new(64, 64));
src.set_pixel_unchecked(PositionU::new(3, 15), [50, 0, 220]);Sourcepub const fn get_index(&self, x: usize, y: usize) -> usize
pub const fn get_index(&self, x: usize, y: usize) -> usize
Convert (x, y) coordinates into an index value within the underlying pixel buffer.
Sourcepub const fn reset(&mut self)
pub const fn reset(&mut self)
Unset all internal data related to blitting to the destination surface.
This function can be a useful safeguard when blitting to multiple surfaces.
Sourcepub fn buffer_mut(&mut self) -> &mut [P]
pub fn buffer_mut(&mut self) -> &mut [P]
Returns the underlying mutable pixel buffer.
Trait Implementations§
Source§impl<'s, S: Clone + AsRef<[P]> + AsMut<[P]>, P: Clone + Copy + Clone + Sized + Default> Clone for Surface<'s, S, P>
impl<'s, S: Clone + AsRef<[P]> + AsMut<[P]>, P: Clone + Copy + Clone + Sized + Default> Clone for Surface<'s, S, P>
Source§impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
Available on crate feature std only.
impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
std only.Source§impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
Available on crate feature std only.
impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
std only.Source§impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
Available on crate feature std only.
impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
std only.Source§impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
Available on crate feature std only.
impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
std only.Source§impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<Zrgb>, Zrgb>
Available on crate features std and softbuffer only.
impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<Zrgb>, Zrgb>
std and softbuffer only.Source§impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<f32>, f32>
Available on crate feature std only.
impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<f32>, f32>
std only.Source§impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<u8>, u8>
Available on crate feature std only.
impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> From<&Surface<'_, S, [f32; 2]>> for Surface<'_, Vec<u8>, u8>
std only.Source§impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
Available on crate feature std only.
impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
std only.Source§impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
Available on crate feature std only.
impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
std only.Source§impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
Available on crate feature std only.
impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
std only.Source§impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
Available on crate feature std only.
impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
std only.Source§impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<Zrgb>, Zrgb>
Available on crate features std and softbuffer only.
impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<Zrgb>, Zrgb>
std and softbuffer only.Source§impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<f32>, f32>
Available on crate feature std only.
impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<f32>, f32>
std only.Source§impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<u8>, u8>
Available on crate feature std only.
impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> From<&Surface<'_, S, [f32; 4]>> for Surface<'_, Vec<u8>, u8>
std only.Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
std only.Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
std only.Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
std only.Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
std only.Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<Zrgb>, Zrgb>
Available on crate features std and softbuffer only.
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<Zrgb>, Zrgb>
std and softbuffer only.Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<f32>, f32>
Available on crate feature std only.
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<f32>, f32>
std only.Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<u8>, u8>
Available on crate feature std only.
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> From<&Surface<'_, S, [u8; 2]>> for Surface<'_, Vec<u8>, u8>
std only.Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
std only.Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
std only.Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
std only.Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
std only.Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<Zrgb>, Zrgb>
Available on crate features std and softbuffer only.
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<Zrgb>, Zrgb>
std and softbuffer only.Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<f32>, f32>
Available on crate feature std only.
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<f32>, f32>
std only.Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<u8>, u8>
Available on crate feature std only.
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> From<&Surface<'_, S, [u8; 3]>> for Surface<'_, Vec<u8>, u8>
std only.Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
std only.Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
std only.Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
std only.Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
Available on crate feature std only.
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
std only.Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<Zrgb>, Zrgb>
Available on crate features std and softbuffer only.
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<Zrgb>, Zrgb>
std and softbuffer only.Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<f32>, f32>
Available on crate feature std only.
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<f32>, f32>
std only.Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<u8>, u8>
Available on crate feature std only.
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> From<&Surface<'_, S, [u8; 4]>> for Surface<'_, Vec<u8>, u8>
std only.Source§impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
Available on crate features std and softbuffer only.
impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
std and softbuffer only.Source§impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
Available on crate features std and softbuffer only.
impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
std and softbuffer only.Source§impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
Available on crate features std and softbuffer only.
impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
std and softbuffer only.Source§impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
Available on crate features std and softbuffer only.
impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
std and softbuffer only.Source§impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<f32>, f32>
Available on crate features std and softbuffer only.
impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<f32>, f32>
std and softbuffer only.Source§impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<u8>, u8>
Available on crate features std and softbuffer only.
impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> From<&Surface<'_, S, Zrgb>> for Surface<'_, Vec<u8>, u8>
std and softbuffer only.Source§impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
Available on crate feature std only.
impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
std only.Source§impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
Available on crate feature std only.
impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
std only.Source§impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
Available on crate feature std only.
impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
std only.Source§impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
Available on crate feature std only.
impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
std only.Source§impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
Available on crate feature std only.
impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
std only.Source§impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<Zrgb>, Zrgb>
Available on crate features std and softbuffer only.
impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<Zrgb>, Zrgb>
std and softbuffer only.Source§impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<u8>, u8>
Available on crate feature std only.
impl<S: AsRef<[f32]> + AsMut<[f32]>> From<&Surface<'_, S, f32>> for Surface<'_, Vec<u8>, u8>
std only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
Available on crate feature std only.
impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[f32; 2]>, [f32; 2]>
std only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
Available on crate feature std only.
impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[f32; 4]>, [f32; 4]>
std only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
Available on crate feature std only.
impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[u8; 2]>, [u8; 2]>
std only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
Available on crate feature std only.
impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[u8; 3]>, [u8; 3]>
std only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
Available on crate feature std only.
impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<[u8; 4]>, [u8; 4]>
std only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<Zrgb>, Zrgb>
Available on crate features std and softbuffer only.
impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<Zrgb>, Zrgb>
std and softbuffer only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<f32>, f32>
Available on crate feature std only.
impl<S: AsRef<[u8]> + AsMut<[u8]>> From<&Surface<'_, S, u8>> for Surface<'_, Vec<f32>, f32>
std only.Source§impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> PixelConverter<[f32; 2]> for Surface<'_, S, [f32; 2]>
impl<S: AsRef<[[f32; 2]]> + AsMut<[[f32; 2]]>> PixelConverter<[f32; 2]> for Surface<'_, S, [f32; 2]>
fn pixel_to_l8(pixel: &[f32; 2]) -> u8
fn pixel_to_la8(pixel: &[f32; 2]) -> [u8; 2]
fn pixel_to_l32(pixel: &[f32; 2]) -> f32
fn pixel_to_la32(pixel: &[f32; 2]) -> [f32; 2]
fn pixel_to_rgb8(pixel: &[f32; 2]) -> [u8; 3]
fn pixel_to_rgba8(pixel: &[f32; 2]) -> [u8; 4]
fn pixel_to_rgba32(pixel: &[f32; 2]) -> [f32; 4]
Source§impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> PixelConverter<[f32; 4]> for Surface<'_, S, [f32; 4]>
impl<S: AsRef<[[f32; 4]]> + AsMut<[[f32; 4]]>> PixelConverter<[f32; 4]> for Surface<'_, S, [f32; 4]>
fn pixel_to_l8(pixel: &[f32; 4]) -> u8
fn pixel_to_la8(pixel: &[f32; 4]) -> [u8; 2]
fn pixel_to_l32(pixel: &[f32; 4]) -> f32
fn pixel_to_la32(pixel: &[f32; 4]) -> [f32; 2]
fn pixel_to_rgb8(pixel: &[f32; 4]) -> [u8; 3]
fn pixel_to_rgba8(pixel: &[f32; 4]) -> [u8; 4]
fn pixel_to_rgba32(pixel: &[f32; 4]) -> [f32; 4]
Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> PixelConverter<[u8; 2]> for Surface<'_, S, [u8; 2]>
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> PixelConverter<[u8; 2]> for Surface<'_, S, [u8; 2]>
fn pixel_to_l8(pixel: &[u8; 2]) -> u8
fn pixel_to_la8(pixel: &[u8; 2]) -> [u8; 2]
fn pixel_to_l32(pixel: &[u8; 2]) -> f32
fn pixel_to_la32(pixel: &[u8; 2]) -> [f32; 2]
fn pixel_to_rgb8(pixel: &[u8; 2]) -> [u8; 3]
fn pixel_to_rgba8(pixel: &[u8; 2]) -> [u8; 4]
fn pixel_to_rgba32(pixel: &[u8; 2]) -> [f32; 4]
Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> PixelConverter<[u8; 3]> for Surface<'_, S, [u8; 3]>
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> PixelConverter<[u8; 3]> for Surface<'_, S, [u8; 3]>
fn pixel_to_l8(pixel: &[u8; 3]) -> u8
fn pixel_to_la8(pixel: &[u8; 3]) -> [u8; 2]
fn pixel_to_l32(pixel: &[u8; 3]) -> f32
fn pixel_to_la32(pixel: &[u8; 3]) -> [f32; 2]
fn pixel_to_rgb8(pixel: &[u8; 3]) -> [u8; 3]
fn pixel_to_rgba8(pixel: &[u8; 3]) -> [u8; 4]
fn pixel_to_rgba32(pixel: &[u8; 3]) -> [f32; 4]
Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> PixelConverter<[u8; 4]> for Surface<'_, S, [u8; 4]>
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> PixelConverter<[u8; 4]> for Surface<'_, S, [u8; 4]>
fn pixel_to_l8(pixel: &[u8; 4]) -> u8
fn pixel_to_la8(pixel: &[u8; 4]) -> [u8; 2]
fn pixel_to_l32(pixel: &[u8; 4]) -> f32
fn pixel_to_la32(pixel: &[u8; 4]) -> [f32; 2]
fn pixel_to_rgb8(pixel: &[u8; 4]) -> [u8; 3]
fn pixel_to_rgba8(pixel: &[u8; 4]) -> [u8; 4]
fn pixel_to_rgba32(pixel: &[u8; 4]) -> [f32; 4]
Source§impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> PixelConverter<Zrgb> for Surface<'_, S, Zrgb>
Available on crate feature softbuffer only.
impl<S: AsRef<[Zrgb]> + AsMut<[Zrgb]>> PixelConverter<Zrgb> for Surface<'_, S, Zrgb>
softbuffer only.fn pixel_to_l8(pixel: &Zrgb) -> u8
fn pixel_to_la8(pixel: &Zrgb) -> [u8; 2]
fn pixel_to_l32(pixel: &Zrgb) -> f32
fn pixel_to_la32(pixel: &Zrgb) -> [f32; 2]
fn pixel_to_rgb8(pixel: &Zrgb) -> [u8; 3]
fn pixel_to_rgba8(pixel: &Zrgb) -> [u8; 4]
fn pixel_to_rgba32(pixel: &Zrgb) -> [f32; 4]
fn pixel_to_zrgb(pixel: &Zrgb) -> Zrgb
Source§impl<S: AsRef<[f32]> + AsMut<[f32]>> PixelConverter<f32> for Surface<'_, S, f32>
impl<S: AsRef<[f32]> + AsMut<[f32]>> PixelConverter<f32> for Surface<'_, S, f32>
fn pixel_to_l8(pixel: &f32) -> u8
fn pixel_to_la8(pixel: &f32) -> [u8; 2]
fn pixel_to_l32(pixel: &f32) -> f32
fn pixel_to_la32(pixel: &f32) -> [f32; 2]
fn pixel_to_rgb8(pixel: &f32) -> [u8; 3]
fn pixel_to_rgba8(pixel: &f32) -> [u8; 4]
fn pixel_to_rgba32(pixel: &f32) -> [f32; 4]
Source§fn pixel_to_zrgb(pixel: &f32) -> Zrgb
fn pixel_to_zrgb(pixel: &f32) -> Zrgb
softbuffer only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> PixelConverter<u8> for Surface<'_, S, u8>
impl<S: AsRef<[u8]> + AsMut<[u8]>> PixelConverter<u8> for Surface<'_, S, u8>
fn pixel_to_l8(pixel: &u8) -> u8
fn pixel_to_la8(pixel: &u8) -> [u8; 2]
fn pixel_to_l32(pixel: &u8) -> f32
fn pixel_to_la32(pixel: &u8) -> [f32; 2]
fn pixel_to_rgb8(pixel: &u8) -> [u8; 3]
fn pixel_to_rgba8(pixel: &u8) -> [u8; 4]
fn pixel_to_rgba32(pixel: &u8) -> [f32; 4]
Source§fn pixel_to_zrgb(pixel: &u8) -> Zrgb
fn pixel_to_zrgb(pixel: &u8) -> Zrgb
softbuffer only.Source§impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> Png<S, [u8; 2]> for Surface<'_, S, [u8; 2]>
Available on crate feature png only.
impl<S: AsRef<[[u8; 2]]> + AsMut<[[u8; 2]]>> Png<S, [u8; 2]> for Surface<'_, S, [u8; 2]>
png only.Source§impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> Png<S, [u8; 3]> for Surface<'_, S, [u8; 3]>
Available on crate feature png only.
impl<S: AsRef<[[u8; 3]]> + AsMut<[[u8; 3]]>> Png<S, [u8; 3]> for Surface<'_, S, [u8; 3]>
png only.Source§impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> Png<S, [u8; 4]> for Surface<'_, S, [u8; 4]>
Available on crate feature png only.
impl<S: AsRef<[[u8; 4]]> + AsMut<[[u8; 4]]>> Png<S, [u8; 4]> for Surface<'_, S, [u8; 4]>
png only.Source§impl<S: AsRef<[u8]> + AsMut<[u8]>> Png<S, u8> for Surface<'_, S, u8>
Available on crate feature png only.
impl<S: AsRef<[u8]> + AsMut<[u8]>> Png<S, u8> for Surface<'_, S, u8>
png only.Auto Trait Implementations§
impl<'s, S, P> Freeze for Surface<'s, S, P>where
S: Freeze,
impl<'s, S, P> RefUnwindSafe for Surface<'s, S, P>where
S: RefUnwindSafe,
P: RefUnwindSafe,
impl<'s, S, P> Send for Surface<'s, S, P>
impl<'s, S, P> Sync for Surface<'s, S, P>
impl<'s, S, P> Unpin for Surface<'s, S, P>where
S: Unpin,
impl<'s, S, P> UnsafeUnpin for Surface<'s, S, P>where
S: UnsafeUnpin,
impl<'s, S, P> UnwindSafe for Surface<'s, S, P>where
S: UnwindSafe,
P: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.