[][src]Struct cpclib::ga::Palette

pub struct Palette { /* fields omitted */ }

The palette maps one Ink for each Pen

Methods

impl Palette[src]

pub fn new() -> Palette[src]

Create a new palette. All pens are black.

pub fn empty() -> Palette[src]

Create an empty Palette. An empty palette does not contains all the inks and must make crash most of the code that has been previously written !

pub fn contains_pen(&self, pen: &Pen) -> bool[src]

Verifies if the palette contains the required pen

pub fn contains_border(&self) -> bool[src]

pub fn next_unused_pen(&self) -> Option<Pen>[src]

Provides the next unused pen if there is one

pub fn to_gate_array(&self) -> [u8; 17][src]

pub fn add_novel_inks_except_in_border(
    &mut self,
    inks: &[Ink]
) -> (usize, usize)
[src]

Add the inks if not present in empty slots of the palette as soon as it is possible. Returns the number of inks added a,d the number of inks impossible to add because of the lack of space.

pub fn inks_with_border(&self) -> Vec<Ink>[src]

Returns the list of inks contained in the palette with the border

pub fn inks(&self) -> Vec<Ink>[src]

Returns the list of inks contained in the palette without taking into account the border

pub fn pens_with_border(&self) -> Vec<Pen>[src]

Returns all the set pens (without the border)

pub fn pens(&self) -> Vec<Pen>[src]

Returns all the set pens (without the border)

pub fn get(&self, pen: &Pen) -> &Ink[src]

Get the ink of the requested pen. Pen MUST be present

pub fn get_border(&self) -> &Ink[src]

pub fn set(&mut self, pen: &Pen, ink: Ink)[src]

Change the ink of the specified pen

pub fn set_border(&mut self, ink: Ink)[src]

pub fn get_pen_for_ink(&self, expected: &Ink) -> Option<Pen>[src]

Get the pen that corresponds to the required ink. Ink 16 (border) is never tested

pub fn contains_ink(&self, expected: &Ink) -> bool[src]

Returns true if the palette contains the inks in one of its pens (except border)

pub fn to_mode3_mixed_with_mode0(&self) -> Palette[src]

Replicate the firsts 4 pens in order to manage special texture that contains both mode 0 and mode 3 patterns

Trait Implementations

impl Default for Palette[src]

fn default() -> Palette[src]

Create a new palette. Pens ink are the same than Amsdos ones.

impl Clone for Palette[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T> From<Vec<T>> for Palette where
    Ink: From<T>,
    T: Copy
[src]

impl<'_> Into<Vec<u8>> for &'_ Palette[src]

impl Into<Vec<u8>> for Palette[src]

impl Debug for Palette[src]

impl Serialize for Palette[src]

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

Auto Trait Implementations

impl Send for Palette

impl Sync for Palette

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

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