3 releases

Uses old Rust 2015

0.1.2 Nov 29, 2017
0.1.1 Aug 8, 2017
0.1.0 Aug 7, 2017

#2 in #dxt

MIT license

155KB
305 lines

Decoder for crunch-compressed texture data

Build Status Crates.io

This crate provides a Rust wrapper around crunch's decompressor.

Documentation

Example

use decrunch::*;
use std::fs::File;
use std::io::Read;

let mut compressed_file = File::open("testdata/copyright_2048_compressed.dat")?;
let mut compressed_data = Vec::new();

compressed_file.read_to_end(&mut compressed_data)?;

let c_data = CrunchedData::new(&compressed_data);
let decompressed_data = match c_data.decode_level(0) {
    None => {
        panic!("Failed to decompress texture data");
    }
    Some(res) => res,
};

assert!(decompressed_data.len() > 0);

lib.rs:

Decoder for crunch-compressed texture data

This crate provides a Rust wrapper around crunch's decompressor.

Example

use decrunch::*;
use std::fs::File;
use std::io::Read;

let mut compressed_file = File::open("testdata/copyright_2048_compressed.dat")?;
let mut compressed_data = Vec::new();

compressed_file.read_to_end(&mut compressed_data)?;

let c_data = CrunchedData::new(&compressed_data);
let decompressed_data = match c_data.decode_level(0) {
    None => {
        panic!("Failed to decompress texture data");
    }
    Some(res) => res,
};

assert!(decompressed_data.len() > 0);

Dependencies