Skip to main content

DataFormat

Enum DataFormat 

Source
#[repr(u8)]
pub enum DataFormat { Intensity4 = 0, Intensity8 = 1, IntensityA4 = 2, IntensityA8 = 3, Rgb565 = 4, Rgb5a3 = 5, Argb8888 = 6, Index4 = 8, Index8 = 9, Dxt1 = 14, }
Expand description

This enum specifies the format for which a GVR texture should be encoded in.

Most formats are to be used in accordance with crate::TextureEncoder::new_gcix() or crate::TextureEncoder::new_gbix(). If you wish to use DataFormat::Index4 or DataFormat::Index8, then use crate::TextureEncoder::new_gcix_palettized() or crate::TextureEncoder::new_gbix_palettized(). That way you can specify the color format for the color palette alongside the data format.

Variants§

§

Intensity4 = 0

Stores 4-bit intensity values (each pixel is composed of just one value). This makes the image look grayscale. This format stores no alpha channel.

§

Intensity8 = 1

Stores 8-bit intensity values (each pixel is composed of just one value). This makes the image look grayscale. This format stores no alpha channel.

§

IntensityA4 = 2

Stores 4-bit intensity values (each pixel is composed of just one value) along with an alpha channel. This makes the image look grayscale.

§

IntensityA8 = 3

Stores 8-bit intensity values (each pixel is composed of just one value) along with an alpha channel. This makes the image look grayscale.

§

Rgb565 = 4

Stores 16-bit color values, but does not save an alpha channel.

§

Rgb5a3 = 5

Stores 16-bit color values, but saves the alpha channel as well.

§

Argb8888 = 6

Stores 24-bit depth true color (1 byte per color). It also stores an 8-bit alpha channel.

This format is by far the one with the largest filesize, although the most accurate in terms of color.

§

Index4 = 8

Stores 4-bit indices into a quantized color palette.

The color palette can only encode a maximum of 16 colors, which means images with a larger variety of colors will not look that great.

§

Index8 = 9

Stores 8-bit indices into a quantized color palette.

The color palette can encode a maximum of 256 colors, which means images preserve a decent amount of their color quality, as opposed to the DataFormat::Index4 format.

§

Dxt1 = 14

Encodes the image using a DXT1 compression algorithm, also known as BC1 (Block Compression 1).

Works well in environments where the texture cannot be easily viewed (like a 3D model in motion), but not that well in other cases (like on a 2D menu), as the compression artifacts can be quite visible at times.

Trait Implementations§

Source§

impl Clone for DataFormat

Source§

fn clone(&self) -> DataFormat

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for DataFormat

Source§

impl Default for DataFormat

Source§

fn default() -> DataFormat

Returns the “default value” for a type. Read more
Source§

impl From<DataFormat> for u8

Source§

fn from(value: DataFormat) -> Self

Converts to this type from the input type.
Source§

impl From<PixelFormat> for DataFormat

Source§

fn from(value: PixelFormat) -> Self

Converts to this type from the input type.
Source§

impl TryFrom<u8> for DataFormat

Source§

type Error = TextureDecodeError

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

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

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

Source§

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>,

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.