Expand description
A PNG image. Currently only supports RGB and RGBA color types
Fields
width: usize
The width of the image
height: usize
The height of the image
data: Vec<u8>
The data in the image, stored in chunks of 4 per pixel, containing the image in RGBA order
Implementations
sourceimpl PngImage
impl PngImage
sourcepub fn load_from_path<R: Read>(r: R) -> Result<Self, DecodingError>
pub fn load_from_path<R: Read>(r: R) -> Result<Self, DecodingError>
Load an image from a specified source.
sourcepub fn load_from_path_transform<R: Read, F: Fn(Color) -> Color>(
r: R,
transform: F
) -> Result<Self, DecodingError>
pub fn load_from_path_transform<R: Read, F: Fn(Color) -> Color>(
r: R,
transform: F
) -> Result<Self, DecodingError>
Load an image and apply a function to each pixel. Mostly used by LatexObj
to fix alpha
Trait Implementations
sourceimpl Drawable for PngImage
impl Drawable for PngImage
sourcefn content_mut(&mut self) -> Vec<&mut dyn Drawable>
fn content_mut(&mut self) -> Vec<&mut dyn Drawable>
What this object contains, mutably
sourcefn draw(
&self,
canvas: &mut Canvas<Window>,
pos: &Position,
_settings: DrawSettings
)
fn draw(
&self,
canvas: &mut Canvas<Window>,
pos: &Position,
_settings: DrawSettings
)
Draw everything
sourcefn step(&mut self)
fn step(&mut self)
When the user presses space, the state of the presentation is advanced. This
method is what is called. Read more
sourceimpl ImageContainer for PngImage
impl ImageContainer for PngImage
sourcefn get_data_mut(&mut self) -> &mut Vec<u8>
fn get_data_mut(&mut self) -> &mut Vec<u8>
Retrieve the data in the image, mutably
sourcefn as_knownsize(&self) -> &dyn KnownSize
fn as_knownsize(&self) -> &dyn KnownSize
Convert the object to a dynamic KnownSize object, as rust doesn’t support calling KnownSize
-methods directly on this object Read more
Auto Trait Implementations
impl RefUnwindSafe for PngImage
impl Send for PngImage
impl Sync for PngImage
impl Unpin for PngImage
impl UnwindSafe for PngImage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more