PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Smart Filters: note under Mode when Dissolve is selected
abc2cb2430664dd3e4
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex f16a4e56a..b363cd2a0 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -2649,6 +2649,7 @@ cameraData Lens ObjektivWait for the current job to finish. Počkejte na dokončení aktuální úlohy.The document or Smart Filter changed. Reopen its dialog. Dokument nebo inteligentní filtr se změnil. Znovu otevřete jeho dialog.Opacity must be between 0% and 100%. Krytí musí být mezi 0% a 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Režim Rozpustit je pouze aproximován: prolíná bez ditheringu Photoshopu.# Dynamic labels the tl! literal scanner cannot see: filter and Filter Gallery parameter names and# choices (humanized from their keys), Camera Raw controls, render filters (Flame, Picture Frame, Tree),diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsvindex 05fb3d2d1..63cce3769 100644--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -2683,6 +2683,7 @@ cameraData Lens ObjektivWait for the current job to finish. Warten Sie, bis der aktuelle Auftrag abgeschlossen ist.The document or Smart Filter changed. Reopen its dialog. Das Dokument oder der Smartfilter wurde geändert. Öffnen Sie den Dialog erneut.Opacity must be between 0% and 100%. Die Deckkraft muss zwischen 0% und 100% liegen.+ Dissolve is approximated: it blends without Photoshop's dither. Sprenkeln wird nur angenähert: Es wird ohne das Dithering von Photoshop gemischt.Loading fonts… Schriften werden geladen…Response curve Reaktionskurvediff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsvindex ae5787174..32f815459 100644--- a/crates/ui-egui/src/i18n/el.tsv+++ b/crates/ui-egui/src/i18n/el.tsv@@ -3739,6 +3739,7 @@ cameraData Lens ΦακόςWait for the current job to finish. Περιμένετε να ολοκληρωθεί η τρέχουσα εργασία.The document or Smart Filter changed. Reopen its dialog. Το έγγραφο ή το έξυπνο φίλτρο άλλαξε. Ανοίξτε ξανά το παράθυρό του.Opacity must be between 0% and 100%. Η αδιαφάνεια πρέπει να είναι μεταξύ 0% και 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Η Διάλυση προσεγγίζεται: η ανάμειξη γίνεται χωρίς το dither του Photoshop.Loading fonts… Φόρτωση γραμματοσειρών…Response curve Καμπύλη απόκρισηςdiff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex 42c047295..7e32c1164 100644--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -2725,6 +2725,7 @@ cameraData Lens ObjetivoWait for the current job to finish. Espere a que termine la tarea actual.The document or Smart Filter changed. Reopen its dialog. El documento o el filtro inteligente ha cambiado. Vuelva a abrir su diálogo.Opacity must be between 0% and 100%. La opacidad debe estar entre 0% y 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Disolver es aproximado: se fusiona sin el tramado de Photoshop.Loading fonts… Cargando fuentes…Response curve Curva de respuestadiff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsvindex eb27bbdd4..99b58f9dc 100644--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@ -3059,6 +3059,7 @@ cameraData Lens ObjectifWait for the current job to finish. Attendez la fin de la tâche en cours.The document or Smart Filter changed. Reopen its dialog. Le document ou le filtre dynamique a changé. Rouvrez sa boîte de dialogue.Opacity must be between 0% and 100%. L'opacité doit être comprise entre 0% et 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Le mode Fondu est approximé : il fusionne sans le tramage de Photoshop.Loading fonts… Chargement des polices…Response curve Courbe de réponsediff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsvindex 0f3b8cd86..9d13417b2 100644--- a/crates/ui-egui/src/i18n/hu.tsv+++ b/crates/ui-egui/src/i18n/hu.tsv@@ -4112,6 +4112,7 @@ cameraRaw Yellow SárgaBlending Options ({filter}) Keverési beállítások ({filter})Hide the layer's effects and Smart Filters ({key}-click: all layers) A réteg effektusainak és intelligens szűrőinek elrejtése ({key}+kattintás: minden réteg)Opacity must be between 0% and 100%. Az átlátszatlanságnak 0% és 100% között kell lennie.+ Dissolve is approximated: it blends without Photoshop's dither. A Szétszórás csak közelítés: a Photoshop raszterezése nélkül keveredik.Show the layer's effects and Smart Filters ({key}-click: all layers) A réteg effektusainak és intelligens szűrőinek megjelenítése ({key}+kattintás: minden réteg)The document or Smart Filter changed. Reopen its dialog. A dokumentum vagy az intelligens szűrő megváltozott. Nyisd meg újra a párbeszédablakát.Wait for the current job to finish. Várd meg, amíg az aktuális feladat befejeződik.diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsvindex b330f9622..65128a63e 100644--- a/crates/ui-egui/src/i18n/id.tsv+++ b/crates/ui-egui/src/i18n/id.tsv@@ -3046,6 +3046,7 @@ cameraData Lens LensaWait for the current job to finish. Tunggu hingga tugas saat ini selesai.The document or Smart Filter changed. Reopen its dialog. Dokumen atau Filter Cerdas berubah. Buka kembali dialognya.Opacity must be between 0% and 100%. Opasitas harus antara 0% dan 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Dissolve hanya didekati: pencampuran berjalan tanpa dither Photoshop.Loading fonts… Memuat font…Response curve Kurva responsdiff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsvindex b9935c70b..47e1aa0d5 100644--- a/crates/ui-egui/src/i18n/it.tsv+++ b/crates/ui-egui/src/i18n/it.tsv@@ -2713,6 +2713,7 @@ cameraData Lens ObiettivoWait for the current job to finish. Attendi il completamento dell'attività corrente.The document or Smart Filter changed. Reopen its dialog. Il documento o il filtro avanzato è cambiato. Riapri la sua finestra di dialogo.Opacity must be between 0% and 100%. L'opacità deve essere compresa tra 0% e 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Dissolvi è approssimato: la fusione avviene senza il dither di Photoshop.Loading fonts… Caricamento font…Response curve Curva di rispostadiff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsvindex e1767912f..73d988bd7 100644--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@ -3654,6 +3654,7 @@ cameraData Lens レンズWait for the current job to finish. 現在の処理が完了するまでお待ちください。The document or Smart Filter changed. Reopen its dialog. ドキュメントまたはスマートフィルターが変更されました。ダイアログを開き直してください。Opacity must be between 0% and 100%. 不透明度は0%から100%の範囲で指定してください。+ Dissolve is approximated: it blends without Photoshop's dither. ディザ合成は近似です。Photoshop のディザなしでブレンドします。Loading fonts… フォントを読み込み中…Response curve 応答カーブdiff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsvindex 5e0ac90aa..8627b889c 100644--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@ -3227,6 +3227,7 @@ cameraData Lens 렌즈Wait for the current job to finish. 현재 작업이 완료될 때까지 기다리세요.The document or Smart Filter changed. Reopen its dialog. 문서 또는 스마트 필터가 변경되었습니다. 대화 상자를 다시 여세요.Opacity must be between 0% and 100%. 불투명도는 0%에서 100% 사이여야 합니다.+ Dissolve is approximated: it blends without Photoshop's dither. 디졸브는 근사치입니다. Photoshop의 디더링 없이 혼합됩니다.Loading fonts… 글꼴 불러오는 중…Response curve 응답 곡선diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsvindex d02b977e1..d446b92f4 100644--- a/crates/ui-egui/src/i18n/nl.tsv+++ b/crates/ui-egui/src/i18n/nl.tsv@@ -3798,6 +3798,7 @@ cameraData Lens LensWait for the current job to finish. Wacht tot de huidige taak is voltooid.The document or Smart Filter changed. Reopen its dialog. Het document of het slimme filter is gewijzigd. Open het dialoogvenster opnieuw.Opacity must be between 0% and 100%. De dekking moet tussen 0% en 100% liggen.+ Dissolve is approximated: it blends without Photoshop's dither. Verspreiden is benaderd: het mengt zonder de dither van Photoshop.Loading fonts… Lettertypen laden…Response curve Responscurvediff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsvindex 86518395b..51170d6c7 100644--- a/crates/ui-egui/src/i18n/pl.tsv+++ b/crates/ui-egui/src/i18n/pl.tsv@@ -3656,6 +3656,7 @@ cameraData Lens ObiektywWait for the current job to finish. Poczekaj na zakończenie bieżącego zadania.The document or Smart Filter changed. Reopen its dialog. Dokument lub inteligentny filtr został zmieniony. Otwórz ponownie jego okno dialogowe.Opacity must be between 0% and 100%. Krycie musi wynosić od 0% do 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Rozpuszczanie jest przybliżone: miesza się bez ditheringu Photoshopa.Loading fonts… Wczytywanie czcionek…Response curve Krzywa odpowiedzidiff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsvindex 296520f72..cfc7a5dd6 100644--- a/crates/ui-egui/src/i18n/pt-br.tsv+++ b/crates/ui-egui/src/i18n/pt-br.tsv@@ -3062,6 +3062,7 @@ cameraData Lens LenteWait for the current job to finish. Aguarde a conclusão da tarefa atual.The document or Smart Filter changed. Reopen its dialog. O documento ou o Filtro Inteligente mudou. Reabra sua caixa de diálogo.Opacity must be between 0% and 100%. A opacidade deve estar entre 0% e 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Dissolver é aproximado: a mesclagem ocorre sem o dither do Photoshop.Loading fonts… Carregando fontes…Response curve Curva de respostadiff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex 69aa76469..35ec3e2c1 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -2983,6 +2983,7 @@ cameraData Lens ОбъективWait for the current job to finish. Дождитесь завершения текущей задачи.The document or Smart Filter changed. Reopen its dialog. Документ или смарт-фильтр изменился. Откройте его диалог заново.Opacity must be between 0% and 100%. Непрозрачность должна быть от 0% до 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Растворение приближённое: смешивание без дизеринга Photoshop.Loading fonts… Загрузка шрифтов…Response curve Кривая откликаdiff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsvindex 48d43c0c9..f00a53814 100644--- a/crates/ui-egui/src/i18n/sr.tsv+++ b/crates/ui-egui/src/i18n/sr.tsv@@ -4266,6 +4266,7 @@ shape Appearance IzgledBlending Options ({filter}) Opcije stapanja ({filter})Hide the layer's effects and Smart Filters ({key}-click: all layers) Sakrij efekte i pametne filtere sloja ({key}-klik: svi slojevi)Opacity must be between 0% and 100%. Neprozirnost mora biti između 0% i 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Rastapanje je približno: mešanje se vrši bez diteringa programa Photoshop.Show the layer's effects and Smart Filters ({key}-click: all layers) Prikaži efekte i pametne filtere sloja ({key}-klik: svi slojevi)The document or Smart Filter changed. Reopen its dialog. Dokument ili pametni filter se promenio. Ponovo otvorite njegov dijalog.Wait for the current job to finish. Sačekajte da se trenutni posao završi.diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsvindex 2233e90dd..e95a0e5e7 100644--- a/crates/ui-egui/src/i18n/tr.tsv+++ b/crates/ui-egui/src/i18n/tr.tsv@@ -3923,6 +3923,7 @@ cameraData Lens LensBlending Options ({filter}) Karışım Seçenekleri ({filter})Hide the layer's effects and Smart Filters ({key}-click: all layers) Katmanın efektlerini ve Akıllı Filtrelerini gizle ({key}-tık: tüm katmanlar)Opacity must be between 0% and 100%. Opaklık %0 ile %100 arasında olmalıdır.+ Dissolve is approximated: it blends without Photoshop's dither. Eritme yaklaşık olarak uygulanır: Photoshop'un dither'ı olmadan karıştırır.Show the layer's effects and Smart Filters ({key}-click: all layers) Katmanın efektlerini ve Akıllı Filtrelerini göster ({key}-tık: tüm katmanlar)The document or Smart Filter changed. Reopen its dialog. Belge veya Akıllı Filtre değişti. İletişim kutusunu yeniden açın.Wait for the current job to finish. Geçerli işin bitmesini bekleyin.diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsvindex 759077cdd..dc086f98d 100644--- a/crates/ui-egui/src/i18n/uk.tsv+++ b/crates/ui-egui/src/i18n/uk.tsv@@ -3730,6 +3730,7 @@ cameraData Lens Об'єктивWait for the current job to finish. Дочекайтеся завершення поточного завдання.The document or Smart Filter changed. Reopen its dialog. Документ або смарт-фільтр змінився. Відкрийте його діалог знову.Opacity must be between 0% and 100%. Непрозорість має бути від 0% до 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Розчинення наближене: змішування без дизерингу Photoshop.Loading fonts… Завантаження шрифтів…Response curve Крива відгукуdiff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsvindex 0c072faa7..36379d515 100644--- a/crates/ui-egui/src/i18n/vi.tsv+++ b/crates/ui-egui/src/i18n/vi.tsv@@ -3679,6 +3679,7 @@ curves Smooth Làm mượtBlending Options ({filter}) Tùy chọn hòa trộn ({filter})Hide the layer's effects and Smart Filters ({key}-click: all layers) Ẩn hiệu ứng và bộ lọc thông minh của lớp ({key}-bấm: tất cả các lớp)Opacity must be between 0% and 100%. Độ mờ phải nằm trong khoảng từ 0% đến 100%.+ Dissolve is approximated: it blends without Photoshop's dither. Hoà tan chỉ được mô phỏng gần đúng: hòa trộn không có dither của Photoshop.Show the layer's effects and Smart Filters ({key}-click: all layers) Hiện hiệu ứng và bộ lọc thông minh của lớp ({key}-bấm: tất cả các lớp)The document or Smart Filter changed. Reopen its dialog. Tài liệu hoặc bộ lọc thông minh đã thay đổi. Hãy mở lại hộp thoại của nó.Wait for the current job to finish. Hãy chờ tác vụ hiện tại hoàn tất.diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex 8475e4172..57631d3c4 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -2655,6 +2655,7 @@ cameraData Lens 镜头Wait for the current job to finish. 请等待当前任务完成。The document or Smart Filter changed. Reopen its dialog. 文档或智能滤镜已更改。请重新打开其对话框。Opacity must be between 0% and 100%. 不透明度必须介于 0% 和 100% 之间。+ Dissolve is approximated: it blends without Photoshop's dither. “溶解”为近似效果:混合时没有 Photoshop 的抖动。Loading fonts… 正在加载字体…Response curve 响应曲线diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex 96206e13b..0ddbfbab2 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -2625,6 +2625,7 @@ cameraData Lens 鏡頭Wait for the current job to finish. 請等待目前的工作完成。The document or Smart Filter changed. Reopen its dialog. 文件或智慧型濾鏡已變更。請重新開啟其對話框。Opacity must be between 0% and 100%. 不透明度必須介於 0% 和 100% 之間。+ Dissolve is approximated: it blends without Photoshop's dither. 「溶解」為近似效果:混合時沒有 Photoshop 的仿色。Loading fonts… 正在載入字體…Response curve 回應曲線diff --git a/crates/ui-egui/src/smart_filter_dialog.rs b/crates/ui-egui/src/smart_filter_dialog.rsindex b8db81693..d510ed74c 100644--- a/crates/ui-egui/src/smart_filter_dialog.rs+++ b/crates/ui-egui/src/smart_filter_dialog.rs@@ -130,6 +130,11 @@ pub(crate) fn edit_command(app: &PhotocraftApp, fields: &Map<String, Value>) ->}}+/// Dissolve has no per-pixel coverage sampling in Smart Filter blending yet (docs/smart-filters.md).+fn mode_note(blend: Option<&str>) -> Option<&'static str> {+ (blend == Some(BlendMode::Dissolve.label())).then(|| tl!("Dissolve is approximated: it blends without Photoshop's dither."))+}+pub fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui, fields: &mut Map<String, Value>) {ui.horizontal(|ui| {ui.label(tl!("Mode"));@@ -139,6 +144,9 @@ pub fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui, fields: &mut Map<String,fields.insert("blend".into(), json!(blend));}});+ if let Some(note) = mode_note(fields.get("blend").and_then(Value::as_str)) {+ ui.label(egui::RichText::new(note).color(Tokens::get(ui.ctx()).text_faint).size(11.0));+ }let mut opacity = fields.get("opacity").and_then(Value::as_f64).unwrap_or(100.0) as f32;if widgets::slider_row(ui, tl!("Opacity"), &mut opacity, 0.0..=100.0, "%", None).changed() {fields.insert("opacity".into(), json!(opacity));diff --git a/crates/ui-egui/src/smart_filter_dialog/tests.rs b/crates/ui-egui/src/smart_filter_dialog/tests.rsindex 04b838913..6e1ce5708 100644--- a/crates/ui-egui/src/smart_filter_dialog/tests.rs+++ b/crates/ui-egui/src/smart_filter_dialog/tests.rs@@ -37,6 +37,41 @@ fn tiny_images_keep_a_usable_preview_viewport() {.clear();}+fn painted_text(app: &mut PhotocraftApp, fields: &mut Map<String, Value>) -> Vec<String> {+ fn collect(shape: &egui::Shape, out: &mut Vec<String>) {+ match shape {+ egui::Shape::Text(text) => out.push(text.galley.job.text.clone()),+ egui::Shape::Vec(shapes) => shapes.iter().for_each(|s| collect(s, out)),+ _ => {}+ }+ }+ let ctx = egui::Context::default();+ PhotocraftApp::setup_context(&ctx, Default::default());+ let input = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(480.0, 640.0))), ..Default::default() };+ let mut output = ctx.run_ui(input, |ui| super::body(app, ui, fields));+ output.textures_delta.clear();+ let mut painted = Vec::new();+ output.shapes.iter().for_each(|s| collect(&s.shape, &mut painted));+ painted+}++#[test]+fn only_dissolve_shows_the_approximation_note_near_the_mode_control() {+ let note = "Dissolve is approximated: it blends without Photoshop's dither.";+ let (mut app, layer) = app(8, "rgb");+ let id = open(&mut app, layer, 0).unwrap();+ let mut fields = app.ui.dialog_mut(id).unwrap().fields.clone();+ for blend in BlendMode::LAYER_MODES {+ fields.insert("blend".into(), json!(blend.label()));+ let painted = painted_text(&mut app, &mut fields);+ assert!(painted.iter().any(|s| s == "Mode"), "the Mode control paints for {}", blend.label());+ assert_eq!(painted.iter().any(|s| s == note), blend == BlendMode::Dissolve, "note for {}", blend.label());+ }+ assert_eq!(mode_note(None), None);+ assert_eq!(mode_note(Some("Normal")), None);+ assert_eq!(mode_note(Some("Dissolve")), Some(note));+}+pub(crate) fn app(depth: u32, mode: &str) -> (PhotocraftApp, LayerId) {let mut s = photocraft_engine::Session::new();s.execute("file.new", json!({"width": 64, "height": 48, "depth": depth, "mode": mode})).unwrap();