fn from_reg(r: u8) -> Palette {
        let mut p = Palette {
            map: [ Color::White,
                   Color::White,
                   Color::White,
                   Color::White, ]
        };

        for i in (0..p.map.len()) {
            p.map[i] = Color::from_u8((r >> (i * 2)) & 0x3)
        }

        p
    }
/// Build a palette from a register value.
///
/// Register value is 0bC3C2C1C0 where CX is the output
/// value for a given value X. So for instance
/// 0b00_01_10_11 is a palette that reverses the colors.
Build a palette from a register value.
Register value is 0bC3C2C1C0 where CX is the output
value for a given value X. So for instance
0b00_01_10_11 is a palette that reverses the colors.
Build a palette from a register value . Register value is 0bC3C2C1C0 where CX is the output value for a given value X . So for instance 0b00_01_10_11 is a palette that reverses the colors .
fn from_reg(r: u8) -> Palette {
        let mut p = Palette {
            map: [ Color::White,
                   Color::White,
                   Color::White,
                   Color::White, ]
        };
        for i in (0..p.map.len()) {
            p.map[i] = Color::from_u8((r >> (i * 2)) & 0x3)
        }
        p
    }
fn from_reg ( r : u8 ) -> Palette { let mut p = Palette { map : [ Color :: White , Color :: White , Color :: White , Color :: White , ] } ; for i in ( 0 .. p . map . len ( ) ) { p . map [ i ] = Color :: from_u8 ( ( r >> ( i * 2 ) ) & 0x3 ) } p }
Build a palette from a register value.
Build a palette from a register value .
r
u8
r
u8