Wire resize algorithm selection, overwrite behavior, and fix rotation/flip scope
- Add ResizeAlgorithm enum (Lanczos3/CatmullRom/Bilinear/Nearest) to core - Thread algorithm selection from UI ComboRow through ProcessingJob to resize_image - Add OverwriteBehavior enum (AutoRename/Overwrite/Skip) to core - Implement overwrite handling in executor with auto-rename suffix logic - Wire overwrite behavior from output step through to processing job - Fix rotation/flip to apply when resize step is enabled, not just adjustments
This commit is contained in:
@@ -18,6 +18,7 @@ pub struct JobConfig {
|
||||
pub resize_width: u32,
|
||||
pub resize_height: u32,
|
||||
pub allow_upscale: bool,
|
||||
pub resize_algorithm: u32,
|
||||
// Adjustments
|
||||
pub adjustments_enabled: bool,
|
||||
pub rotation: u32,
|
||||
@@ -222,6 +223,7 @@ fn build_ui(app: &adw::Application) {
|
||||
resize_width: if remember { sess_state.resize_width.unwrap_or(1200) } else { 1200 },
|
||||
resize_height: if remember { sess_state.resize_height.unwrap_or(0) } else { 0 },
|
||||
allow_upscale: false,
|
||||
resize_algorithm: 0,
|
||||
adjustments_enabled: false,
|
||||
rotation: 0,
|
||||
flip: 0,
|
||||
@@ -1255,6 +1257,12 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
|
||||
allow_upscale: cfg.allow_upscale,
|
||||
});
|
||||
}
|
||||
job.resize_algorithm = match cfg.resize_algorithm {
|
||||
1 => pixstrip_core::operations::ResizeAlgorithm::CatmullRom,
|
||||
2 => pixstrip_core::operations::ResizeAlgorithm::Bilinear,
|
||||
3 => pixstrip_core::operations::ResizeAlgorithm::Nearest,
|
||||
_ => pixstrip_core::operations::ResizeAlgorithm::Lanczos3,
|
||||
};
|
||||
}
|
||||
|
||||
if cfg.convert_enabled {
|
||||
@@ -1344,8 +1352,8 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
|
||||
});
|
||||
}
|
||||
|
||||
// Rotation, Flip, and Adjustments (only when adjustments step is enabled)
|
||||
if cfg.adjustments_enabled {
|
||||
// Rotation and Flip apply from the resize step, so enable when either resize or adjustments is active
|
||||
if cfg.resize_enabled || cfg.adjustments_enabled {
|
||||
job.rotation = Some(match cfg.rotation {
|
||||
1 => pixstrip_core::operations::Rotation::Cw90,
|
||||
2 => pixstrip_core::operations::Rotation::Cw180,
|
||||
@@ -1359,7 +1367,10 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
|
||||
2 => pixstrip_core::operations::Flip::Vertical,
|
||||
_ => pixstrip_core::operations::Flip::None,
|
||||
});
|
||||
}
|
||||
|
||||
// Adjustments (brightness, contrast, etc.)
|
||||
if cfg.adjustments_enabled {
|
||||
let crop = match cfg.crop_aspect_ratio {
|
||||
1 => Some((1.0, 1.0)),
|
||||
2 => Some((4.0, 3.0)),
|
||||
@@ -1436,6 +1447,12 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
|
||||
}
|
||||
|
||||
job.preserve_directory_structure = cfg.preserve_dir_structure;
|
||||
job.overwrite_behavior = match cfg.overwrite_behavior {
|
||||
1 => pixstrip_core::operations::OverwriteBehavior::AutoRename,
|
||||
2 => pixstrip_core::operations::OverwriteBehavior::Overwrite,
|
||||
3 => pixstrip_core::operations::OverwriteBehavior::Skip,
|
||||
_ => pixstrip_core::operations::OverwriteBehavior::AutoRename, // 0 "Ask" defaults to auto-rename in batch
|
||||
};
|
||||
|
||||
drop(cfg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user