Prepare for shared code

This commit is contained in:
jaby 2024-12-17 22:17:53 +01:00
parent aaf1e99ce8
commit 9520050038
8 changed files with 10 additions and 12 deletions

View File

@ -3,7 +3,6 @@ use tool_helper::{raw::RawConversion, Error};
#[repr(packed)]
#[derive(Clone)]
// TODO: Move logic of fixed values into the raw function, including the BE/LE stuff?
pub struct VAGHeader {
_id: [u8; 4],
version: u32,

View File

@ -1 +1,5 @@
pub mod color_clut;
pub mod color_full16;
pub mod reduced_tim;
pub mod tim;
pub mod types;

View File

@ -1,14 +1,10 @@
use clap::{Args, ValueEnum};
use image::{DynamicImage, io::Reader as ImageReader};
use color_clut::IndexedImage;
use color_full16::{RgbaImage, RgbImage};
use super::color_clut::{IndexedImage, OutputType};
use super::color_full16::{RgbaImage, RgbImage};
use std::io::{Cursor, Write};
use tool_helper::{Error, Input};
use types::{Header, Color as PSXColor, PSXImageConverter};
mod types;
mod color_clut;
mod color_full16;
use super::types::{Header, Color as PSXColor, PSXImageConverter};
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum ColorType{
@ -160,8 +156,8 @@ fn convert_palette_based(input: Input, output: &mut dyn Write, color_type: Color
Ok(reader) => {
let output_type = {
match color_type {
ColorType::Clut4 => color_clut::OutputType::FourBit,
ColorType::Clut8 => color_clut::OutputType::EightBit,
ColorType::Clut4 => OutputType::FourBit,
ColorType::Clut8 => OutputType::EightBit,
_ => return Err(Error::from_str("ColorType not supported"))
}
};

View File

@ -21,7 +21,6 @@ struct CommandLine {
#[derive(Subcommand)]
enum SubCommands {
// === Internal Commands ===
Nothing,
SimpleTIM(reduced_tim::Arguments),
VAG(vag::Arguments),