Fields
palette: Vec<[u8; 4]>
Implementations
sourceimpl Palette
impl Palette
sourcepub fn new_from_bytes<F: Read + Seek>(file: &mut F) -> Result<Palette, WanError>
pub fn new_from_bytes<F: Read + Seek>(file: &mut F) -> Result<Palette, WanError>
load the Palette. Assume the cursor it located at the palette header
sourcepub fn get(&self, id: u8, palette_id: u16) -> Option<[u8; 4]>
pub fn get(&self, id: u8, palette_id: u16) -> Option<[u8; 4]>
Return the rgba color for the given color id and palette id.
Return Option::None
if the color doesn’t exist.
Note that the alpha range from 0 to 128 normally, thought this is not an hard guarantee.
pub fn color_id(
&self,
target_color: [u8; 4],
palette_id: u16
) -> Result<usize, WanError>
pub fn write<F: Write + Seek>(&self, file: &mut F) -> Result<u64, WanError>
Trait Implementations
impl Eq for Palette
impl StructuralEq for Palette
impl StructuralPartialEq for Palette
Auto Trait Implementations
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnwindSafe for Palette
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more