Struct CompressorParams

Source
pub struct CompressorParams(pub *mut CompressorParams);
Expand description

Parameters that are used to configure a Compressor

Tuple Fields§

§0: *mut CompressorParams

Implementations§

Source§

impl CompressorParams

Source

pub fn new() -> Self

Create a compressor with default options

Source

pub fn reset(&mut self)

Resets the compressor params to default state

Source

pub fn source_image_mut(&mut self, image_index: u32) -> CompressorImageRef

Get a reference to the source index. The internal list of source images is resized as needed such that the image will exist

Source

pub fn resize_source_image_list(&mut self, size: u32)

Resizes the source image list. If the provided length is shorter than the list, the data beyond the provided length is truncated.

Source

pub fn clear_source_image_list(&mut self)

Resets the image list to be zero-length

Source

pub fn source_mipmap_image_mut( &mut self, image_index: u32, level: u32, ) -> CompressorImageRef

Get a reference to the source index. The internal list of source images is resized as needed such that the image will exist

Source

pub fn resize_source_mipmap_image_list(&mut self, size: u32)

Resizes the source image list. If the provided length is shorter than the list, the data beyond the provided length is truncated.

Source

pub fn resize_source_mipmap_level_image_list(&mut self, level: u32, size: u32)

Resizes the source image list. If the provided length is shorter than the list, the data beyond the provided length is truncated.

Source

pub fn clear_source_mipmap_image_list(&mut self)

Resets the image list to be zero-length

Source

pub fn set_print_status_to_stdout(&mut self, print_status_to_stdout: bool)

Enable stdout logging

Source

pub fn set_etc1s_quality_level(&mut self, quality_level: u32)

Set ETC1S quality level. The value MUST be >= ETC1S_QUALITY_MIN and <= ETC1S_QUALITY_MAX.

Source

pub fn set_uastc_quality_level(&mut self, quality_level: u32)

Sets UASTC quality level. The value MUST be >= UASTC_QUALITY_MIN and <= UASTC_QUALITY_MAX.

Source

pub fn set_basis_format(&mut self, basis_format: BasisTextureFormat)

Set the basis format we will compress to. See basis documentation for details. This corresponds to the -uastc flag in the basisu command line tool and the m_uastc boolean param on basis_compressor_params in the original library

UASTC encoding result in significantly higher texture quality, but larger files.

Source

pub fn set_color_space(&mut self, color_space: ColorSpace)

Sets the color space the images to be compressed is encoded in

Setting a linear color space will:

  • Use linear colorspace metrics (instead of the default sRGB)
  • By default use linear (not sRGB) mipmap filtering
Source

pub fn set_mip_color_space(&mut self, color_space: ColorSpace)

Override the mipmap generation color space behavior. This function is not necessary to call if you call [set_color_space] with the correct value.

  • If the color space is sRGB, convert image to linear before filtering, then back to sRGB
  • If the color space is linear, we keep the image in linear during mipmap filtering (i.e. do not convert to/from sRGB for filtering purposes)
Source

pub fn set_no_selector_rdo(&mut self, no_selector_rdo: bool)

Disable backend’s selector rate distortion optimizations (slightly faster, less noisy output, but lower quality per output bit)

Source

pub fn set_no_endpoint_rdo(&mut self, no_endpoint_rdo: bool)

Disable backend’s endpoint rate distortion optimizations (slightly faster, less noisy output, but lower quality per output bit)

Source

pub fn set_rdo_uastc(&mut self, rdo_uastc_quality_scalar: Option<f32>)

Enable/disable UASTC RDO post-processing and set UASTC RDO quality scalar to X. Lower values=higher quality/larger LZ compressed files, higher values=lower quality/smaller LZ compressed files. Good range to try is [.2-4]

Source

pub fn set_generate_mipmaps(&mut self, generate_mipmaps: bool)

Generate mipmaps for each source image

By default, sRGB textures will be converted from sRGB to linear before mipmap filtering. This can be changed by calling [set_color_space] or [set_mip_color_space]

Source

pub fn set_mipmap_smallest_dimension(&mut self, smallest_dimension: u32)

Sets the smallest dimension mipmap that will be generated

Source

pub fn set_userdata(&mut self, userdata: UserData)

Set arbitrary userdata to be included with the basis-universal binary data

Source

pub fn tune_for_normal_maps(&mut self)

The basisu command line compressor offers a -normal_map parameter that sets several values automatically. This convenience function mimics that parameter.

  • linear colorspace metrics
  • linear mipmap filtering
  • no selector RDO
  • no sRGB

Trait Implementations§

Source§

impl Default for CompressorParams

Source§

fn default() -> Self

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

impl Drop for CompressorParams

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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.

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.