Struct basis_universal::transcoding::Transcoder [−][src]
A transcoder that can convert compressed basis-universal data to compressed GPU formats or raw color data
Implementations
impl Transcoder[src]
pub fn new() -> Transcoder[src]
Create a transcoder
pub fn validate_file_checksums(
&self,
data: &[u8],
full_validation: bool
) -> bool[src]
&self,
data: &[u8],
full_validation: bool
) -> bool
Validates the .basis file. This computes a crc16 over the entire file, so it's slow.
pub fn validate_header(&self, data: &[u8]) -> bool[src]
Quick header validation - no crc16 checks.
pub fn basis_texture_type(&self, data: &[u8]) -> BasisTextureType[src]
The type of texture represented by the basis data
pub fn basis_texture_format(&self, data: &[u8]) -> BasisTextureFormat[src]
The basis texture format of the basis data
pub fn user_data(&self, data: &[u8]) -> Result<UserData, ()>[src]
pub fn image_count(&self, data: &[u8]) -> u32[src]
Number of images in the basis data
pub fn image_level_count(&self, data: &[u8], image_index: u32) -> u32[src]
Number of mipmap levels for the specified image in the basis data
pub fn image_level_description(
&self,
data: &[u8],
image_index: u32,
level_index: u32
) -> Option<ImageLevelDescription>[src]
&self,
data: &[u8],
image_index: u32,
level_index: u32
) -> Option<ImageLevelDescription>
Returns basic information about an image. Note that orig_width/orig_height may not be a multiple of 4.
pub fn image_info(&self, data: &[u8], image_index: u32) -> Option<ImageInfo>[src]
Returns information about the specified image.
pub fn image_level_info(
&self,
data: &[u8],
image_index: u32,
level_index: u32
) -> Option<ImageLevelInfo>[src]
&self,
data: &[u8],
image_index: u32,
level_index: u32
) -> Option<ImageLevelInfo>
Returns information about the specified image's mipmap level.
pub fn prepare_transcoding(&mut self, data: &[u8]) -> Result<(), ()>[src]
prepare_transcoding() must be called before calling transcode_slice() or transcode_image_level().
This is start_transcoding in the original library
For ETC1S files, this call decompresses the selector/endpoint codebooks, so ideally you would only call this once per .basis file (not each image/mipmap level).
pub fn end_transcoding(&mut self)[src]
Parallel with prepare_transcoding(), named stop_transcoding in the original library
pub fn is_prepared_to_transcode(&self) -> bool[src]
Returns true if prepare_transcoding() has been called.
pub fn transcode_image_level(
&self,
data: &[u8],
transcode_format: TranscoderTextureFormat,
transcode_parameters: TranscodeParameters
) -> Result<Vec<u8>, TranscodeError>[src]
&self,
data: &[u8],
transcode_format: TranscoderTextureFormat,
transcode_parameters: TranscodeParameters
) -> Result<Vec<u8>, TranscodeError>
transcode_image_level() decodes a single mipmap level from the .basis file to any of the supported output texture formats. It'll first find the slice(s) to transcode, then call transcode_slice() one or two times to decode both the color and alpha texture data (or RG texture data from two slices for BC5). If the .basis file doesn't have alpha slices, the output alpha blocks will be set to fully opaque (all 255's). Currently, to decode to PVRTC1 the basis texture's dimensions in pixels must be a power of 2, due to PVRTC1 format requirements. output_blocks_buf_size_in_blocks_or_pixels should be at least the image level's total_blocks (num_blocks_x * num_blocks_y), or the total number of output pixels if fmt==cTFRGBA32. output_row_pitch_in_blocks_or_pixels: Number of blocks or pixels per row. If 0, the transcoder uses the slice's num_blocks_x or orig_width (NOT num_blocks_x * 4). Ignored for PVRTC1 (due to texture swizzling). output_rows_in_pixels: Ignored unless fmt is cRGBA32. The total number of output rows in the output buffer. If 0, the transcoder assumes the slice's orig_height (NOT num_blocks_y * 4). Notes:
- basisu_transcoder_init() must have been called first to initialize the transcoder lookup tables before calling this function.
- This method assumes the output texture buffer is readable. In some cases to handle alpha, the transcoder will write temporary data to the output texture in a first pass, which will be read in a second pass.
Trait Implementations
impl Drop for Transcoder[src]
Auto Trait Implementations
impl RefUnwindSafe for Transcoder[src]
impl !Send for Transcoder[src]
impl !Sync for Transcoder[src]
impl Unpin for Transcoder[src]
impl UnwindSafe for Transcoder[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,