pub struct CBT {
pub header: CBTHeader,
pub frames: Vec<Vec<u8>>,
}Fields§
§header: CBTHeader§frames: Vec<Vec<u8>>Implementations§
Source§impl CBT
impl CBT
Sourcepub fn new_from_bytes(bytes: &[u8]) -> Result<CBT, CBTError>
pub fn new_from_bytes(bytes: &[u8]) -> Result<CBT, CBTError>
Creates a new CBT from the given bytes. Bytes should be the entire contents of a CBT file.
Sourcepub fn new_empty(width: u16, height: u16, with_alpha_channel: bool) -> CBT
pub fn new_empty(width: u16, height: u16, with_alpha_channel: bool) -> CBT
Creates a new CBT with no data contained and a frame count of 0. Preferably use new_with_capacity instead, to save cpu time.
Sourcepub fn new_with_capacity(
width: u16,
height: u16,
frame_count: u16,
with_alpha_channel: bool,
) -> CBT
pub fn new_with_capacity( width: u16, height: u16, frame_count: u16, with_alpha_channel: bool, ) -> CBT
Creates a new CBT with a pre-allocated frame count. Preferred over new_empty, to save cpu time.
Sourcepub fn fill_frame(&mut self, frame_index: usize, data: &[u8])
pub fn fill_frame(&mut self, frame_index: usize, data: &[u8])
Inserts the given data into the frame at the given index.
Sourcepub fn to_file_data(&self) -> Vec<u8> ⓘ
pub fn to_file_data(&self) -> Vec<u8> ⓘ
Converts the CBT struct to a byte array that would be in the CBT file format.
Sourcepub fn get_reader(&self, with_alpha_channel: bool) -> CBTReader
pub fn get_reader(&self, with_alpha_channel: bool) -> CBTReader
Returns a CBTReader that can be used to read the frames in a specific format. This should only be used if you’re too lazy to do the correct readings yourself, as it will consume a lot of memory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CBT
impl RefUnwindSafe for CBT
impl Send for CBT
impl Sync for CBT
impl Unpin for CBT
impl UnsafeUnpin for CBT
impl UnwindSafe for CBT
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more