Add watermark tiling, rotation types, margin/scale controls
This commit is contained in:
@@ -68,6 +68,9 @@ pub struct JobConfig {
|
||||
pub watermark_color: [u8; 4],
|
||||
pub watermark_font_family: String,
|
||||
pub watermark_use_image: bool,
|
||||
pub watermark_tiled: bool,
|
||||
pub watermark_margin: u32,
|
||||
pub watermark_scale: f32,
|
||||
// Rename
|
||||
pub rename_enabled: bool,
|
||||
pub rename_prefix: String,
|
||||
@@ -363,6 +366,9 @@ fn build_ui(app: &adw::Application) {
|
||||
watermark_color: [255, 255, 255, 255],
|
||||
watermark_font_family: String::new(),
|
||||
watermark_use_image: false,
|
||||
watermark_tiled: false,
|
||||
watermark_margin: 10,
|
||||
watermark_scale: 20.0,
|
||||
rename_enabled: if remember { sess_state.rename_enabled.unwrap_or(false) } else { false },
|
||||
rename_prefix: String::new(),
|
||||
rename_suffix: String::new(),
|
||||
@@ -1683,7 +1689,10 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
|
||||
path: path.clone(),
|
||||
position,
|
||||
opacity: cfg.watermark_opacity,
|
||||
scale: 0.2,
|
||||
scale: cfg.watermark_scale / 100.0,
|
||||
rotation: None,
|
||||
tiled: cfg.watermark_tiled,
|
||||
margin: cfg.watermark_margin,
|
||||
});
|
||||
}
|
||||
} else if !cfg.watermark_text.is_empty() {
|
||||
@@ -1694,6 +1703,9 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
|
||||
opacity: cfg.watermark_opacity,
|
||||
color: cfg.watermark_color,
|
||||
font_family: if cfg.watermark_font_family.is_empty() { None } else { Some(cfg.watermark_font_family.clone()) },
|
||||
rotation: None,
|
||||
tiled: cfg.watermark_tiled,
|
||||
margin: cfg.watermark_margin,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2613,7 +2625,10 @@ fn build_preset_from_config(cfg: &JobConfig, name: &str) -> pixstrip_core::prese
|
||||
path: path.clone(),
|
||||
position,
|
||||
opacity: cfg.watermark_opacity,
|
||||
scale: 0.2,
|
||||
scale: cfg.watermark_scale / 100.0,
|
||||
rotation: None,
|
||||
tiled: cfg.watermark_tiled,
|
||||
margin: cfg.watermark_margin,
|
||||
}
|
||||
})
|
||||
} else if !cfg.watermark_text.is_empty() {
|
||||
@@ -2624,6 +2639,9 @@ fn build_preset_from_config(cfg: &JobConfig, name: &str) -> pixstrip_core::prese
|
||||
opacity: cfg.watermark_opacity,
|
||||
color: cfg.watermark_color,
|
||||
font_family: if cfg.watermark_font_family.is_empty() { None } else { Some(cfg.watermark_font_family.clone()) },
|
||||
rotation: None,
|
||||
tiled: cfg.watermark_tiled,
|
||||
margin: cfg.watermark_margin,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -496,6 +496,27 @@ pub fn build_watermark_page(state: &AppState) -> adw::NavigationPage {
|
||||
];
|
||||
});
|
||||
}
|
||||
// Wire tiled toggle
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
tiled_row.connect_active_notify(move |row| {
|
||||
jc.borrow_mut().watermark_tiled = row.is_active();
|
||||
});
|
||||
}
|
||||
// Wire margin spinner
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
margin_row.connect_value_notify(move |row| {
|
||||
jc.borrow_mut().watermark_margin = row.value() as u32;
|
||||
});
|
||||
}
|
||||
// Wire scale spinner
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
scale_row.connect_value_notify(move |row| {
|
||||
jc.borrow_mut().watermark_scale = row.value() as f32;
|
||||
});
|
||||
}
|
||||
// Wire image chooser button
|
||||
{
|
||||
let jc = state.job_config.clone();
|
||||
|
||||
Reference in New Issue
Block a user