Fill Palette if needed
This commit is contained in:
parent
37adafa52e
commit
cf5cd97bcc
|
@ -4,7 +4,7 @@ use color_clut::IndexedImage;
|
||||||
use color_full16::{RgbaImage, RgbImage};
|
use color_full16::{RgbaImage, RgbImage};
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use tool_helper::{Error, Input, Output};
|
use tool_helper::{Error, Input, Output};
|
||||||
use types::{Header, PSXImageConverter};
|
use types::{Header, Color as PSXColor, PSXImageConverter};
|
||||||
|
|
||||||
mod types;
|
mod types;
|
||||||
mod color_clut;
|
mod color_clut;
|
||||||
|
@ -51,8 +51,15 @@ fn encode<T: PSXImageConverter>(image: T, clut_align: ClutAlignment, mut output:
|
||||||
|
|
||||||
tool_helper::raw::write_generic(&mut output, header)?;
|
tool_helper::raw::write_generic(&mut output, header)?;
|
||||||
if let Some(palette) = palette {
|
if let Some(palette) = palette {
|
||||||
|
let mut color_count = pal_width*pal_height;
|
||||||
for color in palette {
|
for color in palette {
|
||||||
tool_helper::raw::write_generic(&mut output, color)?;
|
tool_helper::raw::write_generic(&mut output, color)?;
|
||||||
|
color_count -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while color_count > 0 {
|
||||||
|
tool_helper::raw::write_generic(&mut output, PSXColor::black())?;
|
||||||
|
color_count -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue