Struct ddsfile::Dds

source ·
pub struct Dds {
    pub header: Header,
    pub header10: Option<Header10>,
    pub data: Vec<u8>,
}
Expand description

This is the main DirectDraw Surface file structure

Fields§

§header: Header§header10: Option<Header10>§data: Vec<u8>

Implementations§

source§

impl Dds

source

pub fn new_d3d(params: NewD3dParams) -> Result<Dds, Error>

Create a new DirectDraw Surface with a D3DFormat

source

pub fn new_dxgi(params: NewDxgiParams) -> Result<Dds, Error>

Create a new DirectDraw Surface with a DxgiFormat

source

pub fn read<R: Read>(r: R) -> Result<Dds, Error>

Read a DDS file

source

pub fn write<W: Write>(&self, w: &mut W) -> Result<(), Error>

Write to a DDS file

source

pub fn get_d3d_format(&self) -> Option<D3DFormat>

Attempt to get the format of this DDS, presuming it is a D3DFormat.

source

pub fn get_dxgi_format(&self) -> Option<DxgiFormat>

Attempt to get the format of this DDS, presuming it is a DxgiFormat.

source

pub fn get_format(&self) -> Option<Box<dyn DataFormat>>

Get the format of the DDS as a trait (type-erasure)

source

pub fn get_width(&self) -> u32

source

pub fn get_height(&self) -> u32

source

pub fn get_depth(&self) -> u32

source

pub fn get_bits_per_pixel(&self) -> Option<u32>

source

pub fn get_pitch(&self) -> Option<u32>

source

pub fn get_pitch_height(&self) -> u32

source

pub fn get_main_texture_size(&self) -> Option<u32>

source

pub fn get_array_stride(&self) -> Result<u32, Error>

source

pub fn get_num_array_layers(&self) -> u32

source

pub fn get_num_mipmap_levels(&self) -> u32

source

pub fn get_min_mipmap_size_in_bytes(&self) -> u32

source

pub fn get_data(&self, array_layer: u32) -> Result<&[u8], Error>

This gets a reference to the data at the given array_layer (which should be 0 for textures with just one image).

source

pub fn get_mut_data(&mut self, array_layer: u32) -> Result<&mut [u8], Error>

This gets a reference to the data at the given array_layer (which should be 0 for textures with just one image).

Trait Implementations§

source§

impl Debug for Dds

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.