diff --git a/src/Tools/jaby_engine_fconv/src/images/reduced_tim/mod.rs b/src/Tools/jaby_engine_fconv/src/images/reduced_tim/mod.rs index 9b089243..d8c59a37 100644 --- a/src/Tools/jaby_engine_fconv/src/images/reduced_tim/mod.rs +++ b/src/Tools/jaby_engine_fconv/src/images/reduced_tim/mod.rs @@ -17,6 +17,7 @@ pub enum ColorType{ Full16, } +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] pub enum ClutAlignment { None, Linear, @@ -26,7 +27,10 @@ pub enum ClutAlignment { #[derive(Args)] pub struct Arguments { #[clap(arg_enum, value_parser)] - color_depth: ColorType + color_depth: ColorType, + + #[clap(arg_enum, value_parser, default_value_t=ClutAlignment::None)] + clut_align: ClutAlignment } fn encode(image: T, clut_align: ClutAlignment, mut output: Output) -> Result<(), Error> { @@ -84,7 +88,7 @@ fn convert_full16(input: Input, output: Output) -> Result<(), Error> { } } -fn convert_palette_based(input: Input, output: Output, color_type: ColorType) -> Result<(), Error> { +fn convert_palette_based(input: Input, output: Output, color_type: ColorType, clut_align: ClutAlignment) -> Result<(), Error> { match png::Decoder::new(input).read_info() { Ok(reader) => { let output_type = { @@ -94,7 +98,7 @@ fn convert_palette_based(input: Input, output: Output, color_type: ColorType) -> _ => return Err(Error::from_str("ColorType not supported")) } }; - encode(IndexedImage::new(reader, output_type)?, ClutAlignment::None, output) + encode(IndexedImage::new(reader, output_type)?, clut_align, output) }, Err(error) => Err(Error::from_error(error)) } @@ -103,6 +107,6 @@ fn convert_palette_based(input: Input, output: Output, color_type: ColorType) -> pub fn convert(args: Arguments, input: Input, output: Output) -> Result<(), Error> { match args.color_depth { ColorType::Full16 => convert_full16(input, output), - _ => convert_palette_based(input, output, args.color_depth), + _ => convert_palette_based(input, output, args.color_depth, args.clut_align), } } \ No newline at end of file