Add watermark tiling, rotation types, margin/scale controls
Wire tiled, margin, and scale UI controls to JobConfig and pass through to WatermarkConfig. Add tiled text and image watermark implementations that repeat across the full image. Add font family filesystem search for named fonts. Add WatermarkRotation enum.
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
|
||||
|
||||
Reference in New Issue
Block a user