rewrite image internals to support any kind of color matrix

png-branch
an 2019-02-09 14:04:27 -05:00
parent dcc80def5f
commit 77bcbcd78d
5 changed files with 447 additions and 330 deletions

View File

@ -1,75 +1,207 @@
//! Image and color representations.
use std::ops::{Index, IndexMut};
use crate::durandal::traits::*;
use std::io;
/// RGBA8 color.
#[derive(Clone, Debug, PartialEq)]
pub struct Color
/// Creates a RGB8 color from a R5G5B5 format color.
pub fn r5g5b5_to_rgb8(rgb: u16) -> Color8
{
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
let r = rgb >> 10 & 0x1f;
let g = rgb >> 5 & 0x1f;
let b = rgb & 0x1f;
Color8::new((r << 3 | r >> 2) as u8,
(g << 3 | g >> 2) as u8,
(b << 3 | b >> 2) as u8)
}
/// Image with width and height.
pub struct Image
/// Creates a RGB16 color from a R5G5B5 format color.
pub fn r5g5b5_to_rgb16(rgb: u16) -> Color16
{
w: usize,
h: usize,
pub cr: Vec<Color>,
let r = rgb >> 10 & 0x1f;
let g = rgb >> 5 & 0x1f;
let b = rgb & 0x1f;
Color16::new(r << 3 | r >> 2, g << 11, b << 11)
}
impl Color
/// Creates a RGB16 color from a RGB8 format color.
pub fn rgb8_to_rgb16(r: u8, g: u8, b: u8) -> Color16
{
/// Converts a R5G5B5 format color to RGBA8.
pub fn from_r5g5b5(rgb: u16) -> Color
Color16::new(r as (u16) << 8, g as (u16) << 8, b as (u16) << 8)
}
/// Writes a PPM file from an image.
pub fn write_ppm<T>(out: &mut impl io::Write, im: &T) -> io::Result<()>
where T: Image
{
write!(out, "P3\n{} {}\n{}\n", im.w(), im.h(), T::Output::MAX)?;
for y in 0..im.h() {
for x in 0..im.w() {
let cr = im.cr_at(x, y);
write!(out, "{} {} {} ", cr.r(), cr.g(), cr.b())?;
}
}
Ok(())
}
pub trait Image
{
type Output: Color;
fn w(&self) -> usize;
fn h(&self) -> usize;
fn cr_at(&self, x: usize, y: usize) -> &Self::Output;
}
pub trait Color
{
type Output: PrimInt;
const MAX: usize;
fn r(&self) -> Self::Output;
fn g(&self) -> Self::Output;
fn b(&self) -> Self::Output;
}
impl Image16
{
/// Creates a new Image16.
pub fn new(w: usize, h: usize) -> Image16
{
let r = rgb >> 10 & 0x1f;
let g = rgb >> 5 & 0x1f;
let b = rgb & 0x1f;
Color{r: (r << 3 | r >> 2) as u8,
g: (g << 3 | g >> 2) as u8,
b: (b << 3 | b >> 2) as u8,
a: 255}
Image16{w, h, cr: Vec::with_capacity(w * h)}
}
}
impl Image
impl Image for Image16
{
/// Creates a new Image structure.
pub fn new(w: usize, h: usize) -> Image
{
Image{w, h, cr: Vec::with_capacity(w * h)}
}
type Output = Color16;
pub fn w(&self) -> usize
fn w(&self) -> usize
{
self.w
}
pub fn h(&self) -> usize
fn h(&self) -> usize
{
self.h
}
}
impl Index<(usize, usize)> for Image
{
type Output = Color;
fn index(&self, (x, y): (usize, usize)) -> &Color
fn cr_at(&self, x: usize, y: usize) -> &Color16
{
&self.cr[x + y * self.w]
}
}
impl IndexMut<(usize, usize)> for Image
impl Image8
{
fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut Color
/// Creates a new Image8.
pub fn new(w: usize, h: usize) -> Image8
{
&mut self.cr[x + y * self.w]
Image8{w, h, cr: Vec::with_capacity(w * h)}
}
}
impl Image for Image8
{
type Output = Color8;
fn w(&self) -> usize
{
self.w
}
fn h(&self) -> usize
{
self.h
}
fn cr_at(&self, x: usize, y: usize) -> &Color8
{
&self.cr[x + y * self.w]
}
}
impl Color16
{
pub const fn new(r: u16, g: u16, b: u16) -> Color16
{
Color16(r, g, b)
}
}
impl Color for Color16
{
type Output = u16;
const MAX: usize = u16::max_value() as usize;
fn r(&self) -> u16
{
self.0
}
fn g(&self) -> u16
{
self.1
}
fn b(&self) -> u16
{
self.2
}
}
impl Color8
{
pub const fn new(r: u8, g: u8, b: u8) -> Color8
{
Color8(r, g, b)
}
}
impl Color for Color8
{
type Output = u8;
const MAX: usize = u8::max_value() as usize;
fn r(&self) -> u8
{
self.0
}
fn g(&self) -> u8
{
self.1
}
fn b(&self) -> u8
{
self.2
}
}
/// A RGB16 color.
#[derive(Clone, Debug, PartialEq)]
pub struct Color16(u16, u16, u16);
/// A RGB8 color.
#[derive(Clone, Debug, PartialEq)]
pub struct Color8(u8, u8, u8);
/// RGB16 image.
pub struct Image16
{
w: usize,
h: usize,
pub cr: Vec<Color16>,
}
/// RGB16 image.
pub struct Image8
{
w: usize,
h: usize,
pub cr: Vec<Color8>,
}
// EOF

