pub struct Context { /* private fields */ }
Expand description
The core context. All configuration should be done through this.
Implementations§
Source§impl Context
impl Context
Sourcepub fn with_threads(threads: usize, config: Config) -> Result<Self, Error>
pub fn with_threads(threads: usize, config: Config) -> Result<Self, Error>
Create a new context from the given config (see ConfigBuilder
for more information on this
config), and sets the number of threads that the internal encoder/decoder will use. See
Context::new
, which does the same thing but automatically guesses the correct thread count
by trying to use 8 threads but falling back to the number of cores if it is less than
8. Returns an error in the case that the config is invalid or the context could not be
allocated.
Sourcepub fn new(config: Config) -> Result<Self, Error>
pub fn new(config: Config) -> Result<Self, Error>
Create a new context from the given config (see ConfigBuilder
for more information on this
config). Returns an error in the case that the config is invalid or the context could not be
allocated.
Sourcepub fn compress<D, T, L>(
&mut self,
image: &Image<T>,
swizzle: Swizzle,
) -> Result<Vec<u8>, Error>
pub fn compress<D, T, L>( &mut self, image: &Image<T>, swizzle: Swizzle, ) -> Result<Vec<u8>, Error>
Compress the given image, returning a byte vector that can be sent to the GPU.
Sourcepub fn decompress_into<D, T, L>(
&mut self,
data: &[u8],
out: &mut Image<T>,
swizzle: Swizzle,
) -> Result<(), Error>
pub fn decompress_into<D, T, L>( &mut self, data: &[u8], out: &mut Image<T>, swizzle: Swizzle, ) -> Result<(), Error>
Decompress an image into a pre-existing buffer. The metadata (size and border padding) must
already be set and enough space must be reserved in out.data
for the output pixels (RGBA).