目录
目录README.md

Lightweight library written in Rust for handling the Truevision TGA image format.

For more information about the TGA format, please refer to the specification.

RLE

RLE compression algorithm

Data Structure

We can’t use the struct ‘Vec’. It will spend a lot of time. So we need directly use raw pointer and make it as slice.

So that it could be accessed like an array.

struct LayPtr(Layout, *mut u8);

impl Drop for LayPtr {
   fn drop(&mut self) {
       if !self.1.is_null() {
           unsafe { alloc::dealloc(self.1, self.0) }
       }
   } 
}

pub struct ColorMap {
    pub first_index: u16,
    pub entry_count: u16,
    pub bytes_per_entry: u8,
    pub pixels: LayPtr,
}

pub struct Tga {
    pub header: TgaHeader,
    pub info: TgaInfo,
    pub data: LayPtr,
    pub map: Option<ColorMap>,
}
关于

Lightweight library written in Rust for handling the Truevision TGA image format.

49.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号