View File

@ -1,32 +1,17 @@
use maraiah::{durandal::{bin::*, chunk::*, err::*, image::Image, text::*},
marathon::{machdr, map, pict, term, wad}};
use maraiah::{durandal::{bin::*, chunk::*, err::*, image::*, text::*},
marathon::{machdr, map, pict, shp, term, wad}};
use std::{env, fs,
io::{self, Write}};
fn write_ppm(fname: &str, im: &Image) -> io::Result<()>
{
let out = fs::File::create(fname)?;
let mut out = io::BufWriter::new(out);
write!(&mut out, "P3\n{} {}\n255\n", im.w(), im.h())?;
for y in 0..im.h() {
for x in 0..im.w() {
let cr = &im[(x, y)];
write!(&mut out, "{} {} {} ", cr.r, cr.g, cr.b)?;
}
}
Ok(())
}
fn read_chunk(cid: &Ident, cnk: &[u8], eid: u16) -> ResultS<()>
{
match cid {
b"PICT" => {
let im = pict::load_pict(cnk)?;
println!("entry {} has PICT {}x{}", eid, im.w(), im.h());
write_ppm(&format!("out/{}.ppm", eid), &im)?;
let out = fs::File::create(&format!("out/{}.ppm", eid))?;
let mut out = io::BufWriter::new(out);
write_ppm(&mut out, &im)?;
}
b"Minf" => {
let minf = map::Minf::chunk(cnk)?;

View File

@ -10,11 +10,11 @@ const PACK_RLE16: u16 = 3;
const PACK_RLE32: u16 = 4;
/// Process a CopyBits operation.
pub fn read_bitmap_area(mut im: Image,
pub fn read_bitmap_area(mut im: Image8,
b: &[u8],
packed: bool,
clip: bool)
-> ResultS<Image>
-> ResultS<Image8>
{
let mut p = if !packed {4} else {0};
@ -103,7 +103,7 @@ pub fn read_bitmap_area(mut im: Image,
// uncompressed R5G5B5
for _ in 0..h {
for _ in 0..w {
im.cr.push(Color::from_r5g5b5(b.c_u16b((p, p += 2).0)?));
im.cr.push(r5g5b5_to_rgb8(b.c_u16b((p, p += 2).0)?));
}
}
@ -116,7 +116,7 @@ pub fn read_bitmap_area(mut im: Image,
p += pp;
for x in 0..w {
im.cr.push(Color::from_r5g5b5(d.c_u16b(x * 2)?));
im.cr.push(r5g5b5_to_rgb8(d.c_u16b(x * 2)?));
}
}
@ -135,7 +135,7 @@ pub fn read_bitmap_area(mut im: Image,
}
let (r, g, b) = (b[p], b[p + 1], b[p + 2]);
p += 3;
im.cr.push(Color{r, g, b, a: 255});
im.cr.push(Color8::new(r, g, b));
}
}
@ -150,7 +150,7 @@ pub fn read_bitmap_area(mut im: Image,
for x in 0..w {
let (r, g, b) = (d[x + w * 0], d[x + w * 1], d[x + w * 2]);
im.cr.push(Color{r, g, b, a: 255});
im.cr.push(Color8::new(r, g, b));
}
}
@ -164,20 +164,20 @@ pub fn read_bitmap_area(mut im: Image,
}
/// Process a CompressedQuickTime operation.
pub fn read_quicktime_c(_im: Image, _b: &[u8]) -> ResultS<Image>
pub fn read_quicktime_c(_im: Image8, _b: &[u8]) -> ResultS<Image8>
{
unimplemented!()
}
/// Load a PICT image.
pub fn load_pict(b: &[u8]) -> ResultS<Image>
pub fn load_pict(b: &[u8]) -> ResultS<Image8>
{
// size = b.c_u16b(0)?;
// top = b.c_u16b(2)?;
// left = b.c_u16b(4)?;
let h = b.c_u16b(6)? as usize;
let w = b.c_u16b(8)? as usize;
let im = Image::new(w, h);
let im = Image8::new(w, h);
let mut p = 10; // size of header
@ -268,14 +268,14 @@ pub fn load_pict(b: &[u8]) -> ResultS<Image>
}
/// Read a colorTable structure.
pub fn get_clut(b: &[u8]) -> ResultS<(Vec<Color>, usize)>
pub fn get_clut(b: &[u8]) -> ResultS<(Vec<Color8>, usize)>
{
// sed = b.c_u32b(0)?;
let dev = b.c_u16b(4)? & 0x8000 != 0;
let num = b.c_u16b(6)? as usize + 1;
let mut p = 8;
let mut clut = vec![Color{r: 0, g: 0, b: 0, a: 0}; num];
let mut clut = vec![Color8::new(0, 0, 0); num];
for i in 0..num {
// with device mapping, we ignore the index entirely
@ -288,7 +288,7 @@ pub fn get_clut(b: &[u8]) -> ResultS<(Vec<Color>, usize)>
return Err(err_msg("bad clut index"));
}
clut[n] = Color{r, g, b, a: 255};
clut[n] = Color8::new(r, g, b);
p += 8;
}

View File

@ -1,258 +1,258 @@
[
Color{r: 255, g: 255, b: 255, a: 255},
Color{r: 7, g: 9, b: 19, a: 255},
Color{r: 7, g: 18, b: 42, a: 255},
Color{r: 61, g: 66, b: 20, a: 255},
Color{r: 39, g: 12, b: 18, a: 255},
Color{r: 28, g: 35, b: 47, a: 255},
Color{r: 52, g: 52, b: 62, a: 255},
Color{r: 14, g: 5, b: 6, a: 255},
Color{r: 48, g: 61, b: 79, a: 255},
Color{r: 44, g: 21, b: 32, a: 255},
Color{r: 220, g: 220, b: 1, a: 255},
Color{r: 16, g: 19, b: 28, a: 255},
Color{r: 29, g: 41, b: 59, a: 255},
Color{r: 70, g: 82, b: 94, a: 255},
Color{r: 240, g: 241, b: 242, a: 255},
Color{r: 138, g: 141, b: 149, a: 255},
Color{r: 211, g: 212, b: 213, a: 255},
Color{r: 130, g: 129, b: 132, a: 255},
Color{r: 73, g: 74, b: 82, a: 255},
Color{r: 94, g: 97, b: 102, a: 255},
Color{r: 28, g: 23, b: 40, a: 255},
Color{r: 72, g: 52, b: 61, a: 255},
Color{r: 149, g: 151, b: 156, a: 255},
Color{r: 85, g: 83, b: 2, a: 255},
Color{r: 111, g: 111, b: 3, a: 255},
Color{r: 224, g: 225, b: 225, a: 255},
Color{r: 52, g: 26, b: 39, a: 255},
Color{r: 57, g: 18, b: 19, a: 255},
Color{r: 97, g: 98, b: 3, a: 255},
Color{r: 23, g: 10, b: 17, a: 255},
Color{r: 137, g: 137, b: 1, a: 255},
Color{r: 56, g: 55, b: 1, a: 255},
Color{r: 194, g: 193, b: 3, a: 255},
Color{r: 160, g: 160, b: 160, a: 255},
Color{r: 173, g: 172, b: 11, a: 255},
Color{r: 151, g: 155, b: 24, a: 255},
Color{r: 195, g: 193, b: 194, a: 255},
Color{r: 41, g: 49, b: 73, a: 255},
Color{r: 202, g: 203, b: 205, a: 255},
Color{r: 137, g: 126, b: 21, a: 255},
Color{r: 123, g: 122, b: 17, a: 255},
Color{r: 71, g: 75, b: 28, a: 255},
Color{r: 66, g: 63, b: 64, a: 255},
Color{r: 30, g: 30, b: 6, a: 255},
Color{r: 166, g: 166, b: 6, a: 255},
Color{r: 64, g: 39, b: 48, a: 255},
Color{r: 46, g: 33, b: 41, a: 255},
Color{r: 56, g: 37, b: 77, a: 255},
Color{r: 50, g: 41, b: 51, a: 255},
Color{r: 111, g: 112, b: 116, a: 255},
Color{r: 110, g: 117, b: 63, a: 255},
Color{r: 72, g: 25, b: 29, a: 255},
Color{r: 98, g: 105, b: 85, a: 255},
Color{r: 71, g: 60, b: 5, a: 255},
Color{r: 185, g: 183, b: 6, a: 255},
Color{r: 31, g: 15, b: 24, a: 255},
Color{r: 150, g: 154, b: 48, a: 255},
Color{r: 45, g: 41, b: 7, a: 255},
Color{r: 84, g: 92, b: 103, a: 255},
Color{r: 124, g: 129, b: 26, a: 255},
Color{r: 35, g: 29, b: 61, a: 255},
Color{r: 57, g: 70, b: 87, a: 255},
Color{r: 116, g: 119, b: 130, a: 255},
Color{r: 51, g: 45, b: 26, a: 255},
Color{r: 69, g: 62, b: 95, a: 255},
Color{r: 86, g: 90, b: 43, a: 255},
Color{r: 125, g: 119, b: 5, a: 255},
Color{r: 95, g: 99, b: 25, a: 255},
Color{r: 135, g: 135, b: 139, a: 255},
Color{r: 54, g: 61, b: 34, a: 255},
Color{r: 66, g: 71, b: 36, a: 255},
Color{r: 144, g: 145, b: 12, a: 255},
Color{r: 87, g: 71, b: 23, a: 255},
Color{r: 163, g: 168, b: 35, a: 255},
Color{r: 206, g: 207, b: 3, a: 255},
Color{r: 186, g: 189, b: 23, a: 255},
Color{r: 97, g: 96, b: 49, a: 255},
Color{r: 29, g: 42, b: 32, a: 255},
Color{r: 136, g: 141, b: 36, a: 255},
Color{r: 96, g: 104, b: 115, a: 255},
Color{r: 110, g: 115, b: 26, a: 255},
Color{r: 113, g: 81, b: 82, a: 255},
Color{r: 88, g: 71, b: 71, a: 255},
Color{r: 83, g: 46, b: 47, a: 255},
Color{r: 87, g: 89, b: 15, a: 255},
Color{r: 172, g: 176, b: 181, a: 255},
Color{r: 91, g: 77, b: 84, a: 255},
Color{r: 231, g: 232, b: 235, a: 255},
Color{r: 255, g: 127, b: 255, a: 255},
Color{r: 4, g: 3, b: 4, a: 255},
Color{r: 4, g: 9, b: 21, a: 255},
Color{r: 1, g: 4, b: 10, a: 255},
Color{r: 1, g: 2, b: 3, a: 255},
Color{r: 141, g: 144, b: 16, a: 255},
Color{r: 1, g: 0, b: 0, a: 255},
Color{r: 25, g: 30, b: 40, a: 255},
Color{r: 14, g: 17, b: 27, a: 255},
Color{r: 152, g: 155, b: 162, a: 255},
Color{r: 0, g: 3, b: 7, a: 255},
Color{r: 27, g: 33, b: 43, a: 255},
Color{r: 4, g: 4, b: 7, a: 255},
Color{r: 5, g: 1, b: 2, a: 255},
Color{r: 3, g: 12, b: 32, a: 255},
Color{r: 0, g: 0, b: 1, a: 255},
Color{r: 17, g: 17, b: 19, a: 255},
Color{r: 69, g: 66, b: 71, a: 255},
Color{r: 0, g: 1, b: 5, a: 255},
Color{r: 6, g: 7, b: 15, a: 255},
Color{r: 1, g: 0, b: 2, a: 255},
Color{r: 3, g: 2, b: 8, a: 255},
Color{r: 0, g: 1, b: 1, a: 255},
Color{r: 20, g: 25, b: 36, a: 255},
Color{r: 24, g: 7, b: 10, a: 255},
Color{r: 7, g: 8, b: 18, a: 255},
Color{r: 32, g: 46, b: 65, a: 255},
Color{r: 17, g: 15, b: 29, a: 255},
Color{r: 10, g: 12, b: 23, a: 255},
Color{r: 6, g: 10, b: 23, a: 255},
Color{r: 23, g: 16, b: 25, a: 255},
Color{r: 0, g: 1, b: 2, a: 255},
Color{r: 1, g: 6, b: 15, a: 255},
Color{r: 3, g: 4, b: 12, a: 255},
Color{r: 1, g: 1, b: 2, a: 255},
Color{r: 66, g: 75, b: 87, a: 255},
Color{r: 161, g: 163, b: 170, a: 255},
Color{r: 20, g: 6, b: 6, a: 255},
Color{r: 1, g: 2, b: 8, a: 255},
Color{r: 2, g: 4, b: 8, a: 255},
Color{r: 6, g: 7, b: 16, a: 255},
Color{r: 2, g: 5, b: 13, a: 255},
Color{r: 1, g: 13, b: 32, a: 255},
Color{r: 17, g: 22, b: 35, a: 255},
Color{r: 0, g: 0, b: 4, a: 255},
Color{r: 39, g: 24, b: 37, a: 255},
Color{r: 24, g: 35, b: 56, a: 255},
Color{r: 5, g: 4, b: 11, a: 255},
Color{r: 5, g: 6, b: 15, a: 255},
Color{r: 5, g: 10, b: 27, a: 255},
Color{r: 2, g: 5, b: 10, a: 255},
Color{r: 37, g: 50, b: 69, a: 255},
Color{r: 1, g: 4, b: 14, a: 255},
Color{r: 1, g: 1, b: 1, a: 255},
Color{r: 16, g: 24, b: 48, a: 255},
Color{r: 2, g: 1, b: 4, a: 255},
Color{r: 14, g: 19, b: 40, a: 255},
Color{r: 0, g: 5, b: 12, a: 255},
Color{r: 0, g: 1, b: 4, a: 255},
Color{r: 7, g: 3, b: 3, a: 255},
Color{r: 41, g: 55, b: 71, a: 255},
Color{r: 2, g: 0, b: 0, a: 255},
Color{r: 35, g: 11, b: 11, a: 255},
Color{r: 11, g: 14, b: 27, a: 255},
Color{r: 0, g: 1, b: 3, a: 255},
Color{r: 1, g: 13, b: 30, a: 255},
Color{r: 6, g: 18, b: 39, a: 255},
Color{r: 196, g: 196, b: 7, a: 255},
Color{r: 1, g: 1, b: 7, a: 255},
Color{r: 2, g: 11, b: 28, a: 255},
Color{r: 3, g: 1, b: 3, a: 255},
Color{r: 5, g: 17, b: 39, a: 255},
Color{r: 4, g: 6, b: 14, a: 255},
Color{r: 19, g: 17, b: 36, a: 255},
Color{r: 2, g: 7, b: 15, a: 255},
Color{r: 0, g: 3, b: 8, a: 255},
Color{r: 13, g: 10, b: 19, a: 255},
Color{r: 143, g: 149, b: 157, a: 255},
Color{r: 10, g: 4, b: 5, a: 255},
Color{r: 8, g: 6, b: 14, a: 255},
Color{r: 32, g: 21, b: 35, a: 255},
Color{r: 17, g: 7, b: 13, a: 255},
Color{r: 45, g: 56, b: 79, a: 255},
Color{r: 3, g: 10, b: 25, a: 255},
Color{r: 2, g: 3, b: 6, a: 255},
Color{r: 34, g: 42, b: 68, a: 255},
Color{r: 2, g: 15, b: 34, a: 255},
Color{r: 10, g: 21, b: 43, a: 255},
Color{r: 0, g: 2, b: 5, a: 255},
Color{r: 15, g: 17, b: 27, a: 255},
Color{r: 7, g: 3, b: 6, a: 255},
Color{r: 2, g: 10, b: 23, a: 255},
Color{r: 22, g: 19, b: 32, a: 255},
Color{r: 58, g: 59, b: 7, a: 255},
Color{r: 8, g: 3, b: 9, a: 255},
Color{r: 6, g: 3, b: 8, a: 255},
Color{r: 4, g: 14, b: 30, a: 255},
Color{r: 2, g: 2, b: 4, a: 255},
Color{r: 0, g: 3, b: 9, a: 255},
Color{r: 51, g: 64, b: 82, a: 255},
Color{r: 2, g: 3, b: 10, a: 255},
Color{r: 4, g: 12, b: 29, a: 255},
Color{r: 18, g: 22, b: 31, a: 255},
Color{r: 2, g: 4, b: 13, a: 255},
Color{r: 192, g: 192, b: 193, a: 255},
Color{r: 3, g: 0, b: 0, a: 255},
Color{r: 5, g: 6, b: 14, a: 255},
Color{r: 2, g: 2, b: 9, a: 255},
Color{r: 51, g: 63, b: 74, a: 255},
Color{r: 13, g: 16, b: 33, a: 255},
Color{r: 5, g: 8, b: 19, a: 255},
Color{r: 23, g: 27, b: 38, a: 255},
Color{r: 23, g: 28, b: 54, a: 255},
Color{r: 1, g: 4, b: 11, a: 255},
Color{r: 33, g: 40, b: 49, a: 255},
Color{r: 48, g: 59, b: 71, a: 255},
Color{r: 64, g: 26, b: 36, a: 255},
Color{r: 116, g: 121, b: 19, a: 255},
Color{r: 13, g: 16, b: 26, a: 255},
Color{r: 3, g: 6, b: 11, a: 255},
Color{r: 5, g: 2, b: 2, a: 255},
Color{r: 7, g: 9, b: 18, a: 255},
Color{r: 11, g: 7, b: 16, a: 255},
Color{r: 0, g: 2, b: 6, a: 255},
Color{r: 3, g: 3, b: 3, a: 255},
Color{r: 2, g: 6, b: 16, a: 255},
Color{r: 13, g: 12, b: 13, a: 255},
Color{r: 6, g: 8, b: 18, a: 255},
Color{r: 1, g: 11, b: 25, a: 255},
Color{r: 18, g: 13, b: 24, a: 255},
Color{r: 1, g: 0, b: 1, a: 255},
Color{r: 0, g: 0, b: 3, a: 255},
Color{r: 20, g: 27, b: 41, a: 255},
Color{r: 7, g: 15, b: 35, a: 255},
Color{r: 129, g: 135, b: 145, a: 255},
Color{r: 1, g: 11, b: 26, a: 255},
Color{r: 9, g: 10, b: 20, a: 255},
Color{r: 1, g: 2, b: 4, a: 255},
Color{r: 5, g: 5, b: 15, a: 255},
Color{r: 8, g: 9, b: 9, a: 255},
Color{r: 16, g: 6, b: 10, a: 255},
Color{r: 7, g: 6, b: 17, a: 255},
Color{r: 33, g: 41, b: 28, a: 255},
Color{r: 15, g: 19, b: 31, a: 255},
Color{r: 2, g: 1, b: 1, a: 255},
Color{r: 13, g: 13, b: 24, a: 255},
Color{r: 59, g: 70, b: 81, a: 255},
Color{r: 33, g: 33, b: 39, a: 255},
Color{r: 1, g: 8, b: 18, a: 255},
Color{r: 8, g: 10, b: 20, a: 255},
Color{r: 3, g: 5, b: 16, a: 255},
Color{r: 114, g: 116, b: 10, a: 255},
Color{r: 23, g: 32, b: 47, a: 255},
Color{r: 147, g: 145, b: 150, a: 255},
Color{r: 2, g: 8, b: 20, a: 255},
Color{r: 1, g: 5, b: 11, a: 255},
Color{r: 42, g: 52, b: 63, a: 255},
Color{r: 13, g: 6, b: 11, a: 255},
Color{r: 79, g: 83, b: 93, a: 255},
Color{r: 195, g: 195, b: 198, a: 255},
Color{r: 66, g: 21, b: 24, a: 255},
Color{r: 7, g: 13, b: 29, a: 255},
Color{r: 11, g: 14, b: 23, a: 255},
Color{r: 12, g: 5, b: 8, a: 255},
Color{r: 39, g: 47, b: 58, a: 255},
Color{r: 1, g: 9, b: 22, a: 255},
Color{r: 7, g: 6, b: 10, a: 255},
Color{r: 0, g: 0, b: 0, a: 255}
Color8::new(255, 255, 255),
Color8::new(7, 9, 19 ),
Color8::new(7, 18, 42 ),
Color8::new(61, 66, 20 ),
Color8::new(39, 12, 18 ),
Color8::new(28, 35, 47 ),
Color8::new(52, 52, 62 ),
Color8::new(14, 5, 6 ),
Color8::new(48, 61, 79 ),
Color8::new(44, 21, 32 ),
Color8::new(220, 220, 1 ),
Color8::new(16, 19, 28 ),
Color8::new(29, 41, 59 ),
Color8::new(70, 82, 94 ),
Color8::new(240, 241, 242),
Color8::new(138, 141, 149),
Color8::new(211, 212, 213),
Color8::new(130, 129, 132),
Color8::new(73, 74, 82 ),
Color8::new(94, 97, 102),
Color8::new(28, 23, 40 ),
Color8::new(72, 52, 61 ),
Color8::new(149, 151, 156),
Color8::new(85, 83, 2 ),
Color8::new(111, 111, 3 ),
Color8::new(224, 225, 225),
Color8::new(52, 26, 39 ),
Color8::new(57, 18, 19 ),
Color8::new(97, 98, 3 ),
Color8::new(23, 10, 17 ),
Color8::new(137, 137, 1 ),
Color8::new(56, 55, 1 ),
Color8::new(194, 193, 3 ),
Color8::new(160, 160, 160),
Color8::new(173, 172, 11 ),
Color8::new(151, 155, 24 ),
Color8::new(195, 193, 194),
Color8::new(41, 49, 73 ),
Color8::new(202, 203, 205),
Color8::new(137, 126, 21 ),
Color8::new(123, 122, 17 ),
Color8::new(71, 75, 28 ),
Color8::new(66, 63, 64 ),
Color8::new(30, 30, 6 ),
Color8::new(166, 166, 6 ),
Color8::new(64, 39, 48 ),
Color8::new(46, 33, 41 ),
Color8::new(56, 37, 77 ),
Color8::new(50, 41, 51 ),
Color8::new(111, 112, 116),
Color8::new(110, 117, 63 ),
Color8::new(72, 25, 29 ),
Color8::new(98, 105, 85 ),
Color8::new(71, 60, 5 ),
Color8::new(185, 183, 6 ),
Color8::new(31, 15, 24 ),
Color8::new(150, 154, 48 ),
Color8::new(45, 41, 7 ),
Color8::new(84, 92, 103),
Color8::new(124, 129, 26 ),
Color8::new(35, 29, 61 ),
Color8::new(57, 70, 87 ),
Color8::new(116, 119, 130),
Color8::new(51, 45, 26 ),
Color8::new(69, 62, 95 ),
Color8::new(86, 90, 43 ),
Color8::new(125, 119, 5 ),
Color8::new(95, 99, 25 ),
Color8::new(135, 135, 139),
Color8::new(54, 61, 34 ),
Color8::new(66, 71, 36 ),
Color8::new(144, 145, 12 ),
Color8::new(87, 71, 23 ),
Color8::new(163, 168, 35 ),
Color8::new(206, 207, 3 ),
Color8::new(186, 189, 23 ),
Color8::new(97, 96, 49 ),
Color8::new(29, 42, 32 ),
Color8::new(136, 141, 36 ),
Color8::new(96, 104, 115),
Color8::new(110, 115, 26 ),
Color8::new(113, 81, 82 ),
Color8::new(88, 71, 71 ),
Color8::new(83, 46, 47 ),
Color8::new(87, 89, 15 ),
Color8::new(172, 176, 181),
Color8::new(91, 77, 84 ),
Color8::new(231, 232, 235),
Color8::new(255, 127, 255),
Color8::new(4, 3, 4 ),
Color8::new(4, 9, 21 ),
Color8::new(1, 4, 10 ),
Color8::new(1, 2, 3 ),
Color8::new(141, 144, 16 ),
Color8::new(1, 0, 0 ),
Color8::new(25, 30, 40 ),
Color8::new(14, 17, 27 ),
Color8::new(152, 155, 162),
Color8::new(0, 3, 7 ),
Color8::new(27, 33, 43 ),
Color8::new(4, 4, 7 ),
Color8::new(5, 1, 2 ),
Color8::new(3, 12, 32 ),
Color8::new(0, 0, 1 ),
Color8::new(17, 17, 19 ),
Color8::new(69, 66, 71 ),
Color8::new(0, 1, 5 ),
Color8::new(6, 7, 15 ),
Color8::new(1, 0, 2 ),
Color8::new(3, 2, 8 ),
Color8::new(0, 1, 1 ),
Color8::new(20, 25, 36 ),
Color8::new(24, 7, 10 ),
Color8::new(7, 8, 18 ),
Color8::new(32, 46, 65 ),
Color8::new(17, 15, 29 ),
Color8::new(10, 12, 23 ),
Color8::new(6, 10, 23 ),
Color8::new(23, 16, 25 ),
Color8::new(0, 1, 2 ),
Color8::new(1, 6, 15 ),
Color8::new(3, 4, 12 ),
Color8::new(1, 1, 2 ),
Color8::new(66, 75, 87 ),
Color8::new(161, 163, 170),
Color8::new(20, 6, 6 ),
Color8::new(1, 2, 8 ),
Color8::new(2, 4, 8 ),
Color8::new(6, 7, 16 ),
Color8::new(2, 5, 13 ),
Color8::new(1, 13, 32 ),
Color8::new(17, 22, 35 ),
Color8::new(0, 0, 4 ),
Color8::new(39, 24, 37 ),
Color8::new(24, 35, 56 ),
Color8::new(5, 4, 11 ),
Color8::new(5, 6, 15 ),
Color8::new(5, 10, 27 ),
Color8::new(2, 5, 10 ),
Color8::new(37, 50, 69 ),
Color8::new(1, 4, 14 ),
Color8::new(1, 1, 1 ),
Color8::new(16, 24, 48 ),
Color8::new(2, 1, 4 ),
Color8::new(14, 19, 40 ),
Color8::new(0, 5, 12 ),
Color8::new(0, 1, 4 ),
Color8::new(7, 3, 3 ),
Color8::new(41, 55, 71 ),
Color8::new(2, 0, 0 ),
Color8::new(35, 11, 11 ),
Color8::new(11, 14, 27 ),
Color8::new(0, 1, 3 ),
Color8::new(1, 13, 30 ),
Color8::new(6, 18, 39 ),
Color8::new(196, 196, 7 ),
Color8::new(1, 1, 7 ),
Color8::new(2, 11, 28 ),
Color8::new(3, 1, 3 ),
Color8::new(5, 17, 39 ),
Color8::new(4, 6, 14 ),
Color8::new(19, 17, 36 ),
Color8::new(2, 7, 15 ),
Color8::new(0, 3, 8 ),
Color8::new(13, 10, 19 ),
Color8::new(143, 149, 157),
Color8::new(10, 4, 5 ),
Color8::new(8, 6, 14 ),
Color8::new(32, 21, 35 ),
Color8::new(17, 7, 13 ),
Color8::new(45, 56, 79 ),
Color8::new(3, 10, 25 ),
Color8::new(2, 3, 6 ),
Color8::new(34, 42, 68 ),
Color8::new(2, 15, 34 ),
Color8::new(10, 21, 43 ),
Color8::new(0, 2, 5 ),
Color8::new(15, 17, 27 ),
Color8::new(7, 3, 6 ),
Color8::new(2, 10, 23 ),
Color8::new(22, 19, 32 ),
Color8::new(58, 59, 7 ),
Color8::new(8, 3, 9 ),
Color8::new(6, 3, 8 ),
Color8::new(4, 14, 30 ),
Color8::new(2, 2, 4 ),
Color8::new(0, 3, 9 ),
Color8::new(51, 64, 82 ),
Color8::new(2, 3, 10 ),
Color8::new(4, 12, 29 ),
Color8::new(18, 22, 31 ),
Color8::new(2, 4, 13 ),
Color8::new(192, 192, 193),
Color8::new(3, 0, 0 ),
Color8::new(5, 6, 14 ),
Color8::new(2, 2, 9 ),
Color8::new(51, 63, 74 ),
Color8::new(13, 16, 33 ),
Color8::new(5, 8, 19 ),
Color8::new(23, 27, 38 ),
Color8::new(23, 28, 54 ),
Color8::new(1, 4, 11 ),
Color8::new(33, 40, 49 ),
Color8::new(48, 59, 71 ),
Color8::new(64, 26, 36 ),
Color8::new(116, 121, 19 ),
Color8::new(13, 16, 26 ),
Color8::new(3, 6, 11 ),
Color8::new(5, 2, 2 ),
Color8::new(7, 9, 18 ),
Color8::new(11, 7, 16 ),
Color8::new(0, 2, 6 ),
Color8::new(3, 3, 3 ),
Color8::new(2, 6, 16 ),
Color8::new(13, 12, 13 ),
Color8::new(6, 8, 18 ),
Color8::new(1, 11, 25 ),
Color8::new(18, 13, 24 ),
Color8::new(1, 0, 1 ),
Color8::new(0, 0, 3 ),
Color8::new(20, 27, 41 ),
Color8::new(7, 15, 35 ),
Color8::new(129, 135, 145),
Color8::new(1, 11, 26 ),
Color8::new(9, 10, 20 ),
Color8::new(1, 2, 4 ),
Color8::new(5, 5, 15 ),
Color8::new(8, 9, 9 ),
Color8::new(16, 6, 10 ),
Color8::new(7, 6, 17 ),
Color8::new(33, 41, 28 ),
Color8::new(15, 19, 31 ),
Color8::new(2, 1, 1 ),
Color8::new(13, 13, 24 ),
Color8::new(59, 70, 81 ),
Color8::new(33, 33, 39 ),
Color8::new(1, 8, 18 ),
Color8::new(8, 10, 20 ),
Color8::new(3, 5, 16 ),
Color8::new(114, 116, 10 ),
Color8::new(23, 32, 47 ),
Color8::new(147, 145, 150),
Color8::new(2, 8, 20 ),
Color8::new(1, 5, 11 ),
Color8::new(42, 52, 63 ),
Color8::new(13, 6, 11 ),
Color8::new(79, 83, 93 ),
Color8::new(195, 195, 198),
Color8::new(66, 21, 24 ),
Color8::new(7, 13, 29 ),
Color8::new(11, 14, 23 ),
Color8::new(12, 5, 8 ),
Color8::new(39, 47, 58 ),
Color8::new(1, 9, 22 ),
Color8::new(7, 6, 10 ),
Color8::new(0, 0, 0 )
]

View File

@ -1,4 +1,4 @@
use maraiah::{durandal::image::Color, marathon::pict::get_clut};
use maraiah::{durandal::image::*, marathon::pict::get_clut};
#[test]
fn get_clut_must_process_this()
@ -7,6 +7,6 @@ fn get_clut_must_process_this()
}
const INPUT: &'static [u8] = include_bytes!("clut.in");
const OUTPUT: [Color; 256] = include!("clut.out");
const OUTPUT: [Color8; 256] = include!("clut.out");
// EOF