pub struct BasisuTranscoder { /* private fields */ }Available on crate feature
extra only.Implementations§
Source§impl BasisuTranscoder
impl BasisuTranscoder
Sourcepub fn new(
input: &[u8],
supported_compressed_formats: SupportedTextureCompression,
channel_type_hint: ChannelType,
) -> Result<Self, BasisuTranscodeError>
pub fn new( input: &[u8], supported_compressed_formats: SupportedTextureCompression, channel_type_hint: ChannelType, ) -> Result<Self, BasisuTranscodeError>
Create a transcoder and set the input data of ktx2 basisu file in bytes.
Panic if basisu_transcoder_init hasn’t been called.
supported_compressed_formats and channel_type_hint affect the preferred transcode target.
channel_type_hint only has effect if the basisu texture is ETC1S, or device only supports ETC2. If it’s ChannelType::Auto, it will be determined automatically according to ktx2 dfd channel ids.
Default transcode target selection:
| BasisU format | Target selection |
|---|---|
| ETC1S | Bc7Rgba/Bc5Rg/Bc4R > Etc2Rgba8/Etc2Rgb8/EacRg11/EacR11 > Rgba8 |
| UASTC_LDR, ASTC_LDR, XUASTC_LDR | Astc > Bc7Rgba > Etc2Rgba8/Etc2Rgb8/EacRg11/EacR11 > Rgba8 |
| UASTC_HDR, ASTC_HDR | Astc > Bc6hRgbUfloat > Rgba16Float |
Sourcepub fn get_info(&self) -> TranscodeInfo
pub fn get_info(&self) -> TranscodeInfo
Get the input info TranscodeInfo.
Sourcepub fn transcode(
&self,
transcode_target: Option<TranscodeTargetFormat>,
is_srgb: Option<bool>,
) -> Result<TranscodedImage, BasisuTranscodeError>
pub fn transcode( &self, transcode_target: Option<TranscodeTargetFormat>, is_srgb: Option<bool>, ) -> Result<TranscodedImage, BasisuTranscodeError>
Transcode the input data and return the image. Return error if it’s not prepared or transcoding failed.
If transcode_target/is_srgb is None, it will use TranscodeInfo::preferred_target/TranscodeInfo::is_srgb.
Auto Trait Implementations§
impl Freeze for BasisuTranscoder
impl RefUnwindSafe for BasisuTranscoder
impl Send for BasisuTranscoder
impl Sync for BasisuTranscoder
impl Unpin for BasisuTranscoder
impl UnsafeUnpin for BasisuTranscoder
impl UnwindSafe for BasisuTranscoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more