Struct DDS

Source
pub struct DDS {
    pub header: Header,
    pub layers: Vec<Vec<RGBA<u8>>>,
}
Expand description

Represents a parsed DDS file

Fields§

§header: Header

The parsed DDS header

§layers: Vec<Vec<RGBA<u8>>>

Mipmap layers

Implementations§

Source§

impl DDS

Source

pub fn parse_header<R: Read>(buf: &mut R) -> Result<Header, ParseError>

Parses a Header object from a raw u8 buffer.

Source

pub fn parse_header_raw<R: Read>(buf: &mut R) -> Result<RawHeader, ParseError>

Parses the raw header from the image. Useful for getting information not contained in the normal parsed Header struct.

Source

pub fn decode<R: Read>(buf: &mut R) -> Result<DDS, ParseError>

Decodes a buffer into a header and a series of mipmap images. Handles uncompressed and DXT1-5 compressed images.

Source

pub fn encode( pixels: &Vec<RGBA<u8>>, size: (u32, u32), compression: Compression, ) -> Result<Vec<u8>, EncodeError>

Encodes a series of Pixels as a bunch of bytes, suitable for writing to disk, etc. Currently only supports uncompressed RGBA images

Auto Trait Implementations§

§

impl Freeze for DDS

§

impl RefUnwindSafe for DDS

§

impl Send for DDS

§

impl Sync for DDS

§

impl Unpin for DDS

§

impl UnwindSafe for DDS

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.