### Texture Decoding Functions Source: https://docs.rs/texture2ddecoder Standard signature for texture decoding functions in the crate. ```APIDOC ## Texture Decoding Functions ### Description Standard functions for decoding compressed texture data into a raw pixel buffer. ### Parameters - **data** (&[u8]) - Required - The compressed data, expected to be width * height / block_size in size. - **width** (usize) - Required - The width of the image. - **height** (usize) - Required - The height of the image. - **image** (&mut [u32]) - Required - The buffer to write the decoded image to, expected to be width * height in size. ### Response - **Result** ((), &'static str) - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### General Decode Function Signatures Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/index.html These are the general signatures for decoding full images and blocks. The `data` parameter is the compressed data, `width` and `height` specify image dimensions, and `image` is the buffer for decoded output. The block decode function expects a single block of compressed data. ```rust fn decode_format(data: &[u8], width: usize, height: usize, image: &mut [u32]) -> Result<(), &'static str> // data: the compressed data, expected to be width * height / block_size in size // width: the width of the image // height: the height of the image // image: the buffer to write the decoded image to, expected to be width * height in size ``` ```rust fn decode_format_block(data: &[u8], image: &mut [u32]) -> Result<(), &'static str> // data: the compressed data (block), expected to be block_size in size // image: the buffer to write the decoded image to, expected to be block_size in size ``` -------------------------------- ### Texture Decoding Functions Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/all.html A collection of functions for decoding specific texture compression formats and blocks. ```APIDOC ## Texture Decoding Functions ### Description These functions provide the capability to decode various compressed texture formats into raw pixel data. The library supports formats such as ASTC, ATC, BC (Block Compression), EAC, ETC, and PVRTC. ### Functions - **ASTC**: decode_astc, decode_astc_block, and specific block size variants (e.g., decode_astc_4_4, decode_astc_12_12). - **ATC**: decode_atc_rgb4, decode_atc_rgba8, and block variants. - **BC**: decode_bc1 through decode_bc7, including signed/unsigned variants for BC6. - **EAC**: decode_eacr, decode_eacrg, and block variants. - **ETC**: decode_etc1, decode_etc2_rgb, decode_etc2_rgba1, decode_etc2_rgba8, and block variants. - **PVRTC**: decode_pvrtc, decode_pvrtc_2bpp, decode_pvrtc_4bpp. - **Crunch**: decode_crunch, decode_unity_crunch. ``` -------------------------------- ### Function signature for decode_astc_10_10 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_10_10.html Defines the input parameters and return type for the ASTC 10x10 decoding function. ```rust pub fn decode_astc_10_10( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### Block Decoding Functions Source: https://docs.rs/texture2ddecoder Standard signature for decoding individual texture blocks. ```APIDOC ## Block Decoding Functions ### Description Functions for decoding a single block of compressed texture data. ### Parameters - **data** (&[u8]) - Required - The compressed data (block), expected to be block_size in size. - **image** (&mut [u32]) - Required - The buffer to write the decoded image to, expected to be block_size in size. ### Response - **Result** ((), &'static str) - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### Block Decoding Interface Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/index.html Interface for decoding individual blocks of compressed texture data. ```APIDOC ## Block Decoding Interface ### Description Interface for decoding a single block of compressed texture data. ### Parameters - **data** (&[u8]) - Required - The compressed data (block), expected to be block_size in size. - **image** (&mut [u32]) - Required - The buffer to write the decoded image to, expected to be block_size in size. ### Response - **Result<(), &'static str>** - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### Function signature for decode_astc_12_10 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_12_10.html Defines the parameters and return type for decoding ASTC 12x10 data. ```rust pub fn decode_astc_12_10( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### decode_unity_crunch Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_unity_crunch.html Decodes Unity crunch compressed texture data into a mutable buffer of u32 values. ```APIDOC ## decode_unity_crunch ### Description Decodes Unity crunch compressed texture data into a provided mutable buffer. ### Parameters - **data** (&[u8]) - Required - The compressed texture data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - The mutable buffer to store the decoded image data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### Function signature for decode_astc_10_5 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_10_5.html Defines the interface for decoding ASTC 10x5 data into a provided buffer. ```rust pub fn decode_astc_10_5( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### Texture Decoding Functions Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/index.html A collection of functions to decode specific compressed texture formats into raw image data. ```APIDOC ## Texture Decoding Functions ### Description These functions decode various compressed texture formats (ASTC, ATC, BC, EAC, ETC, PVRTC) into image data. Each function corresponds to a specific compression algorithm or block size. ### Available Functions - **decode_atc_rgb4**: Decodes a atc_rgb4 encoded texture. - **decode_atc_rgba8**: Decodes a atc_rgba8 encoded texture. - **decode_bc1**: Decodes a bc1 encoded texture. - **decode_bc2**: Decodes a bc2 encoded texture. - **decode_bc3**: Decodes a bc3 encoded texture. - **decode_bc4**: Decodes a bc4 encoded texture. - **decode_bc5**: Decodes a bc5 encoded texture. - **decode_bc7**: Decodes a bc7 encoded texture. - **decode_bc1a**: Decodes a bc1a encoded texture. - **decode_bc6_signed**: Decodes a bc6_signed encoded texture. - **decode_bc6_unsigned**: Decodes a bc6_unsigned encoded texture. - **decode_eacr**: Decodes a eacr encoded texture. - **decode_eacr_signed**: Decodes a eacr_signed encoded texture. - **decode_eacrg**: Decodes a eacrg encoded texture. - **decode_eacrg_signed**: Decodes a eacrg_signed encoded texture. - **decode_etc1**: Decodes a etc1 encoded texture. - **decode_etc2_rgb**: Decodes a etc2_rgb encoded texture. - **decode_etc2_rgba1**: Decodes a etc2_rgba1 encoded texture. - **decode_etc2_rgba8**: Decodes a etc2_rgba8 encoded texture. ``` -------------------------------- ### Texture Decoding Functions Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/index.html Standard interface for decoding compressed texture data into an RGBA buffer. ```APIDOC ## Texture Decoding Interface ### Description Standard signature for decoding compressed texture formats into a 32-bit RGBA buffer. ### Parameters - **data** (&[u8]) - Required - The compressed data, expected to be width * height / block_size in size. - **width** (usize) - Required - The width of the image. - **height** (usize) - Required - The height of the image. - **image** (&mut [u32]) - Required - The buffer to write the decoded image to, expected to be width * height in size. ### Response - **Result<(), &'static str>** - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### Function: decode_astc_10_10 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_10_10.html Decodes ASTC 10x10 compressed texture data into a raw RGBA buffer. ```APIDOC ## decode_astc_10_10 ### Description Decodes ASTC 10x10 compressed texture data into a provided mutable buffer of 32-bit integers. ### Method Rust Function ### Parameters - **data** (&[u8]) - Required - The compressed ASTC 10x10 input data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - The mutable buffer to store the decoded pixel data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string if decoding fails. ``` -------------------------------- ### Function signature for decode_astc_12_12 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_12_12.html Defines the interface for decoding ASTC 12x12 compressed data into a provided image buffer. ```rust pub fn decode_astc_12_12( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### Decode Crunch Image Data Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_crunch.html Use this function to decode Crunch-compressed image data. It requires the compressed data, image dimensions, and a mutable slice to store the decoded RGBA pixels. ```rust pub fn decode_crunch( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### decode_unity_crunch function signature Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_unity_crunch.html Defines the interface for decoding Unity Crunch compressed texture data into a mutable buffer. ```rust pub fn decode_unity_crunch( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### Standard Texture Decode Function Signatures Source: https://docs.rs/texture2ddecoder General function signatures used for decoding texture formats and individual blocks. ```rust fn decode_format(data: &[u8], width: usize, height: usize, image: &mut [u32]) -> Result<(), &'static str> // data: the compressed data, expected to be width * height / block_size in size // width: the width of the image // height: the height of the image // image: the buffer to write the decoded image to, expected to be width * height in size fn decode_format_block(data: &[u8], image: &mut [u32]) -> Result<(), &'static str> // data: the compressed data (block), expected to be block_size in size // image: the buffer to write the decoded image to, expected to be block_size in size ``` -------------------------------- ### CRUNCH Decoding Functions Source: https://docs.rs/texture2ddecoder Functions for decoding textures encoded with the CRUNCH format. ```APIDOC ## CRUNCH Decoding Functions ### Description These functions decode textures encoded with the CRUNCH format. ### Functions - `decode_crunch` - `decode_unity_crunch` ``` -------------------------------- ### Function signature for decode_astc_6_5 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_6_5.html Defines the interface for decoding ASTC 6x5 compressed data into a provided buffer. ```rust pub fn decode_astc_6_5( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### Function signature for decode_eacr_signed Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_eacr_signed.html Defines the interface for decoding eacr_signed textures, requiring input data, dimensions, and a mutable output buffer. ```rust pub fn decode_eacr_signed( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### BCn Decoding Functions Source: https://docs.rs/texture2ddecoder Functions for decoding textures encoded with the BCn formats. ```APIDOC ## BCn Decoding Functions ### Description These functions decode textures encoded with various BCn formats. ### Functions - `decode_bc1` Decodes a bc1 encoded texture into an image - `decode_bc2` Decodes a bc2 encoded texture into an image - `decode_bc3` Decodes a bc3 encoded texture into an image - `decode_bc4` Decodes a bc4 encoded texture into an image - `decode_bc5` Decodes a bc5 encoded texture into an image - `decode_bc6` - `decode_bc7` Decodes a bc7 encoded texture into an image - `decode_bc1_block` - `decode_bc1a` Decodes a bc1a encoded texture into an image - `decode_bc1a_block` - `decode_bc2_block` - `decode_bc3_block` - `decode_bc4_block` - `decode_bc5_block` - `decode_bc6_block` - `decode_bc6_block_signed` - `decode_bc6_block_unsigned` - `decode_bc6_signed` Decodes a bc6_signed encoded texture into an image - `decode_bc6_unsigned` Decodes a bc6_unsigned encoded texture into an image - `decode_bc7_block` ``` -------------------------------- ### Function signature for decode_eacrg_signed_block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_eacrg_signed_block.html Defines the input data slice and output buffer for the decoding process. ```rust pub fn decode_eacrg_signed_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### decode_bc6_block_unsigned Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc6_block_unsigned.html Decodes a BC6 unsigned block into an output buffer. ```APIDOC ## FUNCTION decode_bc6_block_unsigned ### Description Decodes a BC6 unsigned block from the provided input data into the specified output buffer. ### Parameters - **data** (&[u8]) - Required - The input byte slice containing the BC6 block data. - **outbuf** (&mut [u32]) - Required - The mutable output buffer slice where the decoded data will be stored. ### Request Example ```rust let data = [0u8; 16]; let mut outbuf = [0u32; 16]; decode_bc6_block_unsigned(&data, &mut outbuf); ``` ``` -------------------------------- ### ETC Decoding Functions Source: https://docs.rs/texture2ddecoder Functions for decoding textures encoded with the ETC format. ```APIDOC ## ETC Decoding Functions ### Description These functions decode textures encoded with the ETC1 and ETC2 formats. ### Functions - `decode_etc1` Decodes a etc1 encoded texture into an image - `decode_etc1_block` - `decode_etc2_a8_block` - `decode_etc2_rgb` Decodes a etc2_rgb encoded texture into an image - `decode_etc2_rgb_block` - `decode_etc2_rgba1` Decodes a etc2_rgba1 encoded texture into an image - `decode_etc2_rgba8` Decodes a etc2_rgba8 encoded texture into an image - `decode_etc2_rgba1_block` - `decode_etc2_rgba8_block` ``` -------------------------------- ### crnd_get_texture_info Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/struct.CrnTextureInfo.html Retrieves texture information from raw data bytes. ```APIDOC ## crnd_get_texture_info ### Description Populates the CrnTextureInfo struct with metadata extracted from the provided raw texture data. ### Method Method call on CrnTextureInfo instance ### Parameters #### Path Parameters - **p_data** (&[u8]) - Required - A slice containing the raw texture data. - **data_size** (u32) - Required - The size of the data slice in bytes. ### Response #### Success Response (200) - **result** (bool) - Returns true if the texture information was successfully parsed, false otherwise. ``` -------------------------------- ### Function: decode_crunch Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_crunch.html Decodes crunch-compressed texture data into a provided buffer. ```APIDOC ## decode_crunch ### Description Decodes crunch-compressed texture data into a mutable buffer of 32-bit integers. ### Parameters - **data** (&[u8]) - Required - The input crunch-compressed byte data. - **width** (usize) - Required - The width of the target image. - **height** (usize) - Required - The height of the target image. - **image** (&mut [u32]) - Required - A mutable slice to store the decoded pixel data. ### Response - **Result<(), &'static str>** - Returns Ok(()) on success, or an error string if decoding fails. ``` -------------------------------- ### Function: decode_bc6_unsigned Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc6_unsigned.html Decodes a bc6_unsigned encoded texture into an image buffer. ```APIDOC ## decode_bc6_unsigned ### Description Decodes a bc6_unsigned encoded texture into an image. ### Parameters - **data** (&[u8]) - Required - The encoded texture data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - A mutable buffer to store the decoded image data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### Function: decode_astc_5_4 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_5_4.html Decodes ASTC 5x4 compressed data into a provided mutable buffer. ```APIDOC ## decode_astc_5_4 ### Description Decodes ASTC 5x4 compressed texture data into a provided mutable buffer of 32-bit integers. ### Parameters - **data** (&[u8]) - Required - The compressed ASTC 5x4 input data. - **width** (usize) - Required - The width of the texture in pixels. - **height** (usize) - Required - The height of the texture in pixels. - **image** (&mut [u32]) - Required - The mutable buffer to store the decoded RGBA pixel data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string if decoding fails. ``` -------------------------------- ### decode_astc_8_5 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_8_5.html Decodes ASTC 8x5 compressed texture data into a raw RGBA buffer. ```APIDOC ## FUNCTION decode_astc_8_5 ### Description Decodes ASTC 8x5 compressed texture data into a provided mutable buffer of 32-bit integers. ### Parameters - **data** (&[u8]) - Required - The compressed ASTC 8x5 input data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - The mutable buffer to store the decoded pixel data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### CrnTextureInfo Struct Definition Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/struct.CrnTextureInfo.html Defines the memory layout for CRN texture metadata, including dimensions, levels, and format information. ```rust #[repr(C)] pub struct CrnTextureInfo { pub struct_size: u32, pub width: u32, pub height: u32, pub levels: u32, pub faces: u32, pub bytes_per_block: u32, pub userdata0: u32, pub userdata1: u32, pub format: CrnFormat, } ``` -------------------------------- ### decode_astc_12_10 Function Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_12_10.html Decodes ASTC 12_10 compressed texture data. ```APIDOC ## decode_astc_12_10 ### Description Decodes ASTC 12_10 compressed texture data into a raw pixel buffer. ### Method Rust Function ### Endpoint N/A (Rust function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust // Example usage within Rust code let mut image_data = vec![0u32; width * height]; let result = decode_astc_12_10(&compressed_data, width, height, &mut image_data); ``` ### Response #### Success Response (Ok) Returns `Ok(())` on successful decoding. #### Error Response (Err) Returns `Err(&'static str)` with an error message if decoding fails. #### Response Example ```rust // Success Ok(()) // Failure Err("Invalid data format") ``` ``` -------------------------------- ### decode_bc6 function signature Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc6.html The function signature for decoding BC6 compressed texture data. ```rust pub fn decode_bc6( data: &[u8], width: usize, height: usize, image: &mut [u32], signed: bool, ) -> Result<(), &'static str> ``` -------------------------------- ### Decode PVRTC 2bpp Texture Data Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_pvrtc_2bpp.html Use this function to decode PVRTC 2 bits per pixel texture data. It requires the raw data, dimensions, and a mutable slice for the output image. Returns an error if decoding fails. ```rust pub fn decode_pvrtc_2bpp( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### decode_astc_5_5 Function Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_5_5.html Decodes ASTC 5x5 compressed texture data into RGBA8 format. ```APIDOC ## decode_astc_5_5 ### Description Decodes ASTC 5x5 compressed texture data into RGBA8 format. ### Method Rust Function ### Endpoint N/A (Rust function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust let mut image = vec![0u32; width * height]; let result = decode_astc_5_5(data, width, height, &mut image); ``` ### Response #### Success Response (Ok) Returns `Ok(())` on successful decoding. #### Error Response (Err) Returns `Err(&'static str)` with an error message if decoding fails. #### Response Example ```rust // Success Ok(()) // Error Err("Invalid data format") ``` ``` -------------------------------- ### Decode ETC2 RGBA1 Texture Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_etc2_rgba1.html Use this function to decode ETC2 RGBA1 encoded texture data into a raw image buffer. Ensure the output buffer has sufficient capacity. ```rust pub fn decode_etc2_rgba1( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### Decode ASTC 8x5 Data Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_8_5.html Use this function to decode ASTC 8x5 compressed texture data. It requires the raw data, dimensions, and a mutable slice for the output image. ```rust pub fn decode_astc_8_5( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### decode_pvrtc_2bpp Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_pvrtc_2bpp.html Decodes PVRTC 2bpp texture data into a provided buffer. ```APIDOC ## decode_pvrtc_2bpp ### Description Decodes PVRTC 2bpp encoded texture data into a mutable buffer of 32-bit integers. ### Parameters - **data** (&[u8]) - Required - The input PVRTC 2bpp encoded byte slice. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - The mutable buffer to store the decoded pixel data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### Decode ASTC 8x6 Data Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_8_6.html Use this function to decode ASTC 8x6 compressed texture data. It requires the raw data, dimensions, and a mutable slice for the output image. ```rust pub fn decode_astc_8_6( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### decode_bc5_block function signature Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc5_block.html Defines the function signature for decoding BC5 blocks into a provided output buffer. ```rust pub fn decode_bc5_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### decode_etc2_rgba1_block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_etc2_rgba1_block.html Decodes an ETC2 RGBA1 block into an output buffer. ```APIDOC ## FUNCTION decode_etc2_rgba1_block ### Description Decodes an ETC2 RGBA1 block from the provided input data into the specified output buffer. ### Parameters - **data** (&[u8]) - Required - The input byte slice containing the encoded ETC2 RGBA1 block. - **outbuf** (&mut [u32]) - Required - The mutable output buffer slice where the decoded pixels will be stored. ### Request Example ```rust let data = [0u8; 8]; // Example input block let mut outbuf = [0u32; 16]; // Example output buffer decode_etc2_rgba1_block(&data, &mut outbuf); ``` ``` -------------------------------- ### Decode ATC RGBA8 Block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_atc_rgba8_block.html Decodes a block of ATC RGBA8 compressed texture data. Requires input data and an output buffer. ```rust pub fn decode_atc_rgba8_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### Decode ETC2 RGBA1 Block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_etc2_rgba1_block.html Decodes a single ETC2 RGBA1 block. Requires the input data slice and a mutable output buffer for 32-bit RGBA pixels. ```rust pub fn decode_etc2_rgba1_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### Decode ASTC 6-6 Data Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_6_6.html Use this function to decode ASTC 6-6 compressed texture data. It requires the raw data, dimensions, and a mutable slice for the output image. ```rust pub fn decode_astc_6_6( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### decode_astc_10_5 Function Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_10_5.html Decodes ASTC 10x5 compressed texture data into raw pixel data. ```APIDOC ## decode_astc_10_5 ### Description Decodes ASTC 10x5 compressed texture data. This function takes raw compressed data and outputs RGBA8 (32-bit unsigned integer) pixel data. ### Method Rust Function Call ### Endpoint N/A (Rust function) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **data** (&[u8]) - Required - A slice containing the raw ASTC 10x5 compressed texture data. - **width** (usize) - Required - The width of the texture in pixels. - **height** (usize) - Required - The height of the texture in pixels. - **image** (&mut [u32]) - Required - A mutable slice to store the decoded RGBA8 pixel data. The size should be `width * height`. ### Request Example ```rust let compressed_data: Vec = vec![...]; // Your ASTC 10x5 data let width = 128; let height = 128; let mut pixel_data: Vec = vec![0; width * height]; match decode_astc_10_5(&compressed_data, width, height, &mut pixel_data) { Ok(_) => println!("Decoding successful!"), Err(e) => eprintln!("Decoding failed: {}", e), } ``` ### Response #### Success Response (Ok(())) - The function returns `Ok(())` upon successful decoding. #### Response Example N/A (void success type) #### Error Response (Err(&'static str)) - Returns an `Err` with a static string slice describing the error if decoding fails (e.g., invalid data, incorrect dimensions). ``` -------------------------------- ### Decode ASTC 10x8 Texture Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_10_8.html Use this function to decode ASTC 10x8 compressed texture data. Ensure the image buffer is large enough to hold the decoded texture. ```rust pub fn decode_astc_10_8( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### Decode atc_rgba8 texture Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_atc_rgba8.html Function signature for decoding atc_rgba8 data into a provided mutable image buffer. ```rust pub fn decode_atc_rgba8( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### decode_bc5_block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc5_block.html Decodes a BC5 compressed texture block into an output buffer. ```APIDOC ## FUNCTION decode_bc5_block ### Description Decodes a BC5 compressed block from the input data into the provided output buffer. ### Parameters - **data** (&[u8]) - Required - The input slice containing the compressed BC5 block data. - **outbuf** (&mut [u32]) - Required - The mutable output buffer where the decoded pixels will be stored. ### Signature `pub fn decode_bc5_block(data: &[u8], outbuf: &mut [u32])` ``` -------------------------------- ### Decode BC2 block function signature Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc2_block.html Use this function to decode a BC2 block into a provided output buffer. ```rust pub fn decode_bc2_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### PVRTC Decoding Functions Source: https://docs.rs/texture2ddecoder Functions for decoding textures encoded with the PVRTC format. ```APIDOC ## PVRTC Decoding Functions ### Description These functions decode textures encoded with the PVRTC format. ### Functions - `decode_pvrtc` - `decode_pvrtc_2bpp` - `decode_pvrtc_4bpp` ``` -------------------------------- ### Decode BC7 block function signature Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc7_block.html Use this function to decode a single BC7 block into a provided output buffer. ```rust pub fn decode_bc7_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### decode_bc7_block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc7_block.html Decodes a BC7 compressed texture block into an output buffer. ```APIDOC ## decode_bc7_block ### Description Decodes a BC7 compressed block from the input data into the provided output buffer. ### Method Rust Function ### Parameters - **data** (&[u8]) - Required - The input slice containing the compressed BC7 block data. - **outbuf** (&mut [u32]) - Required - The mutable output buffer where the decoded pixel data will be stored. ### Request Example ```rust let data = [0u8; 16]; // BC7 block data let mut outbuf = [0u32; 16]; // 4x4 pixels decode_bc7_block(&data, &mut outbuf); ``` ``` -------------------------------- ### decode_astc_8_6 Function Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_8_6.html Decodes ASTC 8x6 compressed texture data into raw pixel data. ```APIDOC ## decode_astc_8_6 ### Description Decodes ASTC 8x6 compressed texture data. This function takes raw byte data representing an ASTC 8x6 texture and decodes it into a buffer of 32-bit unsigned integers (RGBA8 format). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Function Signature ```rust pub fn decode_astc_8_6( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` ### Parameters Details - **data** (`&[u8]`) - Required - A slice of bytes containing the ASTC 8x6 compressed texture data. - **width** (`usize`) - Required - The width of the texture in pixels. - **height** (`usize`) - Required - The height of the texture in pixels. - **image** (`&mut [u32]`) - Required - A mutable slice of u32 where the decoded RGBA8 pixel data will be written. The size of this slice should be `width * height`. ### Return Value - `Ok(())` - If the decoding is successful. - `Err(&'static str)` - If an error occurs during decoding, with a static string describing the error. ### Example Usage ```rust // Assuming you have compressed ASTC 8x6 data in `compressed_data` let width = 256; let height = 256; let mut decoded_image = vec![0u32; width * height]; match texture2ddecoder::decode_astc_8_6(&compressed_data, width, height, &mut decoded_image) { Ok(_) => { // Decoding successful, `decoded_image` now contains the RGBA8 pixel data println!("ASTC 8x6 texture decoded successfully."); } Err(e) => { // Handle decoding error eprintln!("Error decoding ASTC 8x6 texture: {}", e); } } ``` ``` -------------------------------- ### decode_astc_6_6 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_6_6.html Decodes ASTC 6x6 compressed texture data into a raw pixel buffer. ```APIDOC ## decode_astc_6_6 ### Description Decodes ASTC 6x6 compressed texture data into a provided mutable buffer of 32-bit pixels. ### Parameters - **data** (&[u8]) - Required - The compressed ASTC 6x6 input data. - **width** (usize) - Required - The width of the texture in pixels. - **height** (usize) - Required - The height of the texture in pixels. - **image** (&mut [u32]) - Required - The mutable buffer to store the decoded pixel data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string if decoding fails. ``` -------------------------------- ### decode_etc2_rgb_block Function Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_etc2_rgb_block.html Decodes a block of ETC2 RGB texture data. ```APIDOC ## decode_etc2_rgb_block ### Description Decodes a block of ETC2 RGB texture data into an output buffer. ### Function Signature ```rust pub fn decode_etc2_rgb_block(data: &[u8], outbuf: &mut [u32]) ``` ### Parameters #### Input Data - **data** (&[u8]) - A slice containing the compressed ETC2 RGB texture data. #### Output Buffer - **outbuf** (&mut [u32]) - A mutable slice where the decoded RGBA pixel data will be written. The size of this buffer should be sufficient to hold the decoded pixels. ``` -------------------------------- ### decode_pvrtc_4bpp Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_pvrtc_4bpp.html Decodes PVRTC 4bpp texture data into a provided buffer. ```APIDOC ## decode_pvrtc_4bpp ### Description Decodes PVRTC 4bpp encoded data into a mutable buffer of 32-bit integers representing the image pixels. ### Parameters - **data** (&[u8]) - Required - The input PVRTC 4bpp encoded byte slice. - **width** (usize) - Required - The width of the target image. - **height** (usize) - Required - The height of the target image. - **image** (&mut [u32]) - Required - The mutable buffer to store the decoded pixel data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string if decoding fails. ``` -------------------------------- ### decode_astc_10_8 Function Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_10_8.html Decodes ASTC 10x8 compressed texture data into a raw RGBA buffer. ```APIDOC ## decode_astc_10_8 ### Description Decodes ASTC 10x8 compressed texture data. This function takes raw compressed data, dimensions, and an output buffer, returning a Result indicating success or an error string. ### Method Rust Function Call ### Endpoint N/A (Rust function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **data** (&[u8]) - Required - Slice of bytes containing the compressed ASTC 10x8 texture data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - Mutable slice of u32 representing the output RGBA buffer. ### Request Example ```rust let mut image_buffer = vec![0u32; width * height]; let result = decode_astc_10_8(&compressed_data, width, height, &mut image_buffer); ``` ### Response #### Success Response (Ok) - **()** - Unit type, indicating successful decoding. #### Error Response (Err) - **&'static str** - A static string slice describing the error encountered during decoding. #### Response Example ```rust // On success: Ok(()) // On error: Err("Invalid data format") ``` ``` -------------------------------- ### Decode ASTC 8x8 Texture Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_8_8.html Use this function to decode ASTC 8x8 compressed texture data. It requires the raw data, dimensions, and a mutable slice to store the decoded image. ```rust pub fn decode_astc_8_8( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### Decode ASTC 5x5 Texture Data Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_5_5.html Decodes ASTC 5x5 compressed data into a provided mutable buffer. The buffer must be large enough to hold the decoded image data. ```rust pub fn decode_astc_5_5( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ``` -------------------------------- ### decode_astc_10_6 Function Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_astc_10_6.html Decodes ASTC 10x6 compressed texture data into a raw pixel buffer. ```APIDOC ## decode_astc_10_6 ### Description Decodes ASTC 10x6 compressed texture data. This function takes raw compressed data, dimensions, and an output buffer to store the decoded pixels. ### Method Rust Function Call ### Endpoint N/A (Rust function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **data** (&[u8]) - Required - A slice containing the raw ASTC 10x6 compressed texture data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - A mutable slice to store the decoded RGBA8888 pixel data. The size of this slice should be `width * height`. ### Request Example ```rust let compressed_data: Vec = vec![...]; // Your ASTC 10x6 data let width = 128; let height = 128; let mut decoded_image: Vec = vec![0; width * height]; match texture2ddecoder::decode_astc_10_6(&compressed_data, width, height, &mut decoded_image) { Ok(_) => println!("Decoding successful!"), Err(e) => eprintln!("Decoding failed: {}", e), } ``` ### Response #### Success Response (Ok) - Returns `Ok(())` upon successful decoding. #### Error Response (Err) - Returns `Err(&'static str)` with an error message if decoding fails. Possible errors include invalid data format or insufficient buffer size. ``` -------------------------------- ### EAC Decoding Functions Source: https://docs.rs/texture2ddecoder Functions for decoding textures encoded with the EAC format. ```APIDOC ## EAC Decoding Functions ### Description These functions decode textures encoded with the EAC format, including signed and unsigned variants. ### Functions - `decode_eac_block` - `decode_eac_signed_block` - `decode_eacr` Decodes a eacr encoded texture into an image - `decode_eacr_block` - `decode_eacr_signed` Decodes a eacr_signed encoded texture into an image - `decode_eacr_signed_block` - `decode_eacrg` Decodes a eacrg encoded texture into an image - `decode_eacrg_block` - `decode_eacrg_signed` Decodes a eacrg_signed encoded texture into an image - `decode_eacrg_signed_block` ``` -------------------------------- ### Function: decode_eacr_signed Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_eacr_signed.html Decodes a eacr_signed encoded texture into an image buffer. ```APIDOC ## decode_eacr_signed ### Description Decodes a eacr_signed encoded texture into an image. ### Parameters - **data** (&[u8]) - Required - The encoded texture data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - A mutable slice to store the decoded image data. ### Response - **Result<(), &'static str>** - Returns Ok(()) on success, or an error message string on failure. ``` -------------------------------- ### Function: decode_bc7 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc7.html Decodes a BC7 encoded texture into an image buffer. ```APIDOC ## decode_bc7 ### Description Decodes a bc7 encoded texture into an image. ### Parameters - **data** (&[u8]) - Required - The BC7 encoded texture data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - A mutable slice to store the decoded image data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error string on failure. ``` -------------------------------- ### Function: decode_bc6 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc6.html Decodes BC6 texture data into a provided mutable buffer. ```APIDOC ## decode_bc6 ### Description Decodes BC6 compressed texture data into a provided mutable buffer of 32-bit integers. ### Parameters - **data** (&[u8]) - Required - The input BC6 compressed data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - The mutable buffer to store the decoded image data. - **signed** (bool) - Required - Specifies if the BC6 data is signed. ### Response - **Result<(), &'static str>** - Returns Ok(()) on success, or an error message string on failure. ``` -------------------------------- ### decode_bc6_block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc6_block.html Decodes a BC6 texture block into an output buffer. ```APIDOC ## decode_bc6_block ### Description Decodes a BC6 texture block into the provided output buffer. ### Parameters - **data** (&[u8]) - Required - The input data block to decode. - **outbuf** (&mut [u32]) - Required - The output buffer to store the decoded pixels. - **signed** (bool) - Required - Specifies whether the data is signed. ### Request Example ```rust decode_bc6_block(&data, &mut outbuf, false); ``` ``` -------------------------------- ### Decode ETC1 Block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_etc1_block.html Decodes a single ETC1 block. Requires input data and a mutable output buffer. The output buffer size must be sufficient to hold the decoded pixels. ```rust pub fn decode_etc1_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### Decode ETC2 RGB Block Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_etc2_rgb_block.html Decodes a single ETC2 RGB block. Ensure the output buffer is large enough to hold the decoded data. ```rust pub fn decode_etc2_rgb_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### Decode BC1A block signature Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc1a_block.html Function signature for decoding a BC1A block into a mutable output buffer. ```rust pub fn decode_bc1a_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### Function: decode_bc1 Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc1.html Decodes a BC1 encoded texture into an image buffer. ```APIDOC ## decode_bc1 ### Description Decodes a bc1 encoded texture into an image. ### Parameters - **data** (&[u8]) - Required - The BC1 encoded texture data. - **width** (usize) - Required - The width of the texture. - **height** (usize) - Required - The height of the texture. - **image** (&mut [u32]) - Required - A mutable slice to store the decoded image data. ### Response - **Result** (Result<(), &'static str>) - Returns Ok(()) on success, or an error message string on failure. ``` -------------------------------- ### Decode ATC RGB4 block signature Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_atc_rgb4_block.html Function signature for decoding an ATC RGB4 block into a buffer of 32-bit integers. ```rust pub fn decode_atc_rgb4_block(data: &[u8], outbuf: &mut [u32]) ``` -------------------------------- ### Decode BC2 Texture Source: https://docs.rs/texture2ddecoder/0.1.2/texture2ddecoder/fn.decode_bc2.html Decodes a BC2 encoded texture into an image. Requires input data, dimensions, and a mutable image buffer. ```rust pub fn decode_bc2( data: &[u8], width: usize, height: usize, image: &mut [u32], ) -> Result<(), &'static str> ```