Skip to main content

BasisuTranscoder

Struct BasisuTranscoder 

Source
pub struct BasisuTranscoder { /* private fields */ }
Available on crate feature extra only.

Implementations§

Source§

impl BasisuTranscoder

Source

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 formatTarget selection
ETC1SBc7Rgba/Bc5Rg/Bc4R > Etc2Rgba8/Etc2Rgb8/EacRg11/EacR11 > Rgba8
UASTC_LDR, ASTC_LDR, XUASTC_LDRAstc > Bc7Rgba > Etc2Rgba8/Etc2Rgb8/EacRg11/EacR11 > Rgba8
UASTC_HDR, ASTC_HDRAstc > Bc6hRgbUfloat > Rgba16Float
Source

pub fn get_info(&self) -> TranscodeInfo

Get the input info TranscodeInfo.

Source

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§

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

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,