Share settings
This commit is contained in:
parent
9520050038
commit
aac810ffb3
|
@ -0,0 +1,27 @@
|
||||||
|
use clap::ValueEnum;
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
||||||
|
pub enum ColorType{
|
||||||
|
Clut4,
|
||||||
|
Clut8,
|
||||||
|
Full16,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
||||||
|
pub enum ClutAlignment {
|
||||||
|
None,
|
||||||
|
Linear,
|
||||||
|
Block
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub mod SemiTransparent {
|
||||||
|
pub type Type = bool;
|
||||||
|
pub const NAME:&'static str = "semi-trans";
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub mod TransparentPalette {
|
||||||
|
pub type Type = bool;
|
||||||
|
pub const NAME:&'static str = "";
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
pub mod args;
|
||||||
pub mod color_clut;
|
pub mod color_clut;
|
||||||
pub mod color_full16;
|
pub mod color_full16;
|
||||||
pub mod reduced_tim;
|
pub mod reduced_tim;
|
||||||
|
|
|
@ -1,24 +1,11 @@
|
||||||
use clap::{Args, ValueEnum};
|
use super::args::{ColorType, ClutAlignment, SemiTransparent, TransparentPalette};
|
||||||
use image::{DynamicImage, io::Reader as ImageReader};
|
|
||||||
use super::color_clut::{IndexedImage, OutputType};
|
use super::color_clut::{IndexedImage, OutputType};
|
||||||
use super::color_full16::{RgbaImage, RgbImage};
|
use super::color_full16::{RgbaImage, RgbImage};
|
||||||
|
use super::types::{Header, Color as PSXColor, PSXImageConverter};
|
||||||
|
use clap::Args;
|
||||||
|
use image::{DynamicImage, io::Reader as ImageReader};
|
||||||
use std::io::{Cursor, Write};
|
use std::io::{Cursor, Write};
|
||||||
use tool_helper::{Error, Input};
|
use tool_helper::{Error, Input};
|
||||||
use super::types::{Header, Color as PSXColor, PSXImageConverter};
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
|
||||||
pub enum ColorType{
|
|
||||||
Clut4,
|
|
||||||
Clut8,
|
|
||||||
Full16,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
|
||||||
pub enum ClutAlignment {
|
|
||||||
None,
|
|
||||||
Linear,
|
|
||||||
Block
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
pub struct Arguments {
|
pub struct Arguments {
|
||||||
|
@ -28,10 +15,11 @@ pub struct Arguments {
|
||||||
#[clap(value_enum, value_parser, default_value_t=ClutAlignment::None)]
|
#[clap(value_enum, value_parser, default_value_t=ClutAlignment::None)]
|
||||||
clut_align: ClutAlignment,
|
clut_align: ClutAlignment,
|
||||||
|
|
||||||
#[clap(long="semi-trans", default_value_t=false)]
|
#[clap(long=SemiTransparent::NAME, default_value_t=false)]
|
||||||
semi_transparent: bool,
|
semi_transparent: SemiTransparent::Type,
|
||||||
#[clap(long="color-trans", default_value_t=false)]
|
|
||||||
transparent_palette: bool
|
#[clap(long=TransparentPalette::NAME, default_value_t=false)]
|
||||||
|
transparent_palette: TransparentPalette::Type
|
||||||
}
|
}
|
||||||
|
|
||||||
fn modify_palette(mut image: IndexedImage, clut_align: ClutAlignment, semi_transparent: bool, transparent_palette: bool) -> IndexedImage {
|
fn modify_palette(mut image: IndexedImage, clut_align: ClutAlignment, semi_transparent: bool, transparent_palette: bool) -> IndexedImage {
|
||||||
|
|
Loading…
Reference in New Issue