Enum nutexb::NutexbFormat

source ·
pub enum NutexbFormat {
Show 20 variants R8Unorm = 256, R8G8B8A8Unorm = 1_024, R8G8B8A8Srgb = 1_029, R32G32B32A32Float = 1_076, B8G8R8A8Unorm = 1_104, B8G8R8A8Srgb = 1_109, BC1Unorm = 1_152, BC1Srgb = 1_157, BC2Unorm = 1_168, BC2Srgb = 1_173, BC3Unorm = 1_184, BC3Srgb = 1_189, BC4Unorm = 384, BC4Snorm = 389, BC5Unorm = 640, BC5Snorm = 645, BC6Ufloat = 1_239, BC6Sfloat = 1_240, BC7Unorm = 1_248, BC7Srgb = 1_253,
}
Expand description

Supported image data formats.

These formats have a corresponding format in modern versions of graphics APIs like OpenGL, Vulkan, etc. All known NutexbFormat are supported by DDS DXGI formats.

In some contexts, “Unorm” is called “linear” or expanded to “unsigned normalized”. “U” and “S” prefixes refer to “unsigned” and “signed” data, respectively. “Srgb”, “Unorm”, and “Snorm” variants use the same data format but use different conversions to floating point when accessed by a GPU shader.

Variants§

§

R8Unorm = 256

§

R8G8B8A8Unorm = 1_024

§

R8G8B8A8Srgb = 1_029

§

R32G32B32A32Float = 1_076

§

B8G8R8A8Unorm = 1_104

§

B8G8R8A8Srgb = 1_109

§

BC1Unorm = 1_152

§

BC1Srgb = 1_157

§

BC2Unorm = 1_168

§

BC2Srgb = 1_173

§

BC3Unorm = 1_184

§

BC3Srgb = 1_189

§

BC4Unorm = 384

§

BC4Snorm = 389

§

BC5Unorm = 640

§

BC5Snorm = 645

§

BC6Ufloat = 1_239

§

BC6Sfloat = 1_240

§

BC7Unorm = 1_248

§

BC7Srgb = 1_253

Implementations§

source§

impl NutexbFormat

source

pub fn bytes_per_pixel(&self) -> u32

The number of bytes per pixel. For block compressed formats like NutexbFormat::BC7Srgb, this is the size in bytes of a single block.

§Examples
assert_eq!(1, NutexbFormat::R8Unorm.bytes_per_pixel());
assert_eq!(4, NutexbFormat::R8G8B8A8Unorm.bytes_per_pixel());
assert_eq!(8, NutexbFormat::BC1Unorm.bytes_per_pixel());
assert_eq!(16, NutexbFormat::BC7Srgb.bytes_per_pixel());
assert_eq!(16, NutexbFormat::R32G32B32A32Float.bytes_per_pixel());
source

pub fn block_width(&self) -> u32

The width in pixels for a compressed block or 1 for uncompressed formats.

§Examples
assert_eq!(1, NutexbFormat::R8Unorm.block_width());
assert_eq!(1, NutexbFormat::R8G8B8A8Unorm.block_width());
assert_eq!(4, NutexbFormat::BC1Unorm.block_width());
assert_eq!(4, NutexbFormat::BC7Srgb.block_width());
source

pub fn block_height(&self) -> u32

The height in pixels for a compressed block or 1 for uncompressed formats.

§Examples
assert_eq!(1, NutexbFormat::R8Unorm.block_height());
assert_eq!(1, NutexbFormat::R8G8B8A8Unorm.block_height());
assert_eq!(4, NutexbFormat::BC1Unorm.block_height());
assert_eq!(4, NutexbFormat::BC7Srgb.block_height());
source

pub fn block_depth(&self) -> u32

The depth in pixels for a compressed block or 1 for uncompressed formats.

§Examples
assert_eq!(1, NutexbFormat::R8Unorm.block_depth());
assert_eq!(1, NutexbFormat::R8G8B8A8Unorm.block_depth());
assert_eq!(1, NutexbFormat::BC1Unorm.block_depth());
assert_eq!(1, NutexbFormat::BC7Srgb.block_depth());

Trait Implementations§

source§

impl BinRead for NutexbFormat

§

type Args<'__binrw_generated_args_lifetime> = ()

The type used for the args parameter of read_args() and read_options(). Read more
source§

fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_> ) -> BinResult<Self>

Read Self from the reader using the given Endian and arguments. Read more
source§

fn read_be<R>(reader: &mut R) -> Result<Self, Error>
where R: Read + Seek, Self::Args<'a>: for<'a> Required,

Read Self from the reader using default arguments and assuming big-endian byte order. Read more
source§

fn read_le<R>(reader: &mut R) -> Result<Self, Error>
where R: Read + Seek, Self::Args<'a>: for<'a> Required,

Read Self from the reader using default arguments and assuming little-endian byte order. Read more
source§

fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
where R: Read + Seek, Self::Args<'a>: for<'a> Required,

Read T from the reader assuming native-endian byte order. Read more
source§

fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
where R: Read + Seek,

Read Self from the reader, assuming big-endian byte order, using the given arguments. Read more
source§

fn read_le_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
where R: Read + Seek,

Read Self from the reader, assuming little-endian byte order, using the given arguments. Read more
source§

fn read_ne_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
where R: Read + Seek,

Read T from the reader, assuming native-endian byte order, using the given arguments. Read more
source§

impl BinWrite for NutexbFormat

§

type Args<'__binrw_generated_args_lifetime> = ()

The type used for the args parameter of write_args() and write_options(). Read more
source§

fn write_options<W: Write + Seek>( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_> ) -> BinResult<()>

Write Self to the writer using the given Endian and arguments. Read more
source§

fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write + Seek, Self::Args<'a>: for<'a> Required,

Write Self to the writer assuming big-endian byte order. Read more
source§

fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write + Seek, Self::Args<'a>: for<'a> Required,

Write Self to the writer assuming little-endian byte order. Read more
source§

fn write_be_args<W>( &self, writer: &mut W, args: Self::Args<'_> ) -> Result<(), Error>
where W: Write + Seek,

Write Self to the writer, assuming big-endian byte order, using the given arguments. Read more
source§

fn write_le_args<W>( &self, writer: &mut W, args: Self::Args<'_> ) -> Result<(), Error>
where W: Write + Seek,

Write Self to the writer, assuming little-endian byte order, using the given arguments. Read more
source§

impl Clone for NutexbFormat

source§

fn clone(&self) -> NutexbFormat

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for NutexbFormat

source§

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

Formats the value using the given formatter. Read more
source§

impl From<NutexbFormat> for DxgiFormat

source§

fn from(value: NutexbFormat) -> Self

Converts to this type from the input type.
source§

impl PartialEq for NutexbFormat

source§

fn eq(&self, other: &NutexbFormat) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for NutexbFormat

source§

impl Eq for NutexbFormat

source§

impl StructuralPartialEq for NutexbFormat

Auto Trait Implementations§

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.