pub struct Compressor(pub *mut Compressor);
Expand description
Used to encode raw image data to basis-universal form
Tuple Fields§
§0: *mut Compressor
Implementations§
Source§impl Compressor
impl Compressor
Sourcepub fn new(total_thread_count: u32) -> Self
pub fn new(total_thread_count: u32) -> Self
total_thread_count is passed directly to basisu::job_pool total_thread_count is the TOTAL number of job pool threads, including the calling thread! So 2=1 new thread, 3=2 new threads, etc.
Call encoder_init
Sourcepub unsafe fn init(&mut self, params: &CompressorParams) -> bool
pub unsafe fn init(&mut self, params: &CompressorParams) -> bool
Configure the compressor to compress images. CompressorParams
includes both the image data
and parameters that affect compression (such as quality or whether mipmaps should be
generated)
§Safety
Passing invalid parameters may cause undefined behavior. (The underlying C++ library does not thoroughly validate parameters)
Sourcepub unsafe fn process(&mut self) -> Result<(), CompressorErrorCode>
pub unsafe fn process(&mut self) -> Result<(), CompressorErrorCode>
Encodes the images as configured when calling init()
§Safety
Compressing with invalid parameters may cause undefined behavior. (The underlying C++ library does not thoroughly validate parameters)
Sourcepub fn basis_file(&self) -> &[u8] ⓘ
pub fn basis_file(&self) -> &[u8] ⓘ
Access the compressed data. May be empty if process()
was not yet called
Sourcepub fn basis_file_size(&self) -> u32
pub fn basis_file_size(&self) -> u32
Return the size of the encoded basis-universal data
Sourcepub fn bits_per_texel(&self) -> f64
pub fn bits_per_texel(&self) -> f64
Returns the number of bits required per texel
Sourcepub fn any_source_image_has_alpha(&self) -> bool
pub fn any_source_image_has_alpha(&self) -> bool
Returns if any source image has alpha