pub struct RawTga<'a> { /* private fields */ }
Expand description
Raw TGA image.
RawTga
can be used to access lower level information about a TGA file and to access the
raw pixel data. It can be created directly by using the from_slice
constructor or accessed
by calling as_raw
method of a Tga
object.
Implementations§
Source§impl<'a> RawTga<'a>
impl<'a> RawTga<'a>
Sourcepub fn from_slice(data: &'a [u8]) -> Result<Self, ParseError>
pub fn from_slice(data: &'a [u8]) -> Result<Self, ParseError>
Parse a TGA image from a byte slice.
Sourcepub fn color_map(&self) -> Option<&ColorMap<'a>>
pub fn color_map(&self) -> Option<&ColorMap<'a>>
Returns the color map.
None
is returned if the image contains no color map.
Sourcepub fn color_bpp(&self) -> Bpp
pub fn color_bpp(&self) -> Bpp
Returns the color bit depth (BPP) of this image.
This function always returns the bit depth of the decoded pixels, regardless of how they are
stored in the TGA file. Use image_data_bpp
to get the number of bits used to store one
pixel in the image data.
Sourcepub fn image_origin(&self) -> ImageOrigin
pub fn image_origin(&self) -> ImageOrigin
Returns the image origin.
Sourcepub fn compression(&self) -> Compression
pub fn compression(&self) -> Compression
Returns the compression type.
Sourcepub fn image_data(&self) -> &'a [u8]
pub fn image_data(&self) -> &'a [u8]
Returns the raw image data contained in this image.
Sourcepub fn image_data_bpp(&self) -> Bpp
pub fn image_data_bpp(&self) -> Bpp
Returns the size of a single pixel in bits.
This function returns the number of bits used to store a single pixel in the image data.
For true color and grayscale images, where the colors are stored directly in the image data,
the returned value will match the value returned by color_bpp
.
For color mapped images, where the image data consists of color indices, the returned value
describes the bit depth of the indices and may differ from the depth returned by
color_bpp
.
Sourcepub fn header(&self) -> TgaHeader
pub fn header(&self) -> TgaHeader
Returns the TGA header.
The returned object is a direct representation of the header contained in the TGA file. Most of the information contained in the header is also available using other methods, which are the preferred way of accessing them.
§Performance
To save memory the header is parsed every time this method is called.
Sourcepub fn developer_directory(&self) -> Option<&'a [u8]>
pub fn developer_directory(&self) -> Option<&'a [u8]>
Returns the developer directory.
§Performance
To save memory the footer is parsed every time this method is called.
Sourcepub fn extension_area(&self) -> Option<&'a [u8]>
pub fn extension_area(&self) -> Option<&'a [u8]>
Returns the extension area.
§Performance
To save memory the footer is parsed every time this method is called.
Trait Implementations§
Source§impl<'a> Ord for RawTga<'a>
impl<'a> Ord for RawTga<'a>
Source§impl<'a> PartialOrd for RawTga<'a>
impl<'a> PartialOrd for RawTga<'a>
impl<'a> Copy for RawTga<'a>
impl<'a> Eq for RawTga<'a>
impl<'a> StructuralPartialEq for RawTga<'a>
Auto Trait Implementations§
impl<'a> Freeze for RawTga<'a>
impl<'a> RefUnwindSafe for RawTga<'a>
impl<'a> Send for RawTga<'a>
impl<'a> Sync for RawTga<'a>
impl<'a> Unpin for RawTga<'a>
impl<'a> UnwindSafe for RawTga<'a>
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut u8)
unsafe fn clone_to_uninit(&self, dst: *mut u8)
clone_to_uninit
)