pub struct Palette { /* private fields */ }
Expand description
A controller for a palette in an indexed bitmap pixel format.
Implementations§
source§impl Palette
impl Palette
sourcepub fn new(num_colors: usize) -> Result<Self>
pub fn new(num_colors: usize) -> Result<Self>
Constructs a palette with numbers of colors.
§Errors
Returns Err
if failed to allocate the memory, or construct a palette.
sourcepub fn num_colors(&self) -> usize
pub fn num_colors(&self) -> usize
Returns the numbers of colors in the palette.
sourcepub fn set_colors(&self, colors: impl IntoIterator<Item = Rgba>)
pub fn set_colors(&self, colors: impl IntoIterator<Item = Rgba>)
Sets colors to the palette, or panics if colors
was too long than num_colors
on initialized.
§Panics
Panics if colors
was too long than num_colors
on initialized.
Trait Implementations§
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§
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