pub struct LmpImage { /* private fields */ }
Expand description
Quake 1 style LMP image. Does not store color values, only stores
indices into a color palette. (see quake_files::palette::Palette
)
Implementations§
Source§impl LmpImage
impl LmpImage
Sourcepub fn read<R>(reader: &mut R) -> QResult<LmpImage>where
R: Read,
pub fn read<R>(reader: &mut R) -> QResult<LmpImage>where
R: Read,
Opens the LMP image at the supplied Read
instance.
Sourcepub fn write<W>(&self, writer: &mut W) -> QResult<()>where
W: Write,
pub fn write<W>(&self, writer: &mut W) -> QResult<()>where
W: Write,
Writes the image to the supplied Write
instance.
Sourcepub fn from_image(image: &DynamicImage, palette: &Palette) -> QResult<LmpImage>
pub fn from_image(image: &DynamicImage, palette: &Palette) -> QResult<LmpImage>
Creates a LMP image from a palette and some image. Returns an error if any of the image’s colors are not in the palette.
Sourcepub fn save_as<P>(&self, path: P, palette: Palette) -> QResult<()>
pub fn save_as<P>(&self, path: P, palette: Palette) -> QResult<()>
Saves the image to a file. See image::ImageBuffer#save
for supported image formats.
pub fn get(&self, x: u32, y: u32) -> u8
Sourcepub fn get_color(&self, x: u32, y: u32, palette: &Palette) -> Color
pub fn get_color(&self, x: u32, y: u32, palette: &Palette) -> Color
Uses the given palette to translate an index in this image to a color.
pub fn width(&self) -> u32
pub fn height(&self) -> u32
pub fn pixels(&self) -> &[u8] ⓘ
Auto Trait Implementations§
impl Freeze for LmpImage
impl RefUnwindSafe for LmpImage
impl Send for LmpImage
impl Sync for LmpImage
impl Unpin for LmpImage
impl UnwindSafe for LmpImage
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more