[][src]Struct crnlib::Header

pub struct Header {
    pub magic: [u8; 2],
    pub header_size: u16,
    pub header_crc16: u16,
    pub file_size: u32,
    pub data_crc16: u16,
    pub width: u16,
    pub height: u16,
    pub level_count: u8,
    pub face_count: u8,
    pub format: Format,
    pub flags: u16,
    pub reserved: u32,
    pub userdata: [u32; 2],
    pub color_endpoints: Palette,
    pub color_selectors: Palette,
    pub alpha_endpoints: Palette,
    pub alpha_selectors: Palette,
    pub table_size: u16,
    pub table_offset: u32,
    pub level_offset: Vec<u32>,
}

Fields

magic: [u8; 2]header_size: u16header_crc16: u16file_size: u32data_crc16: u16width: u16height: u16level_count: u8face_count: u8format: Formatflags: u16reserved: u32userdata: [u32; 2]color_endpoints: Palettecolor_selectors: Palettealpha_endpoints: Palettealpha_selectors: Palettetable_size: u16table_offset: u32level_offset: Vec<u32>

Implementations

impl Header[src]

pub fn parse(input: &[u8]) -> Result<Self, Error>[src]

pub fn fixed_size() -> usize[src]

pub fn crc16(init: u16, input: &[u8]) -> u16[src]

pub fn crc16_poly(init: u16, poly: u16, input: &[u8]) -> u16[src]

pub fn check_crc(&self, input: &[u8]) -> bool[src]

pub fn block_size(&self) -> usize[src]

pub fn get_level_data<'a>(
    &self,
    input: &'a [u8],
    idx: usize
) -> Option<&'a [u8]>
[src]

pub fn get_table(&self, input: &[u8]) -> Result<Tables, Error>[src]

pub fn get_color_endpoints(
    &self,
    input: &[u8]
) -> Result<Vec<(u16, u16)>, Error>
[src]

pub fn get_alpha_endpoints(&self, input: &[u8]) -> Result<Vec<(u8, u8)>, Error>[src]

pub fn get_color_selectors(&self, input: &[u8]) -> Result<Vec<[u8; 4]>, Error>[src]

pub fn get_alpha_selectors(&self, input: &[u8]) -> Result<Vec<[u8; 6]>, Error>[src]

pub fn get_level_info(&self, idx: usize) -> Option<(u16, u16)>[src]

pub fn unpack_level(
    &self,
    tables: &Tables,
    input: &[u8],
    idx: usize
) -> Result<Vec<u8>, Error>
[src]

Trait Implementations

impl Debug for Header[src]

impl Default for Header[src]

impl<'de> Deserialize<'de> for Header[src]

impl Serialize for Header[src]

Auto Trait Implementations

impl RefUnwindSafe for Header

impl Send for Header

impl Sync for Header

impl Unpin for Header

impl UnwindSafe for Header

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.