seperate color

This commit is contained in:
Julian Freeman
2026-01-19 00:53:11 -04:00
parent fd90ac1df3
commit 358aae92dc
5 changed files with 31 additions and 12 deletions

View File

@@ -109,6 +109,7 @@ struct ExportImageTask {
manual_position: Option<ManualPosition>,
scale: Option<f64>,
opacity: Option<f64>,
color: Option<String>,
}
#[derive(serde::Deserialize)]
@@ -141,9 +142,8 @@ fn parse_hex_color(hex: &str) -> image::Rgba<u8> {
#[tauri::command]
async fn export_batch(images: Vec<ExportImageTask>, watermark: WatermarkSettings, output_dir: String) -> Result<String, String> {
let font = FontRef::try_from_slice(FONT_DATA).map_err(|e| format!("Font error: {}", e))?;
let base_color = parse_hex_color(&watermark.color);
// Note: opacity and final text color are now calculated per-task
// Note: Settings are now resolved per-task
let results: Vec<Result<(), String>> = images.par_iter().map(|task| {
let input_path = Path::new(&task.path);
@@ -156,8 +156,10 @@ async fn export_batch(images: Vec<ExportImageTask>, watermark: WatermarkSettings
// Determine effective settings (Task > Global)
let eff_scale = task.scale.unwrap_or(watermark.scale);
let eff_opacity = task.opacity.unwrap_or(watermark.opacity);
let eff_color_hex = task.color.as_ref().unwrap_or(&watermark.color);
// Calculate final color with effective opacity
// Calculate final color
let base_color = parse_hex_color(eff_color_hex);
let alpha = (eff_opacity * 255.0) as u8;
let text_color = image::Rgba([base_color[0], base_color[1], base_color[2], alpha]);