Macro dwarf_term::rgba32[]

macro_rules! rgba32 {
    ( $ r : expr , $ g : expr , $ b : expr , $ a : expr ) => { ... };
}

Builds a u32 value from the given RGBA values.

Each channel is cast into u32, and then they're combined into a single u32 value. If inputs aren't within the range 0..=255 you'll get some unintentional output.

#[macro_use]
extern crate retro_pixel;

fn main() {
  const TRANSPARENT_BLACK: u32 = rgba32!(0, 0, 0, 0);
  const SOLID_WHITE: u32 = rgba32!(255u8, 255u16, 255u32, 255.0);
  assert_eq!(TRANSPARENT_BLACK, 0);
  assert_eq!(SOLID_WHITE, ::std::u32::MAX);
  // all other outputs depend on what endian the machine is,
  // currently only little endian is supported.
  assert_eq!(rgba32!(255, 0, 0, 0), 0x000000FF);
  assert_eq!(rgba32!(0, 255, 0, 0), 0x0000FF00);
  assert_eq!(rgba32!(0, 0, 255, 0), 0x00FF0000);
  assert_eq!(rgba32!(0, 0, 0, 255), 0xFF000000);
}