mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
feat(ui): Photoshop's Select and Mask workspace
Select > Select and Mask... opens a full-window workspace laid out as Photoshop's, replacing the parameter dialog: - options bar: tool, add/subtract, Size, Hardness (Brush), Sample All Layers, Select Subject, Refine Hair (greyed: #2671) - tools: Quick Selection W, Refine Edge Brush R, Brush B, Object Selection W, Lasso and Polygonal Lasso L (one slot), Hand H, Zoom Z; Shift+W / Shift+L cycle - the document under its tab, shown in the chosen view - Properties: Remember Settings, View Mode (view letters, Show Edge J, Show Original P, Real-Time Refinement, High Quality Preview, Transparency/Opacity, Overlay colour and Indicates), Refine Mode (Object Aware greyed: #2788), Edge Detection, Global Refinements with Clear Selection and Invert, Output Settings; Reset, OK, Cancel The tools become select.refineEdge `edits` (the Refine Edge Brush its `refineStrokes`): OK is one history step, Cancel drops everything, Ctrl+Z undoes per edit. The preview runs in the background on a reduced copy (full size with High Quality Preview), reusing the selection after the edits it already applied; Real-Time Refinement previews the stroke being drawn. A targeted layer mask is refined and output to the mask. Closes #7069. Closes #8148. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
e6d6fb45a4
commit
4e816dc0ca
36 files changed
+2750
-35
No files matched your search
@@ -2887,9 +2887,13 @@ fn fit_doc_tabs(natural: &[f32], selected: usize, avail: f32) -> crate::tab_stri
|
||||
/// Photoshop's tab title: "name @ 50% (Layer 1, RGB/8)", "(Layer 1, Layer Mask/8)" when the mask
|
||||
/// is targeted, "(Quick Mask/8)" in Quick Mask mode; the Background layer's name is omitted.
|
||||
fn pro_tab_title(app: &PhotocraftApp, i: usize) -> String {
|
||||
tab_title_at(app, i, app.ui.views.get(i).map_or(100.0, |v| v.zoom * 100.0))
|
||||
}
|
||||
|
||||
/// [`pro_tab_title`] at `zoom` percent (a workspace with its own view, such as Select and Mask).
|
||||
pub(crate) fn tab_title_at(app: &PhotocraftApp, i: usize, zoom: f32) -> String {
|
||||
use photocraft_engine::channel_cmds::ChannelTarget;
|
||||
let Some(st) = app.session.documents().get(i) else { return String::new() };
|
||||
let zoom = app.ui.views.get(i).map_or(100.0, |v| v.zoom * 100.0);
|
||||
// Quick Mask mode targets the mask, not the layer (see `paint_target`): painting and Free
|
||||
// Transform change the red overlay, so the tab says so, as Photoshop's does.
|
||||
let quick_mask = st.doc.quick_mask.is_some() && st.channel_view.target == ChannelTarget::Composite;
|
||||
|
||||
@@ -24,6 +24,8 @@ pub struct Distort {
|
||||
pub liquify: Option<crate::liquify_ui::LiquifyDialog>,
|
||||
/// Edit › Content-Aware Fill… (caf_ui).
|
||||
pub caf: Option<crate::caf_ui::CafWorkspace>,
|
||||
/// Select › Select and Mask… (select_mask_ui).
|
||||
pub select_mask: Option<crate::select_mask_ui::SelectMaskWorkspace>,
|
||||
pub puppet: Option<crate::puppet_ui::PuppetSession>,
|
||||
pub perspective: Option<crate::perspective_ui::PerspSession>,
|
||||
pub vanishing: Option<crate::vp_ui::VpSession>,
|
||||
@@ -35,7 +37,12 @@ pub struct Distort {
|
||||
|
||||
impl Distort {
|
||||
pub fn active(&self) -> bool {
|
||||
self.liquify.is_some() || self.caf.is_some() || self.puppet.is_some() || self.perspective.is_some() || self.vanishing.is_some()
|
||||
self.liquify.is_some()
|
||||
|| self.caf.is_some()
|
||||
|| self.select_mask.is_some()
|
||||
|| self.puppet.is_some()
|
||||
|| self.perspective.is_some()
|
||||
|| self.vanishing.is_some()
|
||||
}
|
||||
|
||||
/// Short description for `ui.inspect`.
|
||||
@@ -43,6 +50,7 @@ impl Distort {
|
||||
json!({
|
||||
"liquify": self.liquify.as_ref().map(|d| d.describe()),
|
||||
"contentAwareFill": self.caf.as_ref().map(|d| d.describe()),
|
||||
"selectAndMask": self.select_mask.as_ref().map(|d| d.describe()),
|
||||
"puppet": self.puppet.as_ref().map(|p| p.describe()),
|
||||
"perspective": self.perspective.as_ref().map(|p| p.describe()),
|
||||
"vanishingPoint": self.vanishing.as_ref().map(|v| v.describe()),
|
||||
@@ -117,6 +125,9 @@ pub fn menu(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: &Val
|
||||
"edit.contentAwareFill" if ui.is_some() && app.distort.caf.is_some() => Some(crate::caf_ui::control(app, ui.unwrap_or(&Value::Null))),
|
||||
// `ui` addresses the workspace: closed, that is an error, not a fill with the defaults.
|
||||
"edit.contentAwareFill" if ui.is_some() => Some(Err("Content-Aware Fill is not open".into())),
|
||||
"select.selectAndMask" if ui.is_some() && app.distort.select_mask.is_some() => Some(crate::select_mask_ui::control(app, ui.unwrap_or(&Value::Null))),
|
||||
"select.selectAndMask" if ui.is_some() => Some(Err("Select and Mask is not open".into())),
|
||||
"select.selectAndMask" => Some(crate::select_mask_ui::open(app).map(|_| json!({"selectAndMask": app.distort.describe()["selectAndMask"]}))),
|
||||
"edit.puppetWarp" | "layer.smartObjects.puppetWarp" if empty => {
|
||||
Some(crate::puppet_ui::begin(app, ctx, id).map(|_| json!({"puppet": app.distort.describe()["puppet"]})))
|
||||
}
|
||||
@@ -141,6 +152,10 @@ pub fn pointer(app: &mut PhotocraftApp, ev: ToolEvent, mods: egui::Modifiers) ->
|
||||
crate::caf_ui::pointer(app, ev, mods);
|
||||
return true;
|
||||
}
|
||||
if app.distort.select_mask.is_some() {
|
||||
crate::select_mask_ui::pointer(app, ev, mods);
|
||||
return true;
|
||||
}
|
||||
if app.distort.liquify.is_some() {
|
||||
crate::liquify_ui::pointer(app, ev, mods);
|
||||
return true;
|
||||
@@ -182,6 +197,15 @@ pub fn keys(app: &mut PhotocraftApp, ctx: &egui::Context) -> bool {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if app.distort.select_mask.is_some() {
|
||||
// Enter closes a Polygonal Lasso polygon, else OK; Esc drops one, else Cancel.
|
||||
if enter(ctx) {
|
||||
crate::select_mask_ui::enter(app);
|
||||
} else if esc(ctx) {
|
||||
crate::select_mask_ui::escape(app);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if app.distort.liquify.is_some() {
|
||||
if enter(ctx) {
|
||||
let _ = crate::liquify_ui::commit(app);
|
||||
@@ -285,6 +309,7 @@ pub fn drop_foreign(app: &mut PhotocraftApp) {
|
||||
app.distort.liquify = None;
|
||||
// Stops its background preview too; what Apply wrote stays, as with Cancel.
|
||||
crate::caf_ui::cancel(app);
|
||||
crate::select_mask_ui::cancel(app);
|
||||
app.distort.puppet = None;
|
||||
app.distort.perspective = None;
|
||||
app.distort.vanishing = None;
|
||||
@@ -299,6 +324,9 @@ pub fn show(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
if app.distort.caf.is_some() {
|
||||
crate::caf_ui::show(app, ctx);
|
||||
}
|
||||
if app.distort.select_mask.is_some() {
|
||||
crate::select_mask_ui::show(app, ctx);
|
||||
}
|
||||
if app.distort.gallery.is_some() {
|
||||
crate::gallery_ui::show(app, ctx);
|
||||
}
|
||||
|
||||
@@ -4127,3 +4127,17 @@ cameraRaw Dehaze Odstranění oparu
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Podle barev
|
||||
Decontaminate Colors Dekontaminovat barvy
|
||||
Edge Detection Detekce okraje
|
||||
Global Refinements Globální upřesnění
|
||||
High Quality Preview Náhled ve vysoké kvalitě
|
||||
Object Aware Podle objektů
|
||||
Real-Time Refinement Upřesnění v reálném čase
|
||||
Refine Edge Brush Tool Nástroj štětec pro upřesnění okraje
|
||||
Refine Hair Upřesnit vlasy
|
||||
Refine Mode Režim upřesnění
|
||||
Remember Settings Zapamatovat nastavení
|
||||
View Mode Režim zobrazení
|
||||
Object Aware needs a segmentation model, which isn't available yet Režim Podle objektů vyžaduje segmentační model, který zatím není k dispozici
|
||||
Refine Hair needs hair detection, which isn't available yet Upřesnit vlasy vyžaduje detekci vlasů, která zatím není k dispozici
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3393,3 +3393,18 @@ curves Smooth Glätten
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection Auswahl löschen
|
||||
Color Aware Farbbezogen
|
||||
Decontaminate Colors Farben dekontaminieren
|
||||
Edge Detection Kantenerkennung
|
||||
Global Refinements Globale Verbesserungen
|
||||
High Quality Preview Hochwertige Vorschau
|
||||
Object Aware Objektbezogen
|
||||
Real-Time Refinement Verbesserung in Echtzeit
|
||||
Refine Edge Brush Tool Kante-verbessern-Pinsel-Werkzeug
|
||||
Refine Hair Haare verbessern
|
||||
Refine Mode Verbesserungsmodus
|
||||
Remember Settings Einstellungen merken
|
||||
View Mode Ansichtsmodus
|
||||
Object Aware needs a segmentation model, which isn't available yet Objektbezogen benötigt ein Segmentierungsmodell, das noch nicht verfügbar ist
|
||||
Refine Hair needs hair detection, which isn't available yet Haare verbessern benötigt eine Haarerkennung, die noch nicht verfügbar ist
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4082,3 +4082,17 @@ curves Smooth Εξομάλυνση
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Με βάση το χρώμα
|
||||
Decontaminate Colors Απολύμανση χρωμάτων
|
||||
Edge Detection Ανίχνευση άκρης
|
||||
Global Refinements Καθολικές βελτιώσεις
|
||||
High Quality Preview Προεπισκόπηση υψηλής ποιότητας
|
||||
Object Aware Με βάση το αντικείμενο
|
||||
Real-Time Refinement Βελτίωση σε πραγματικό χρόνο
|
||||
Refine Edge Brush Tool Εργαλείο πινέλου βελτίωσης ακμής
|
||||
Refine Hair Βελτίωση μαλλιών
|
||||
Refine Mode Λειτουργία βελτίωσης
|
||||
Remember Settings Απομνημόνευση ρυθμίσεων
|
||||
View Mode Λειτουργία προβολής
|
||||
Object Aware needs a segmentation model, which isn't available yet Η λειτουργία Με βάση το αντικείμενο χρειάζεται μοντέλο τμηματοποίησης, που δεν είναι ακόμη διαθέσιμο
|
||||
Refine Hair needs hair detection, which isn't available yet Η Βελτίωση μαλλιών χρειάζεται ανίχνευση μαλλιών, που δεν είναι ακόμη διαθέσιμη
|
||||
|
Can't render this file because it contains an unexpected character in line 1038 and column 18.
|
@@ -4344,3 +4344,17 @@ navigator Zoom Zoom
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Según color
|
||||
Decontaminate Colors Descontaminar colores
|
||||
Edge Detection Detección de bordes
|
||||
Global Refinements Perfeccionamientos globales
|
||||
High Quality Preview Previsualización de alta calidad
|
||||
Object Aware Según objeto
|
||||
Real-Time Refinement Perfeccionamiento en tiempo real
|
||||
Refine Edge Brush Tool Herramienta Pincel para perfeccionar bordes
|
||||
Refine Hair Perfeccionar pelo
|
||||
Refine Mode Modo de perfeccionamiento
|
||||
Remember Settings Recordar ajustes
|
||||
View Mode Modo de visualización
|
||||
Object Aware needs a segmentation model, which isn't available yet Según objeto necesita un modelo de segmentación que aún no está disponible
|
||||
Refine Hair needs hair detection, which isn't available yet Perfeccionar pelo necesita detección de pelo, que aún no está disponible
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -4424,3 +4424,17 @@ shape Appearance Apparence
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Selon la couleur
|
||||
Decontaminate Colors Décontaminer les couleurs
|
||||
Edge Detection Détection des contours
|
||||
Global Refinements Améliorations globales
|
||||
High Quality Preview Aperçu haute qualité
|
||||
Object Aware Selon l'objet
|
||||
Real-Time Refinement Amélioration en temps réel
|
||||
Refine Edge Brush Tool Outil Pinceau d'amélioration du contour
|
||||
Refine Hair Améliorer les cheveux
|
||||
Refine Mode Mode d'amélioration
|
||||
Remember Settings Mémoriser les paramètres
|
||||
View Mode Mode d'affichage
|
||||
Object Aware needs a segmentation model, which isn't available yet Selon l'objet nécessite un modèle de segmentation, pas encore disponible
|
||||
Refine Hair needs hair detection, which isn't available yet Améliorer les cheveux nécessite une détection des cheveux, pas encore disponible
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -535,3 +535,18 @@ cameraRaw Yellow पीला
|
||||
Missing delete command हटाने का कमांड नहीं मिला
|
||||
Invalid delete command हटाने का कमांड अमान्य है
|
||||
Layer deleted, but confirmation preference could not be saved: {error} लेयर हटा दी गई, लेकिन पुष्टि की प्राथमिकता सहेजी नहीं जा सकी: {error}
|
||||
Clear Selection चयन साफ़ करें
|
||||
Color Aware रंग-आधारित
|
||||
Decontaminate Colors रंग शुद्ध करें
|
||||
Edge Detection किनारा पहचान
|
||||
Global Refinements वैश्विक परिशोधन
|
||||
High Quality Preview उच्च गुणवत्ता पूर्वावलोकन
|
||||
Object Aware ऑब्जेक्ट-आधारित
|
||||
Real-Time Refinement रियल-टाइम परिशोधन
|
||||
Refine Edge Brush Tool किनारा परिशोधन ब्रश टूल
|
||||
Refine Hair बाल परिशोधित करें
|
||||
Refine Mode परिशोधन मोड
|
||||
Remember Settings सेटिंग्स याद रखें
|
||||
View Mode दृश्य मोड
|
||||
Object Aware needs a segmentation model, which isn't available yet ऑब्जेक्ट-आधारित के लिए सेगमेंटेशन मॉडल चाहिए, जो अभी उपलब्ध नहीं है
|
||||
Refine Hair needs hair detection, which isn't available yet बाल परिशोधित करने के लिए बालों की पहचान चाहिए, जो अभी उपलब्ध नहीं है
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4298,3 +4298,17 @@ cameraRaw Yellow Sárga
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Színalapú
|
||||
Decontaminate Colors Színek fertőtlenítése
|
||||
Edge Detection Élészlelés
|
||||
Global Refinements Globális finomítások
|
||||
High Quality Preview Kiváló minőségű előnézet
|
||||
Object Aware Objektumalapú
|
||||
Real-Time Refinement Valós idejű finomítás
|
||||
Refine Edge Brush Tool Élfinomító ecset eszköz
|
||||
Refine Hair Haj finomítása
|
||||
Refine Mode Finomítási mód
|
||||
Remember Settings Beállítások megjegyzése
|
||||
View Mode Nézetmód
|
||||
Object Aware needs a segmentation model, which isn't available yet Az Objektumalapú módhoz szegmentálási modell kell, amely még nem érhető el
|
||||
Refine Hair needs hair detection, which isn't available yet A Haj finomításához hajfelismerés kell, amely még nem érhető el
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3396,3 +3396,18 @@ curves Smooth Haluskan
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection Hapus Seleksi
|
||||
Color Aware Berbasis Warna
|
||||
Decontaminate Colors Dekontaminasi Warna
|
||||
Edge Detection Deteksi Tepi
|
||||
Global Refinements Penyempurnaan Global
|
||||
High Quality Preview Pratinjau Kualitas Tinggi
|
||||
Object Aware Berbasis Objek
|
||||
Real-Time Refinement Penyempurnaan Waktu Nyata
|
||||
Refine Edge Brush Tool Alat Kuas Perhalus Tepi
|
||||
Refine Hair Perhalus Rambut
|
||||
Refine Mode Mode Penyempurnaan
|
||||
Remember Settings Ingat Pengaturan
|
||||
View Mode Mode Tampilan
|
||||
Object Aware needs a segmentation model, which isn't available yet Berbasis Objek memerlukan model segmentasi, yang belum tersedia
|
||||
Refine Hair needs hair detection, which isn't available yet Perhalus Rambut memerlukan deteksi rambut, yang belum tersedia
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -4499,3 +4499,17 @@ shape Appearance Aspetto
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware In base al colore
|
||||
Decontaminate Colors Decontamina colori
|
||||
Edge Detection Rilevamento bordi
|
||||
Global Refinements Perfezionamenti globali
|
||||
High Quality Preview Anteprima di alta qualità
|
||||
Object Aware In base all'oggetto
|
||||
Real-Time Refinement Perfezionamento in tempo reale
|
||||
Refine Edge Brush Tool Strumento Pennello per migliorare il bordo
|
||||
Refine Hair Migliora capelli
|
||||
Refine Mode Metodo di perfezionamento
|
||||
Remember Settings Ricorda impostazioni
|
||||
View Mode Modalità di visualizzazione
|
||||
Object Aware needs a segmentation model, which isn't available yet In base all'oggetto richiede un modello di segmentazione, non ancora disponibile
|
||||
Refine Hair needs hair detection, which isn't available yet Migliora capelli richiede il rilevamento dei capelli, non ancora disponibile
|
||||
|
Can't render this file because it contains an unexpected character in line 2396 and column 12.
|
@@ -4060,3 +4060,18 @@ curves Smooth スムーズ
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection 選択範囲をクリア
|
||||
Color Aware カラー認識
|
||||
Decontaminate Colors 不要なカラーの除去
|
||||
Edge Detection エッジの検出
|
||||
Global Refinements グローバル調整
|
||||
High Quality Preview 高品質プレビュー
|
||||
Object Aware オブジェクト認識
|
||||
Real-Time Refinement リアルタイム調整
|
||||
Refine Edge Brush Tool 境界線調整ブラシツール
|
||||
Refine Hair 髪の毛を調整
|
||||
Refine Mode 調整モード
|
||||
Remember Settings 設定を保存
|
||||
View Mode 表示モード
|
||||
Object Aware needs a segmentation model, which isn't available yet オブジェクト認識にはセグメンテーションモデルが必要ですが、まだ利用できません
|
||||
Refine Hair needs hair detection, which isn't available yet 髪の毛を調整には髪の毛の検出が必要ですが、まだ利用できません
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3591,3 +3591,18 @@ curves Smooth 매끄럽게
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection 선택 영역 지우기
|
||||
Color Aware 색상 인식
|
||||
Decontaminate Colors 색상 정화
|
||||
Edge Detection 가장자리 감지
|
||||
Global Refinements 전역 다듬기
|
||||
High Quality Preview 고품질 미리 보기
|
||||
Object Aware 개체 인식
|
||||
Real-Time Refinement 실시간 다듬기
|
||||
Refine Edge Brush Tool 가장자리 다듬기 브러시 도구
|
||||
Refine Hair 머리카락 다듬기
|
||||
Refine Mode 다듬기 모드
|
||||
Remember Settings 설정 기억
|
||||
View Mode 보기 모드
|
||||
Object Aware needs a segmentation model, which isn't available yet 개체 인식에는 분할 모델이 필요하지만 아직 사용할 수 없습니다
|
||||
Refine Hair needs hair detection, which isn't available yet 머리카락 다듬기에는 머리카락 감지가 필요하지만 아직 사용할 수 없습니다
|
||||
|
Can't render this file because it contains an unexpected character in line 2941 and column 12.
|
@@ -4142,3 +4142,17 @@ curves Smooth Vloeiend maken
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Kleurbewust
|
||||
Decontaminate Colors Kleuren zuiveren
|
||||
Edge Detection Randdetectie
|
||||
Global Refinements Globale verfijningen
|
||||
High Quality Preview Voorvertoning in hoge kwaliteit
|
||||
Object Aware Objectbewust
|
||||
Real-Time Refinement Verfijning in realtime
|
||||
Refine Edge Brush Tool Gereedschap Penseel Rand verfijnen
|
||||
Refine Hair Haar verfijnen
|
||||
Refine Mode Verfijningsmodus
|
||||
Remember Settings Instellingen onthouden
|
||||
View Mode Weergavemodus
|
||||
Object Aware needs a segmentation model, which isn't available yet Objectbewust vereist een segmentatiemodel dat nog niet beschikbaar is
|
||||
Refine Hair needs hair detection, which isn't available yet Haar verfijnen vereist haardetectie die nog niet beschikbaar is
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -3998,3 +3998,18 @@ curves Smooth Wygładź
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection Wyczyść zaznaczenie
|
||||
Color Aware Według kolorów
|
||||
Decontaminate Colors Odkażanie kolorów
|
||||
Edge Detection Wykrywanie krawędzi
|
||||
Global Refinements Dopracowanie globalne
|
||||
High Quality Preview Podgląd wysokiej jakości
|
||||
Object Aware Według obiektów
|
||||
Real-Time Refinement Dopracowanie w czasie rzeczywistym
|
||||
Refine Edge Brush Tool Narzędzie Pędzel dopracowania krawędzi
|
||||
Refine Hair Dopracuj włosy
|
||||
Refine Mode Tryb dopracowania
|
||||
Remember Settings Zapamiętaj ustawienia
|
||||
View Mode Tryb widoku
|
||||
Object Aware needs a segmentation model, which isn't available yet Tryb Według obiektów wymaga modelu segmentacji, który nie jest jeszcze dostępny
|
||||
Refine Hair needs hair detection, which isn't available yet Dopracowanie włosów wymaga wykrywania włosów, które nie jest jeszcze dostępne
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4321,3 +4321,17 @@ layerLabel No Color Sem cor
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Com reconhecimento de cor
|
||||
Decontaminate Colors Descontaminar cores
|
||||
Edge Detection Detecção de borda
|
||||
Global Refinements Refinamentos globais
|
||||
High Quality Preview Visualização de alta qualidade
|
||||
Object Aware Com reconhecimento de objeto
|
||||
Real-Time Refinement Refinamento em tempo real
|
||||
Refine Edge Brush Tool Ferramenta Pincel de refinamento de borda
|
||||
Refine Hair Refinar cabelo
|
||||
Refine Mode Modo de refinamento
|
||||
Remember Settings Lembrar configurações
|
||||
View Mode Modo de exibição
|
||||
Object Aware needs a segmentation model, which isn't available yet Com reconhecimento de objeto requer um modelo de segmentação, ainda não disponível
|
||||
Refine Hair needs hair detection, which isn't available yet Refinar cabelo requer detecção de cabelo, ainda não disponível
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4587,3 +4587,17 @@ shape Appearance Оформление
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware С учетом цвета
|
||||
Decontaminate Colors Очистить цвета
|
||||
Edge Detection Обнаружение краев
|
||||
Global Refinements Глобальное уточнение
|
||||
High Quality Preview Высококачественный просмотр
|
||||
Object Aware С учетом объектов
|
||||
Real-Time Refinement Уточнение в реальном времени
|
||||
Refine Edge Brush Tool Инструмент «Кисть уточнения края»
|
||||
Refine Hair Уточнить волосы
|
||||
Refine Mode Режим уточнения
|
||||
Remember Settings Запомнить параметры
|
||||
View Mode Режим просмотра
|
||||
Object Aware needs a segmentation model, which isn't available yet Для режима «С учетом объектов» нужна модель сегментации, которая пока недоступна
|
||||
Refine Hair needs hair detection, which isn't available yet Для уточнения волос нужно распознавание волос, которое пока недоступно
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4454,3 +4454,17 @@ shape Appearance Izgled
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Prema boji
|
||||
Decontaminate Colors Dekontaminiraj boje
|
||||
Edge Detection Detekcija ivice
|
||||
Global Refinements Globalna doterivanja
|
||||
High Quality Preview Pregled visokog kvaliteta
|
||||
Object Aware Prema objektu
|
||||
Real-Time Refinement Doterivanje u realnom vremenu
|
||||
Refine Edge Brush Tool Alatka četkica za doterivanje ivice
|
||||
Refine Hair Doteraj kosu
|
||||
Refine Mode Režim doterivanja
|
||||
Remember Settings Zapamti podešavanja
|
||||
View Mode Režim prikaza
|
||||
Object Aware needs a segmentation model, which isn't available yet Režim Prema objektu zahteva model segmentacije, koji još nije dostupan
|
||||
Refine Hair needs hair detection, which isn't available yet Doterivanje kose zahteva detekciju kose, koja još nije dostupna
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4112,3 +4112,17 @@ cameraData Lens Lens
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Color Aware Renge Duyarlı
|
||||
Decontaminate Colors Renkleri Arındır
|
||||
Edge Detection Kenar Algılama
|
||||
Global Refinements Genel Hassaslaştırmalar
|
||||
High Quality Preview Yüksek Kaliteli Önizleme
|
||||
Object Aware Nesneye Duyarlı
|
||||
Real-Time Refinement Gerçek Zamanlı Hassaslaştırma
|
||||
Refine Edge Brush Tool Kenarı Hassaslaştırma Fırçası Aracı
|
||||
Refine Hair Saçı Hassaslaştır
|
||||
Refine Mode Hassaslaştırma Modu
|
||||
Remember Settings Ayarları Hatırla
|
||||
View Mode Görünüm Modu
|
||||
Object Aware needs a segmentation model, which isn't available yet Nesneye Duyarlı mod henüz kullanılamayan bir bölütleme modeli gerektirir
|
||||
Refine Hair needs hair detection, which isn't available yet Saçı Hassaslaştır henüz kullanılamayan saç algılama gerektirir
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -4091,3 +4091,18 @@ curves Smooth Згладити
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection Очистити виділення
|
||||
Color Aware З урахуванням кольору
|
||||
Decontaminate Colors Очистити кольори
|
||||
Edge Detection Виявлення краю
|
||||
Global Refinements Глобальне уточнення
|
||||
High Quality Preview Високоякісний перегляд
|
||||
Object Aware З урахуванням об'єктів
|
||||
Real-Time Refinement Уточнення в реальному часі
|
||||
Refine Edge Brush Tool Інструмент «Пензель уточнення краю»
|
||||
Refine Hair Уточнити волосся
|
||||
Refine Mode Режим уточнення
|
||||
Remember Settings Запам'ятати параметри
|
||||
View Mode Режим перегляду
|
||||
Object Aware needs a segmentation model, which isn't available yet Для режиму «З урахуванням об'єктів» потрібна модель сегментації, яка ще недоступна
|
||||
Refine Hair needs hair detection, which isn't available yet Для уточнення волосся потрібне розпізнавання волосся, яке ще недоступне
|
||||
|
Can't render this file because it contains an unexpected character in line 1405 and column 18.
|
@@ -3874,3 +3874,18 @@ curves Smooth Làm mượt
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection Xóa vùng chọn
|
||||
Color Aware Nhận biết màu
|
||||
Decontaminate Colors Khử nhiễm màu
|
||||
Edge Detection Phát hiện cạnh
|
||||
Global Refinements Tinh chỉnh tổng thể
|
||||
High Quality Preview Xem trước chất lượng cao
|
||||
Object Aware Nhận biết đối tượng
|
||||
Real-Time Refinement Tinh chỉnh theo thời gian thực
|
||||
Refine Edge Brush Tool Công cụ cọ tinh chỉnh cạnh
|
||||
Refine Hair Tinh chỉnh tóc
|
||||
Refine Mode Chế độ tinh chỉnh
|
||||
Remember Settings Ghi nhớ cài đặt
|
||||
View Mode Chế độ xem
|
||||
Object Aware needs a segmentation model, which isn't available yet Nhận biết đối tượng cần mô hình phân đoạn, hiện chưa có
|
||||
Refine Hair needs hair detection, which isn't available yet Tinh chỉnh tóc cần tính năng phát hiện tóc, hiện chưa có
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3041,3 +3041,18 @@ curves Smooth 平滑
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection 清除选区
|
||||
Color Aware 颜色识别
|
||||
Decontaminate Colors 净化颜色
|
||||
Edge Detection 边缘检测
|
||||
Global Refinements 全局调整
|
||||
High Quality Preview 高品质预览
|
||||
Object Aware 对象识别
|
||||
Real-Time Refinement 实时调整
|
||||
Refine Edge Brush Tool 调整边缘画笔工具
|
||||
Refine Hair 调整细线
|
||||
Refine Mode 调整模式
|
||||
Remember Settings 记住设置
|
||||
View Mode 视图模式
|
||||
Object Aware needs a segmentation model, which isn't available yet 对象识别需要分割模型,目前尚不可用
|
||||
Refine Hair needs hair detection, which isn't available yet 调整细线需要毛发检测,目前尚不可用
|
||||
|
Can't render this file because it contains an unexpected character in line 2369 and column 12.
|
@@ -3005,3 +3005,18 @@ curves Smooth 平滑
|
||||
|
||||
# Print preview image (#8236)
|
||||
Print preview image Print preview image
|
||||
Clear Selection 清除選取範圍
|
||||
Color Aware 顏色感知
|
||||
Decontaminate Colors 淨化顏色
|
||||
Edge Detection 邊緣偵測
|
||||
Global Refinements 整體調整
|
||||
High Quality Preview 高品質預視
|
||||
Object Aware 物件感知
|
||||
Real-Time Refinement 即時調整
|
||||
Refine Edge Brush Tool 調整邊緣筆刷工具
|
||||
Refine Hair 調整毛髮
|
||||
Refine Mode 調整模式
|
||||
Remember Settings 記住設定
|
||||
View Mode 檢視模式
|
||||
Object Aware needs a segmentation model, which isn't available yet 物件感知需要分割模型,目前尚無法使用
|
||||
Refine Hair needs hair detection, which isn't available yet 調整毛髮需要毛髮偵測,目前尚無法使用
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -153,8 +153,8 @@ fn mask_double_click_launches_select_and_mask_with_preference() {
|
||||
let at = masks.iter().find(|(kind, _)| *kind == crate::mask_thumbs_ui::MaskKind::Pixel).unwrap().1.center();
|
||||
double_click(&mut h, at);
|
||||
assert!(h.state().ui.mask_target);
|
||||
let dialog = h.state().ui.dialogs.last().expect("select and mask dialog should be opened");
|
||||
assert_eq!(dialog.fields.get("__command").and_then(|v| v.as_str()), Some("select.refineEdge"));
|
||||
let w = h.state().distort.describe()["selectAndMask"].clone();
|
||||
assert_eq!(w["settings"]["output"].as_str(), Some("layerMask"), "the Select and Mask workspace opens on the mask: {w}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -194,6 +194,7 @@ pub mod rulers;
|
||||
pub mod screen_picker;
|
||||
pub mod scrollbars;
|
||||
mod scrub_wrap;
|
||||
pub mod select_mask_ui;
|
||||
pub mod select_mask_view;
|
||||
pub mod served_fonts;
|
||||
pub mod shape_dialog;
|
||||
|
||||
@@ -293,21 +293,22 @@ fn refine_invert_inverts_the_mask_and_leaves_the_layer_alone() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refine_row_opens_the_select_and_mask_and_color_range_dialogs() {
|
||||
for (label, open) in [("Select and Mask…", "select.refineEdge"), ("Color Range…", crate::color_range_ui::COMMAND)] {
|
||||
let mut h = harness(false, crate::theme::ThemeKind::Pro);
|
||||
assert!(h.state().ui.dialogs.is_empty());
|
||||
h.get_by_label(label).click();
|
||||
h.run_steps(3);
|
||||
let dialogs = &h.state().ui.dialogs;
|
||||
assert_eq!(dialogs.len(), 1, "{label} opens one dialog");
|
||||
let fields = &dialogs[0].fields;
|
||||
let opened = fields.get("__command").and_then(Value::as_str).unwrap_or(crate::color_range_ui::COMMAND);
|
||||
assert_eq!(opened, open, "{label} opened {opened}");
|
||||
if open == crate::color_range_ui::COMMAND {
|
||||
assert!(crate::color_range_ui::owns(fields), "the Color Range dialog, not the generic one");
|
||||
}
|
||||
}
|
||||
fn refine_row_opens_the_select_and_mask_workspace_and_color_range_dialog() {
|
||||
// Select and Mask… opens Photoshop's workspace on the targeted mask.
|
||||
let mut h = harness(false, crate::theme::ThemeKind::Pro);
|
||||
h.get_by_label("Select and Mask…").click();
|
||||
h.run_steps(3);
|
||||
assert!(h.state().ui.dialogs.is_empty(), "a workspace, not a dialog");
|
||||
let w = h.state().distort.describe()["selectAndMask"].clone();
|
||||
assert_eq!(w["settings"]["output"].as_str(), Some("layerMask"), "it refines the mask: {w}");
|
||||
// Color Range… opens its own dialog.
|
||||
let mut h = harness(false, crate::theme::ThemeKind::Pro);
|
||||
assert!(h.state().ui.dialogs.is_empty());
|
||||
h.get_by_label("Color Range…").click();
|
||||
h.run_steps(3);
|
||||
let dialogs = &h.state().ui.dialogs;
|
||||
assert_eq!(dialogs.len(), 1, "Color Range… opens one dialog");
|
||||
assert!(crate::color_range_ui::owns(&dialogs[0].fields), "the Color Range dialog, not the generic one");
|
||||
}
|
||||
|
||||
/// A Studio-layout theme's floating Properties card, with no mask targeted.
|
||||
|
||||
@@ -492,7 +492,8 @@ pub(crate) fn invoke_unguarded(app: &mut PhotocraftApp, ctx: &egui::Context, id:
|
||||
}
|
||||
Ok(json!({"dialog": crate::fill_ui::open(app)}))
|
||||
}
|
||||
"select.selectAndMask" => Ok(json!({"dialog": crate::filter_dialog::open(app, "select.refineEdge")})),
|
||||
// Photoshop's workspace (select_mask_ui); `distort_ui::menu` routes it first.
|
||||
"select.selectAndMask" => crate::select_mask_ui::open(app).map(|_| json!({"selectAndMask": app.distort.describe()["selectAndMask"]})),
|
||||
// Select › Transform Selection from the menu: the interactive box (with params: the engine).
|
||||
"select.transformSelection" if params.as_object().is_none_or(|o| o.is_empty()) => {
|
||||
crate::transform_tool::begin_selection(app, ctx).map(|_| json!({"transform": app.ui.transform}))
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,544 @@
|
||||
use super::*;
|
||||
use egui::{Key, Modifiers};
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
|
||||
/// A 160 × 100 document: warm on the left (x < 80), cool on the right, with the top-left
|
||||
/// 20 × 20 selected.
|
||||
fn app_with_selection() -> PhotocraftApp {
|
||||
app_sized(160, 100)
|
||||
}
|
||||
|
||||
fn app_sized(w: i32, h: i32) -> PhotocraftApp {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
|
||||
app.session.execute("file.new", json!({"width": w, "height": h, "depth": 8})).unwrap();
|
||||
app.session
|
||||
.edit("paint", |doc, _| {
|
||||
let s = doc.layers[0].surface_mut().unwrap();
|
||||
s.fill_rect(Rect::new(0, 0, w / 2, h), &[0.85, 0.55, 0.25, 1.0]);
|
||||
s.fill_rect(Rect::new(w / 2, 0, w, h), &[0.15, 0.35, 0.75, 1.0]);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
app.session.execute("select.rect", json!({"x": 0, "y": 0, "width": 20, "height": 20})).unwrap();
|
||||
app.session.prefs.edit(|p| {
|
||||
p.dialogs.remove(REMEMBERED);
|
||||
});
|
||||
app.sync_views();
|
||||
app
|
||||
}
|
||||
|
||||
fn ws(app: &PhotocraftApp) -> &SelectMaskWorkspace {
|
||||
app.distort.select_mask.as_ref().unwrap()
|
||||
}
|
||||
|
||||
fn ui(app: &mut PhotocraftApp, v: Value) -> Value {
|
||||
control(app, &v).unwrap()
|
||||
}
|
||||
|
||||
fn selected(app: &mut PhotocraftApp) -> u64 {
|
||||
ui(app, json!({"waitPreview": true}))["selectedProxyPixels"].as_u64().unwrap()
|
||||
}
|
||||
|
||||
fn cov(app: &PhotocraftApp, x: i32, y: i32) -> f32 {
|
||||
app.session.active().unwrap().doc.selection.as_ref().map_or(0.0, |s| s.sample_channel(x, y, 0))
|
||||
}
|
||||
|
||||
/// Photoshop opens on Quick Selection adding, the Onion Skin view, Real-Time Refinement on, and
|
||||
/// output to the selection.
|
||||
#[test]
|
||||
fn opens_like_photoshop() {
|
||||
let mut app = app_with_selection();
|
||||
crate::menus::invoke(&mut app, &egui::Context::default(), "select.selectAndMask", json!({})).unwrap();
|
||||
let d = ws(&app).describe();
|
||||
assert_eq!((d["tool"].as_str(), d["mode"].as_str(), d["size"].as_f64()), (Some("quick"), Some("add"), Some(30.0)));
|
||||
let s = &d["settings"];
|
||||
assert_eq!((s["view"].as_str(), s["output"].as_str()), (Some("onionSkin"), Some("selection")));
|
||||
assert_eq!((s["realTimeRefinement"].as_bool(), s["highQualityPreview"].as_bool(), s["remember"].as_bool()), (Some(true), Some(false), Some(false)));
|
||||
assert_eq!((s["opacity"]["onionSkin"].as_f64(), s["opacity"]["onBlack"].as_f64()), (Some(50.0), Some(100.0)));
|
||||
assert_eq!(selected(&mut app), 400, "the 20 × 20 selection");
|
||||
assert!(ws(&app).describe()["previewReady"].as_bool().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opening_needs_a_selection_or_a_layer_mask() {
|
||||
let mut app = app_with_selection();
|
||||
app.session.execute("select.deselect", json!({})).unwrap();
|
||||
assert!(open(&mut app).is_err());
|
||||
assert!(app.distort.select_mask.is_none());
|
||||
// `ui` addresses an open workspace only.
|
||||
let e = crate::distort_ui::menu(&mut app, &egui::Context::default(), "select.selectAndMask", &json!({"ui": {}})).unwrap();
|
||||
assert!(e.is_err());
|
||||
}
|
||||
|
||||
/// Every tool's stroke is an edit (the Refine Edge Brush's a stroke), each one undoable.
|
||||
#[test]
|
||||
fn tools_make_edits_and_undo_and_redo_them() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
let before = selected(&mut app);
|
||||
// Quick Selection across the cool half grows the selection over it.
|
||||
ui(&mut app, json!({"stroke": {"points": [[120.0, 50.0], [130.0, 50.0]]}}));
|
||||
let quick = selected(&mut app);
|
||||
assert!(quick > before + 3000, "{before} → {quick}");
|
||||
// Brush, Lasso and Polygonal Lasso subtract with Alt.
|
||||
ui(&mut app, json!({"tool": "brush", "size": 10, "hardness": 50, "stroke": {"points": [[100.0, 10.0], [100.0, 90.0]], "alt": true}}));
|
||||
let brushed = selected(&mut app);
|
||||
assert!(brushed < quick, "{quick} → {brushed}");
|
||||
ui(&mut app, json!({"tool": "lasso", "mode": "subtract", "stroke": {"points": [[140.0, 0.0], [160.0, 0.0], [160.0, 100.0], [140.0, 100.0]]}}));
|
||||
ui(&mut app, json!({"tool": "polygonalLasso", "mode": "add", "stroke": {"points": [[30.0, 30.0], [50.0, 30.0], [50.0, 50.0]]}}));
|
||||
ui(&mut app, json!({"tool": "refineEdge", "stroke": {"points": [[80.0, 20.0], [80.0, 80.0]]}}));
|
||||
let d = ws(&app).describe();
|
||||
assert_eq!((d["edits"].as_u64(), d["strokes"].as_u64(), d["undo"].as_u64()), (Some(4), Some(1), Some(5)));
|
||||
let e = &ws(&app).edits;
|
||||
assert_eq!(
|
||||
(e[1]["tool"].as_str(), e[1]["mode"].as_str(), e[1]["hardness"].as_f64(), e[1]["size"].as_f64()),
|
||||
(Some("brush"), Some("subtract"), Some(50.0), Some(10.0))
|
||||
);
|
||||
assert_eq!((e[2]["tool"].as_str(), e[2]["mode"].as_str()), (Some("lasso"), Some("subtract")));
|
||||
assert_eq!((e[3]["tool"].as_str(), e[3]["points"].as_array().map(Vec::len)), (Some("lasso"), Some(3)));
|
||||
// Undo everything but the Quick Selection stroke, then redo the Brush's.
|
||||
for _ in 0..4 {
|
||||
ui(&mut app, json!({"undo": true}));
|
||||
}
|
||||
assert_eq!(selected(&mut app), quick);
|
||||
ui(&mut app, json!({"redo": true}));
|
||||
assert_eq!(selected(&mut app), brushed);
|
||||
// A new edit drops what could be redone.
|
||||
ui(&mut app, json!({"invert": true}));
|
||||
assert_eq!(ws(&app).describe()["redo"].as_u64(), Some(0));
|
||||
}
|
||||
|
||||
/// Object Selection: a click picks the object under it, a drag the object in the rectangle.
|
||||
#[test]
|
||||
fn object_selection_clicks_and_drags() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ws_mut(&mut app).zoom = 1.0;
|
||||
ui(&mut app, json!({"tool": "object", "stroke": {"points": [[120.0, 50.0], [121.0, 50.0]]}}));
|
||||
ui(&mut app, json!({"stroke": {"points": [[90.0, 10.0], [150.0, 90.0]]}}));
|
||||
let e = &ws(&app).edits;
|
||||
assert_eq!(e[0]["point"], json!([120.0, 50.0]));
|
||||
assert_eq!(e[1]["rect"], json!([90.0, 10.0, 60.0, 80.0]));
|
||||
}
|
||||
|
||||
fn ws_mut(app: &mut PhotocraftApp) -> &mut SelectMaskWorkspace {
|
||||
app.distort.select_mask.as_mut().unwrap()
|
||||
}
|
||||
|
||||
/// Select Subject, Clear Selection and Invert are edits too; Reset drops everything at once,
|
||||
/// undoably.
|
||||
#[test]
|
||||
fn buttons_and_reset() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ui(&mut app, json!({"clearSelection": true}));
|
||||
assert_eq!(selected(&mut app), 0);
|
||||
ui(&mut app, json!({"invert": true}));
|
||||
assert_eq!(selected(&mut app), 160 * 100);
|
||||
ui(&mut app, json!({"selectSubject": true}));
|
||||
assert_eq!(ws(&app).edits.last().and_then(|e| e["tool"].as_str()), Some("subject"));
|
||||
ui(&mut app, json!({"radius": 12, "view": "blackWhite", "remember": true}));
|
||||
let d = ui(&mut app, json!({"reset": true}));
|
||||
assert_eq!((d["edits"].as_u64(), d["settings"]["radius"].as_f64(), d["settings"]["view"].as_str()), (Some(0), Some(0.0), Some("onionSkin")));
|
||||
assert_eq!(d["settings"]["remember"].as_bool(), Some(true), "Reset keeps Remember Settings");
|
||||
assert_eq!(selected(&mut app), 400);
|
||||
let d = ui(&mut app, json!({"undo": true}));
|
||||
assert_eq!((d["edits"].as_u64(), d["settings"]["radius"].as_f64()), (Some(3), Some(12.0)));
|
||||
}
|
||||
|
||||
/// OK runs `select.refineEdge` with the edits, strokes and settings: one history step, the same
|
||||
/// result as the command with those params, and the workspace closes.
|
||||
#[test]
|
||||
fn ok_is_one_step_and_matches_the_command() {
|
||||
let mut app = app_with_selection();
|
||||
let mut direct = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ui(&mut app, json!({"radius": 2, "stroke": {"points": [[120.0, 50.0]]}}));
|
||||
ui(&mut app, json!({"tool": "brush", "stroke": {"points": [[40.0, 60.0], [60.0, 60.0]]}}));
|
||||
let params = commit_params(ws(&app));
|
||||
let steps = app.session.active().unwrap().history.past_len();
|
||||
let r = ui(&mut app, json!({"commit": true}));
|
||||
assert_eq!(r["committed"], json!(true));
|
||||
assert!(app.distort.select_mask.is_none(), "OK closes");
|
||||
assert_eq!(app.session.active().unwrap().history.past_len(), steps + 1);
|
||||
assert_eq!(app.session.active().unwrap().history.undo_label(), Some("Select and Mask"));
|
||||
direct.session.execute(CMD, params).unwrap();
|
||||
for (x, y) in [(5, 5), (120, 50), (50, 60), (50, 80), (79, 50)] {
|
||||
assert_eq!(cov(&app, x, y), cov(&direct, x, y), "({x}, {y})");
|
||||
}
|
||||
assert!(cov(&app, 120, 50) > 0.5 && cov(&app, 50, 60) > 0.5 && cov(&app, 50, 80) < 0.5);
|
||||
}
|
||||
|
||||
/// Cancel leaves the document as it was.
|
||||
#[test]
|
||||
fn cancel_changes_nothing() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ui(&mut app, json!({"invert": true, "radius": 10}));
|
||||
let steps = app.session.active().unwrap().history.past_len();
|
||||
let r = ui(&mut app, json!({"cancel": true}));
|
||||
assert_eq!(r["cancelled"], json!(true));
|
||||
assert!(app.distort.select_mask.is_none());
|
||||
assert_eq!(app.session.active().unwrap().history.past_len(), steps);
|
||||
assert!(cov(&app, 5, 5) > 0.99 && cov(&app, 100, 50) < 0.01);
|
||||
}
|
||||
|
||||
/// Remember Settings keeps the settings for the next time; without it the workspace opens on
|
||||
/// Photoshop's defaults.
|
||||
#[test]
|
||||
fn remember_settings() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ui(&mut app, json!({"remember": true, "radius": 7, "view": "overlay", "overlayColor": [0, 0, 255], "commit": true}));
|
||||
app.session.execute("select.rect", json!({"x": 0, "y": 0, "width": 20, "height": 20})).unwrap();
|
||||
open(&mut app).unwrap();
|
||||
let s = ws(&app).describe()["settings"].clone();
|
||||
assert_eq!((s["radius"].as_f64(), s["view"].as_str(), s["overlayColor"].clone()), (Some(7.0), Some("overlay"), json!([0, 0, 255])));
|
||||
ui(&mut app, json!({"remember": false, "commit": true}));
|
||||
app.session.execute("select.rect", json!({"x": 0, "y": 0, "width": 20, "height": 20})).unwrap();
|
||||
open(&mut app).unwrap();
|
||||
let s = ws(&app).describe()["settings"].clone();
|
||||
assert_eq!((s["radius"].as_f64(), s["view"].as_str()), (Some(0.0), Some("onionSkin")));
|
||||
}
|
||||
|
||||
/// Decontaminate Colors makes new pixels, so it outputs to a new layer (as Photoshop does).
|
||||
#[test]
|
||||
fn decontaminate_outputs_to_a_new_layer() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
let d = ui(&mut app, json!({"decontaminate": true}));
|
||||
assert_eq!(d["settings"]["output"].as_str(), Some("newLayerWithMask"));
|
||||
let d = ui(&mut app, json!({"output": "newDocument"}));
|
||||
assert_eq!(d["settings"]["output"].as_str(), Some("newDocument"));
|
||||
let d = ui(&mut app, json!({"output": "selection"}));
|
||||
assert_eq!(d["settings"]["output"].as_str(), Some("newLayerWithMask"));
|
||||
}
|
||||
|
||||
/// A layer mask without a selection (or the targeted mask) is refined and output to the mask.
|
||||
#[test]
|
||||
fn a_layer_mask_opens_on_the_mask() {
|
||||
let mut app = app_with_selection();
|
||||
app.session.execute("layer.new.layer", json!({})).unwrap();
|
||||
// Revealing the selection uses it up (#8381), leaving the mask alone.
|
||||
app.session.execute("layer.layerMask.revealSelection", json!({})).unwrap();
|
||||
assert!(app.session.active().unwrap().doc.selection.is_none());
|
||||
open(&mut app).unwrap();
|
||||
assert_eq!(ws(&app).describe()["settings"]["output"].as_str(), Some("layerMask"));
|
||||
assert_eq!(selected(&mut app), 400, "the mask is what is shown");
|
||||
}
|
||||
|
||||
/// Bad control params are errors, never a panic, and change nothing.
|
||||
#[test]
|
||||
fn hostile_control_params_are_errors() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
for bad in [
|
||||
json!({"tool": "wand"}),
|
||||
json!({"mode": "intersect"}),
|
||||
json!({"view": "sideways"}),
|
||||
json!({"output": "printer"}),
|
||||
json!({"indicates": "both"}),
|
||||
json!({"stroke": {"points": "x"}}),
|
||||
json!({"stroke": {"points": [[1.0]]}}),
|
||||
] {
|
||||
assert!(control(&mut app, &bad).is_err(), "{bad}");
|
||||
}
|
||||
for odd in [json!({"size": -5}), json!({"size": 1e12}), json!({"hardness": 500}), json!({"radius": 1e9, "opacity": -3}), json!({"stroke": {"points": []}})]
|
||||
{
|
||||
control(&mut app, &odd).unwrap();
|
||||
}
|
||||
let d = ws(&app).describe();
|
||||
assert_eq!((d["tool"].as_str(), d["edits"].as_u64()), (Some("quick"), Some(0)));
|
||||
assert_eq!((d["size"].as_f64(), d["hardness"].as_f64(), d["settings"]["radius"].as_f64()), (Some(5000.0), Some(100.0), Some(250.0)));
|
||||
assert!(control(&mut app, &json!({"waitPreview": true})).is_ok(), "the clamped settings still preview");
|
||||
}
|
||||
|
||||
/// High Quality Preview runs on the document at full size; otherwise on a copy at most 1600 px.
|
||||
#[test]
|
||||
fn high_quality_preview_is_full_size() {
|
||||
let mut app = app_sized(3300, 60);
|
||||
open(&mut app).unwrap();
|
||||
assert_eq!(ws(&app).describe()["proxyScale"].as_u64(), Some(3));
|
||||
let reduced = selected(&mut app);
|
||||
assert!((40..=60).contains(&reduced), "{reduced} reduced px of the 20 × 20 selection");
|
||||
assert_eq!(ui(&mut app, json!({"highQualityPreview": true}))["proxyScale"].as_u64(), Some(1));
|
||||
assert_eq!(selected(&mut app), 400);
|
||||
}
|
||||
|
||||
/// Edits scale with the reduced copy: points, rectangles and sizes by 1 / k.
|
||||
#[test]
|
||||
fn edits_scale_to_the_reduced_copy() {
|
||||
let e = json!({"tool": "quick", "points": [[30.0, 60.0]], "size": 30.0, "rect": [3, 6, 9, 12], "point": [15, 3]});
|
||||
assert_eq!(scale_edit(&e, 3), json!({"tool": "quick", "points": [[10.0, 20.0]], "size": 10.0, "rect": [1.0, 2.0, 3.0, 4.0], "point": [5.0, 1.0]}));
|
||||
assert_eq!(scale_edit(&json!({"size": 2.0}), 4)["size"], json!(1.0), "never below a pixel");
|
||||
assert_eq!(scale_edit(&json!("x"), 2), json!("x"));
|
||||
}
|
||||
|
||||
/// With Real-Time Refinement the stroke being drawn is in the preview before it is released.
|
||||
#[test]
|
||||
fn real_time_refinement_previews_the_stroke_being_drawn() {
|
||||
for real_time in [true, false] {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ui(&mut app, json!({"realTimeRefinement": real_time}));
|
||||
let before = selected(&mut app);
|
||||
crate::distort_ui::pointer(&mut app, ToolEvent::Down { x: 120.0, y: 50.0, pressure: 1.0 }, Modifiers::NONE);
|
||||
crate::distort_ui::pointer(&mut app, ToolEvent::Move { x: 130.0, y: 50.0, pressure: 1.0 }, Modifiers::NONE);
|
||||
let during = selected(&mut app);
|
||||
assert_eq!(during > before, real_time, "real time {real_time}: {before} → {during}");
|
||||
// The preview knows how much of the stroke it shows: the rest is drawn over it.
|
||||
assert_eq!(ws(&app).preview.trail, if real_time { 2 } else { 0 });
|
||||
crate::distort_ui::pointer(&mut app, ToolEvent::Up { x: 130.0, y: 50.0 }, Modifiers::NONE);
|
||||
assert!(ws(&app).trail.is_some(), "the released stroke stays drawn until its preview comes");
|
||||
assert!(selected(&mut app) > before);
|
||||
assert_eq!(ws(&app).edits.len(), 1);
|
||||
assert!(ws(&app).trail.is_none() && ws(&app).preview.trail == usize::MAX, "then the preview shows all of it");
|
||||
}
|
||||
}
|
||||
|
||||
/// The preview keeps the selection after the edits it applied and starts the next from there:
|
||||
/// after undo it starts over.
|
||||
#[test]
|
||||
fn the_preview_reuses_the_edits_it_applied() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ui(&mut app, json!({"stroke": {"points": [[120.0, 50.0]]}}));
|
||||
selected(&mut app);
|
||||
assert_eq!(ws(&app).preview.cache.as_ref().map(|c| c.edits.len()), Some(1));
|
||||
ui(&mut app, json!({"tool": "brush", "stroke": {"points": [[40.0, 60.0]]}}));
|
||||
let both = selected(&mut app);
|
||||
assert_eq!(ws(&app).preview.cache.as_ref().map(|c| c.edits.len()), Some(2));
|
||||
ui(&mut app, json!({"undo": true}));
|
||||
let one = selected(&mut app);
|
||||
assert!(one < both);
|
||||
assert_eq!(ws(&app).preview.cache.as_ref().map(|c| c.edits.len()), Some(1));
|
||||
}
|
||||
|
||||
/// Sends `key` with `modifiers` through the workspace's key handling.
|
||||
fn press(app: &mut PhotocraftApp, ctx: &egui::Context, key: Key, modifiers: Modifiers) {
|
||||
let ev = egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers };
|
||||
let input = egui::RawInput { events: vec![ev], ..Default::default() };
|
||||
ctx.run_ui(input, |ui| keys(app, ui.ctx())).textures_delta.clear();
|
||||
}
|
||||
|
||||
/// Photoshop's keys: W, R, B, L, H, Z pick the tools (Shift+W and Shift+L cycle their slots),
|
||||
/// [ and ] size the brush, the view letters, F, J and P the view, Ctrl+Z undoes.
|
||||
#[test]
|
||||
fn keys_like_photoshop() {
|
||||
let mut app = app_with_selection();
|
||||
let ctx = egui::Context::default();
|
||||
open(&mut app).unwrap();
|
||||
let tool = |app: &PhotocraftApp| ws(app).tool;
|
||||
for (key, mods, want) in [
|
||||
(Key::R, Modifiers::NONE, SmTool::RefineEdge),
|
||||
(Key::B, Modifiers::NONE, SmTool::Brush),
|
||||
(Key::W, Modifiers::NONE, SmTool::Quick),
|
||||
(Key::W, Modifiers::SHIFT, SmTool::Object),
|
||||
(Key::H, Modifiers::NONE, SmTool::Hand),
|
||||
(Key::W, Modifiers::NONE, SmTool::Object),
|
||||
(Key::L, Modifiers::NONE, SmTool::Lasso),
|
||||
(Key::L, Modifiers::SHIFT, SmTool::PolygonalLasso),
|
||||
(Key::Z, Modifiers::NONE, SmTool::Zoom),
|
||||
(Key::L, Modifiers::NONE, SmTool::PolygonalLasso),
|
||||
(Key::B, Modifiers::NONE, SmTool::Brush),
|
||||
] {
|
||||
press(&mut app, &ctx, key, mods);
|
||||
assert_eq!(tool(&app), want, "{mods:?}+{key:?}");
|
||||
}
|
||||
press(&mut app, &ctx, Key::CloseBracket, Modifiers::NONE);
|
||||
assert_eq!(ws(&app).brush_size, 33.0);
|
||||
press(&mut app, &ctx, Key::OpenBracket, Modifiers::NONE);
|
||||
assert_eq!(ws(&app).brush_size, 30.0);
|
||||
let view = |app: &PhotocraftApp| ws(app).opts.view;
|
||||
for (key, want) in [
|
||||
(Key::K, Mode::BlackWhite),
|
||||
(Key::A, Mode::OnBlack),
|
||||
(Key::T, Mode::OnWhite),
|
||||
(Key::V, Mode::Overlay),
|
||||
(Key::Y, Mode::OnLayers),
|
||||
(Key::M, Mode::MarchingAnts),
|
||||
(Key::F, Mode::Overlay),
|
||||
(Key::O, Mode::OnionSkin),
|
||||
] {
|
||||
press(&mut app, &ctx, key, Modifiers::NONE);
|
||||
assert_eq!(view(&app), want, "{key:?}");
|
||||
}
|
||||
press(&mut app, &ctx, Key::J, Modifiers::NONE);
|
||||
press(&mut app, &ctx, Key::P, Modifiers::NONE);
|
||||
assert!(ws(&app).opts.show_edge && ws(&app).opts.show_original);
|
||||
ui(&mut app, json!({"invert": true}));
|
||||
press(&mut app, &ctx, Key::Z, Modifiers::COMMAND);
|
||||
assert_eq!(ws(&app).edits.len(), 0);
|
||||
press(&mut app, &ctx, Key::Z, Modifiers::COMMAND | Modifiers::SHIFT);
|
||||
assert_eq!(ws(&app).edits.len(), 1);
|
||||
}
|
||||
|
||||
/// The Polygonal Lasso takes clicks: Enter closes the polygon (not OK), Esc drops it (not Cancel),
|
||||
/// clicking the first vertex closes it too.
|
||||
#[test]
|
||||
fn polygonal_lasso_enter_and_escape() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ws_mut(&mut app).zoom = 1.0;
|
||||
ui(&mut app, json!({"tool": "polygonalLasso"}));
|
||||
let click = |app: &mut PhotocraftApp, x: f64, y: f64| crate::distort_ui::pointer(app, ToolEvent::Down { x, y, pressure: 1.0 }, Modifiers::NONE);
|
||||
for (x, y) in [(30.0, 30.0), (60.0, 30.0), (60.0, 60.0)] {
|
||||
click(&mut app, x, y);
|
||||
}
|
||||
assert_eq!(ws(&app).describe()["polygon"].as_u64(), Some(3));
|
||||
assert!(enter(&mut app), "Enter closes the polygon");
|
||||
assert!(app.distort.select_mask.is_some(), "and leaves the workspace open");
|
||||
assert_eq!(ws(&app).edits.len(), 1);
|
||||
click(&mut app, 30.0, 30.0);
|
||||
click(&mut app, 60.0, 30.0);
|
||||
escape(&mut app);
|
||||
assert!(app.distort.select_mask.is_some() && ws(&app).poly.is_none(), "Esc drops the polygon only");
|
||||
for (x, y) in [(70.0, 70.0), (90.0, 70.0), (90.0, 90.0), (71.0, 71.0)] {
|
||||
click(&mut app, x, y);
|
||||
}
|
||||
assert_eq!(ws(&app).edits.len(), 2, "clicking the first vertex closes it");
|
||||
escape(&mut app);
|
||||
assert!(app.distort.select_mask.is_none(), "Esc with no polygon cancels");
|
||||
}
|
||||
|
||||
/// The workspace draws: tools on the left, the options bar, the Properties panel with Photoshop's
|
||||
/// sections and buttons; clicking a tool picks it, OK commits.
|
||||
#[test]
|
||||
fn renders_photoshops_layout() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(1400.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut PhotocraftApp| {
|
||||
let ctx = ui.ctx().clone();
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
show(app, &ctx);
|
||||
},
|
||||
app,
|
||||
);
|
||||
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
|
||||
h.run_steps(4);
|
||||
for label in [
|
||||
"Remember Settings",
|
||||
"View Mode",
|
||||
"Real-Time Refinement",
|
||||
"High Quality Preview",
|
||||
"Refine Mode",
|
||||
"Color Aware",
|
||||
"Edge Detection",
|
||||
"Smart Radius",
|
||||
"Global Refinements",
|
||||
"Clear Selection",
|
||||
"Invert",
|
||||
"Output Settings",
|
||||
"Decontaminate Colors",
|
||||
"Select Subject",
|
||||
"Refine Hair",
|
||||
"Sample All Layers",
|
||||
"OK",
|
||||
"Cancel",
|
||||
] {
|
||||
assert!(h.query_by_label_contains(label).is_some(), "{label} is shown");
|
||||
}
|
||||
assert!(h.get_by_label("Refine Hair").accesskit_node().is_disabled(), "Refine Hair is greyed out");
|
||||
h.get_by_label("Brush Tool (B)").click();
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.state().distort.select_mask.as_ref().map(|w| w.tool), Some(SmTool::Brush));
|
||||
assert!(h.query_by_label_contains("Hardness").is_some(), "the Brush's options bar");
|
||||
h.get_by_label("Invert").click();
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.state().distort.select_mask.as_ref().map(|w| w.edits.len()), Some(1));
|
||||
h.get_by_label("OK").click();
|
||||
h.run_steps(2);
|
||||
assert!(h.state().distort.select_mask.is_none(), "OK closes");
|
||||
let app = h.state();
|
||||
assert!(cov(app, 5, 5) < 0.01 && cov(app, 100, 50) > 0.99, "the inverted selection");
|
||||
}
|
||||
|
||||
/// Panning shows Photoshop's hand: open while Space is held (or the Hand tool is picked), closed
|
||||
/// while dragging; and Space doesn't press the panel button clicked last.
|
||||
#[test]
|
||||
fn panning_shows_the_hand() {
|
||||
use egui::{PointerButton, Pos2};
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
ui(&mut app, json!({"tool": "brush"}));
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(1400.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut PhotocraftApp| {
|
||||
let ctx = ui.ctx().clone();
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
crate::distort_ui::keys(app, &ctx);
|
||||
keys(app, &ctx);
|
||||
show(app, &ctx);
|
||||
},
|
||||
app,
|
||||
);
|
||||
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
|
||||
h.run_steps(4);
|
||||
// Click Invert, then move over the image.
|
||||
h.get_by_label("Invert").click();
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.state().distort.select_mask.as_ref().map(|w| w.edits.len()), Some(1));
|
||||
let over = Pos2::new(LEFT_W + 300.0, BAR_H + TAB_H + 300.0);
|
||||
h.event(egui::Event::PointerMoved(over));
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.output().platform_output.cursor_icon, egui::CursorIcon::None, "the brush's own cursor");
|
||||
let space = |h: &mut egui_kittest::Harness<'_, PhotocraftApp>, pressed: bool| {
|
||||
h.event(egui::Event::Key { key: egui::Key::Space, physical_key: None, pressed, repeat: false, modifiers: Modifiers::NONE });
|
||||
h.run_steps(1);
|
||||
};
|
||||
space(&mut h, true);
|
||||
assert_eq!(h.output().platform_output.cursor_icon, egui::CursorIcon::Grab, "Space: the open hand");
|
||||
assert_eq!(h.state().distort.select_mask.as_ref().map(|w| w.edits.len()), Some(1), "Space didn't press Invert again");
|
||||
let centre = h.state().distort.select_mask.as_ref().map(|w| w.center).unwrap();
|
||||
h.event(egui::Event::PointerButton { pos: over, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });
|
||||
h.run_steps(1);
|
||||
for dx in [5.0, 20.0, 40.0] {
|
||||
h.event(egui::Event::PointerMoved(Pos2::new(over.x + dx, over.y)));
|
||||
h.run_steps(1);
|
||||
}
|
||||
assert_eq!(h.output().platform_output.cursor_icon, egui::CursorIcon::Grabbing, "dragging: the closed hand");
|
||||
h.event(egui::Event::PointerButton { pos: Pos2::new(over.x + 40.0, over.y), button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });
|
||||
h.run_steps(1);
|
||||
space(&mut h, false);
|
||||
let w = h.state().distort.select_mask.as_ref().unwrap();
|
||||
assert!(w.center[0] < centre[0], "the view panned: {:?} → {:?}", centre, w.center);
|
||||
assert!(w.edits.len() == 1 && w.strokes.is_empty(), "panning painted nothing");
|
||||
// The Hand tool shows the open hand without Space.
|
||||
h.state_mut().distort.select_mask.as_mut().unwrap().pick(SmTool::Hand);
|
||||
h.event(egui::Event::PointerMoved(over));
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.output().platform_output.cursor_icon, egui::CursorIcon::Grab);
|
||||
}
|
||||
|
||||
/// The greyed Object Aware and Refine Hair say why they can't be used.
|
||||
#[test]
|
||||
fn greyed_controls_explain_themselves() {
|
||||
let mut app = app_with_selection();
|
||||
open(&mut app).unwrap();
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(1400.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut PhotocraftApp| {
|
||||
let ctx = ui.ctx().clone();
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
show(app, &ctx);
|
||||
},
|
||||
app,
|
||||
);
|
||||
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
|
||||
h.run_steps(4);
|
||||
for (label, why) in [("Object Aware", "segmentation model"), ("Refine Hair", "hair detection")] {
|
||||
assert!(h.get_by_label(label).accesskit_node().is_disabled(), "{label} is greyed");
|
||||
assert!(h.query_by_label_contains(why).is_none(), "{label}: no tooltip before hovering");
|
||||
let at = h.get_by_label(label).rect().center();
|
||||
h.hover_at(at);
|
||||
h.run_steps(8);
|
||||
assert!(h.query_by_label_contains(why).is_some(), "{label}: hovering says why");
|
||||
h.hover_at(egui::pos2(700.0, 450.0));
|
||||
h.run_steps(4);
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ impl Mode {
|
||||
Mode::ALL.into_iter().find(|m| m.id() == id)
|
||||
}
|
||||
|
||||
fn label(self) -> &'static str {
|
||||
pub(crate) fn label(self) -> &'static str {
|
||||
match self {
|
||||
Mode::OnionSkin => tl!("Onion Skin"),
|
||||
Mode::MarchingAnts => tl!("Marching Ants"),
|
||||
@@ -70,7 +70,7 @@ impl Mode {
|
||||
}
|
||||
|
||||
/// The single-letter key that picks this view.
|
||||
fn key(self) -> egui::Key {
|
||||
pub(crate) fn key(self) -> egui::Key {
|
||||
match self {
|
||||
Mode::OnionSkin => egui::Key::O,
|
||||
Mode::MarchingAnts => egui::Key::M,
|
||||
@@ -83,7 +83,7 @@ impl Mode {
|
||||
}
|
||||
|
||||
/// The view's opacity (percent) until it is changed; `None` for views without one.
|
||||
fn default_opacity(self) -> Option<f32> {
|
||||
pub(crate) fn default_opacity(self) -> Option<f32> {
|
||||
match self {
|
||||
Mode::OnionSkin | Mode::Overlay => Some(50.0),
|
||||
Mode::OnBlack | Mode::OnWhite => Some(100.0),
|
||||
@@ -91,7 +91,7 @@ impl Mode {
|
||||
}
|
||||
}
|
||||
|
||||
fn next(self) -> Mode {
|
||||
pub(crate) fn next(self) -> Mode {
|
||||
let i = Mode::ALL.iter().position(|m| *m == self).unwrap_or(0);
|
||||
Mode::ALL.get(i + 1).copied().unwrap_or(Mode::OnionSkin)
|
||||
}
|
||||
@@ -425,6 +425,10 @@ struct View {
|
||||
opacity: f32,
|
||||
show_edge: bool,
|
||||
show_original: bool,
|
||||
/// Overlay's colour (Photoshop's default rubylith red) and whether it marks the selected
|
||||
/// areas rather than the masked ones.
|
||||
color: Color,
|
||||
selected: bool,
|
||||
}
|
||||
|
||||
impl View {
|
||||
@@ -436,6 +440,16 @@ impl View {
|
||||
opacity: v.and_then(|v| v.get("opacity")).and_then(Value::as_f64).filter(|o| o.is_finite()).unwrap_or(0.5).clamp(0.0, 1.0) as f32,
|
||||
show_edge: b("showEdge"),
|
||||
show_original: b("showOriginal"),
|
||||
color: v
|
||||
.and_then(|v| v.get("color"))
|
||||
.and_then(Value::as_array)
|
||||
.filter(|c| c.len() == 3)
|
||||
.and_then(|c| {
|
||||
let ch = |i: usize| c.get(i).and_then(Value::as_f64).filter(|v| v.is_finite()).map(|v| v.clamp(0.0, 1.0) as f32);
|
||||
Some(Color::rgb(ch(0)?, ch(1)?, ch(2)?))
|
||||
})
|
||||
.unwrap_or(Color::rgb(1.0, 0.0, 0.0)),
|
||||
selected: v.and_then(|v| v.get("indicates")).and_then(Value::as_str) == Some("selected"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -448,9 +462,21 @@ fn length(params: &Value, key: &str, k: u32) -> f64 {
|
||||
/// The preview of the Select and Mask dialog for `doc`: the proxy reduced by `k`, shown in the
|
||||
/// requested view. `None` when the refinement fails or is cancelled.
|
||||
pub fn preview_document(doc: &Document, active: Option<LayerId>, params: &Value, k: u32, cancel: Option<&photocraft_engine::jobs::JobCtx>) -> Option<Document> {
|
||||
let k = k.max(1);
|
||||
preview_proxy(crate::proxy::proxy_document(doc, k), active, params, k, cancel)
|
||||
}
|
||||
|
||||
/// [`preview_document`] on `proxy`, the document already reduced by `k` (the Select and Mask
|
||||
/// workspace builds it itself, its selection already carrying the workspace's tool edits).
|
||||
pub fn preview_proxy(
|
||||
mut proxy: Document,
|
||||
active: Option<LayerId>,
|
||||
params: &Value,
|
||||
k: u32,
|
||||
cancel: Option<&photocraft_engine::jobs::JobCtx>,
|
||||
) -> Option<Document> {
|
||||
let view = View::of(params);
|
||||
let k = k.max(1);
|
||||
let mut proxy = crate::proxy::proxy_document(doc, k);
|
||||
let active = active.filter(|id| proxy.layer(*id).is_some());
|
||||
// What Select and Mask starts from: the selection, else the active layer's mask.
|
||||
let original = proxy.selection.clone().or_else(|| active.and_then(|id| proxy.layer(id)).and_then(|l| l.mask.as_ref()).map(|m| m.surface.clone()));
|
||||
@@ -546,7 +572,10 @@ fn show(doc: &mut Document, active: Option<LayerId>, view: &View, coverage: &Cov
|
||||
doc.selection = Some(coverage.surface(|v| v));
|
||||
match view.mode {
|
||||
Mode::MarchingAnts => {}
|
||||
Mode::Overlay => doc.layers.push(veil("Overlay", Color::rgb(1.0, 0.0, 0.0), o, Some(coverage.surface(|v| 1.0 - v)))),
|
||||
Mode::Overlay => {
|
||||
let marked = if view.selected { coverage.surface(|v| v) } else { coverage.surface(|v| 1.0 - v) };
|
||||
doc.layers.push(veil("Overlay", view.color, o, Some(marked)));
|
||||
}
|
||||
Mode::OnBlack => doc.layers.push(veil("On Black", Color::BLACK, o, Some(coverage.surface(|v| 1.0 - v)))),
|
||||
Mode::OnWhite => doc.layers.push(veil("On White", Color::WHITE, o, Some(coverage.surface(|v| 1.0 - v)))),
|
||||
Mode::BlackWhite => {
|
||||
@@ -692,6 +721,24 @@ mod tests {
|
||||
assert!(pixel(&edge, 35, 10)[0] > 0.99 && pixel(&edge, 55, 10)[0] < 0.01, "Show Edge includes the painted area");
|
||||
}
|
||||
|
||||
/// Overlay takes Photoshop's colour swatch and Indicates: the masked (default) or the selected
|
||||
/// areas carry the tint.
|
||||
#[test]
|
||||
fn overlay_colour_and_what_it_indicates() {
|
||||
let doc = half_selected();
|
||||
let active = doc.layers.first().map(|l| l.id);
|
||||
let near = |a: &[f32], b: &[f32]| a.iter().zip(b).all(|(a, b)| (a - b).abs() < 0.02);
|
||||
let view = |indicates: &str| json!({"__view": {"mode": "overlay", "opacity": 1.0, "color": [0.0, 0.0, 1.0], "indicates": indicates}});
|
||||
let masked = preview_document(&doc, active, &view("masked"), 1, None).expect("a preview");
|
||||
assert!(near(&pixel(&masked, 35, 10), &[0.0, 0.0, 1.0, 1.0]) && near(&pixel(&masked, 5, 10), &[1.0, 1.0, 1.0, 1.0]));
|
||||
let selected = preview_document(&doc, active, &view("selected"), 1, None).expect("a preview");
|
||||
assert!(near(&pixel(&selected, 5, 10), &[0.0, 0.0, 1.0, 1.0]) && near(&pixel(&selected, 35, 10), &[1.0, 1.0, 1.0, 1.0]));
|
||||
// A hostile colour falls back to red.
|
||||
let bad = json!({"__view": {"mode": "overlay", "opacity": 1.0, "color": ["x", 2, null]}});
|
||||
let red = preview_document(&doc, active, &bad, 1, None).expect("a preview");
|
||||
assert!(near(&pixel(&red, 35, 10), &[1.0, 0.0, 0.0, 1.0]));
|
||||
}
|
||||
|
||||
/// Show Edge shows the band around the selection's edge; Show Original the unrefined selection.
|
||||
#[test]
|
||||
fn show_edge_and_show_original() {
|
||||
|
||||
@@ -472,11 +472,15 @@ pub fn handle(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
if app.distort.caf.is_some() && !ctx.text_edit_focused() {
|
||||
crate::caf_ui::keys(app, ctx);
|
||||
}
|
||||
// And Select and Mask's tools, views and brush size.
|
||||
if app.distort.select_mask.is_some() && !ctx.text_edit_focused() {
|
||||
crate::select_mask_ui::keys(app, ctx);
|
||||
}
|
||||
use crate::shortcut_dispatch::{Focus, dispatch_pressed};
|
||||
let focus = Focus::of(ctx);
|
||||
// Dialogs (and Liquify's panel while one of its controls has focus) keep canvas zoom; a
|
||||
// focused text field keeps its keys.
|
||||
let liquify_focus = (app.distort.liquify.is_some() || app.distort.caf.is_some()) && focus != Focus::None;
|
||||
let liquify_focus = (app.distort.liquify.is_some() || app.distort.caf.is_some() || app.distort.select_mask.is_some()) && focus != Focus::None;
|
||||
if liquify_focus || !app.ui.dialogs.is_empty() || app.discard.is_some() {
|
||||
if focus != Focus::Text {
|
||||
nav_keys(app, ctx);
|
||||
|
||||
@@ -70,6 +70,7 @@ The transport is `apps/photocraft/src/control_server.rs`, and the handlers are i
|
||||
- A save dialog's answer that PhotoCraft changes, by giving a name without an extension the suggested file's or by lowercasing the extension (Preferences › File Handling › Lowercase Extension), opens a replace prompt when a file exists under the changed name: a dialog with `__replaceSaved`, `message`, `detail` and `path` (the file the save would replace). `ui.dialog.confirm` writes the file; `ui.dialog.cancel` ends the save without writing, as Cancel in the save dialog does. The file dialog counts as open until the prompt is answered. A name that differs only in letter case and reaches the same file (Windows and macOS by default) does not open it.
|
||||
- Layer Style (`layerStyle {effect?}` opens on that effect kind): the fields hold the dialog's whole state, so agents read and drive it like a user. `effects` lists every effect instance in the layer's order as `{id, kind, on, params, fx}` (`fx` is the effect snapshot the dialog loaded; OK edits that snapshot with `params`, so anything the dialog doesn't model survives). `selected` picks the page (`blendingOptions` or an instance id), `preview` (default on) gates the live canvas preview, `p:blendingOptions` edits blend mode/opacity/fill opacity, and `patternList` names the usable patterns. OK replaces the layer's effects in one step (`layer.layerStyle.replace`); Cancel discards. "New Style…" saves the pending state via `style.presets.new {effects}`, a swatch click applies a style preset, and Make/Reset Default use `layer.layerStyle.makeDefault` / `layer.layerStyle.defaultFor`
|
||||
- Preferences (`ui.menu.invoke {id: "edit.preferences.interface"}`) exposes the sections in its `values` field. Apply (`ui.dialog.apply`) and OK (`ui.dialog.confirm`) on Preferences are refused over control because automation denies whole-preferences updates and filesystem-bearing preference sections. A refused `ui.dialog.apply` returns an error and keeps the dialog open; a refused `ui.dialog.confirm` returns an error but closes and removes the dialog. `ui.dialog.cancel` closes the dialog without saving. Individual safe preferences can instead be changed with `engine.execute` using `prefs.set` (e.g. `{"command": "prefs.set", "params": {"path": "interface.showTooltips", "value": false}}`). Settings marked for the next launch still require a restart.
|
||||
- Select › Select and Mask… (`ui.menu.invoke {id: "select.selectAndMask"}`, Ctrl+Alt+R) opens Photoshop's workspace; `ui.inspect` reports it as `distort.selectAndMask`. Drive it with `ui.menu.invoke {id: "select.selectAndMask", params: {ui: {…}}}`: `tool` (`quick|refineEdge|brush|object|lasso|polygonalLasso|hand|zoom`), `mode` (`add|subtract`), `size`, `hardness`, `sampleAllLayers`, `stroke: {points: [[x,y],…], alt?}` (a drag with the current tool in document px: Object Selection takes a click or the rectangle's corners, the lassos the polygon), `selectSubject`, `clearSelection`, `invert`, the settings (`view`, `opacity`, `showEdge`, `showOriginal`, `realTimeRefinement`, `highQualityPreview`, `overlayColor`, `indicates`, `radius`, `smartRadius`, `smooth`, `feather`, `contrast`, `shiftEdge`, `decontaminate`, `amount`, `output`, `remember`), `undo`, `redo`, `reset`, `waitPreview`, `commit` (OK: `select.refineEdge` with the workspace's `edits` and `refineStrokes`, one history step) and `cancel`. The reply describes the workspace (`edits`, `strokes`, `selectedProxyPixels`, `previewReady`, …).
|
||||
- Edit › Fill… (`ui.menu.invoke {id: "edit.fill"}`, Shift+F5, Shift+Backspace) opens the Fill dialog; its fields are `edit.fill`'s params (`contents`, `color`, `pattern`, `colorAdaptation`, `mode`, `opacity`, `preserveTransparency`), and OK remembers them in the preferences (`dialogs["edit.fill"]`).
|
||||
- Save for Web (`ui.menu.invoke {id: "file.export.saveForWebLegacy"}`) is resizable with independently scrolling settings. Dialog fields `__view` (`original|optimized|2up|4up`), `__zoom` (`null` = Fit, otherwise a factor; 1 = 100% in physical display pixels), and `__center: [u,v]` control the shared preview navigation. `__previewRects` reports pane rectangles in screen points. Drag a preview to pan, scroll/pinch to zoom at the pointer, or double-click to fit. GIF/PNG-8 expose `colorTable: ["#rrggbb", …]` (opaque source entries) and `colorTableEdits: {"0":"#rrggbb", …}` (zero-based replacements after quantization). A swatch opens a color picker; edits update the preview and saved file without remapping pixel indices or changing the document. Reset clears replacements. Changing palette/size/matte/transparency settings regenerates the table and clears index-based edits. Previews and generated tables use a bounded 2048-pixel proxy; full-size export uses that explicit table unchanged. `__paletteApproximate` reports proxy-derived palette generation, and enlarged proxy previews are labelled. The engine export command accepts the same table/edit parameters; its no-path estimate returns the source `colorTable` and `transparentIndex` as well as size statistics. Opening a new dialog does not carry a previous image's table across. Image Size has `width` and `height` (px), `percent` and `resample` (`nearest|bilinear|bicubic|bicubicSmoother|bicubicSharper`, default `bicubic`); `__constrain` (default true at each opening) links the two sides in proportion. A side edit sets both sides and removes `percent`, which the export command otherwise applies first; a Percent edit sets both sides from it. Each opening starts at the document's full size, while `resample` is remembered with the encoding choices. The document is never resized.
|
||||
- A pixel tool pressed on a type, shape, Smart Object or fill layer (e.g. through `ui.pointer`) opens the "Rasterize?" prompt instead of painting: a dialog with `__rasterize` (`type|shape|smartObject|fill`), `message`, `layer`, `tool` and `at`. `ui.dialog.confirm` runs the `layer.rasterize.*` command and then paints at `at` (two history states, `{"rasterized", "painted"}`); `ui.dialog.cancel` does nothing.
|
||||
|
||||
+6
-3
@@ -1,6 +1,6 @@
|
||||
# Where PhotoCraft falls short of Photoshop
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-22 · **Change:** minor (G8: paragraph direction buttons in the Paragraph panel and options bar, TYPE-218-2 partial; G1: 32-bit Hue/Saturation and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; G11: compound layer properties export as separate Photoshop Set events, rename last, #8304; G11: Batch and droplets take the result at the action's Save step, so actions ending in Save As and Close work; G11: `.atn` steps that switch to another open document import, play and save back, #7103; G14: the Nikon D4 white level follows the sample depth, so 12-bit D4 NEFs no longer open 2.6 stops dark, #5978; G14: a Nikon NEF's Adobe RGB preview is read as Adobe RGB (maker-note ColorSpace 0x001E), #5987; Apply Layer Comp action mapping, #7101; G10: JPEG Options dialog landed, FILE-215-19 partial (no Matte, progressive Scans or size preview); G10: Cineon write; G10: DPX read and write, #1049, Cineon and Amiga IFF read; Classical Object Finder improvement; learned segmentation remains open; G4: named, stateful section locks and visible keyboard focus in Brush Settings; G4: independent Brush Pose tilt-axis overrides, #3825 partial; G4: Transfer Mixer-only controls, #3825 partial; G9: Preferences › File Handling › Save in Background takes effect, #6207, 24 of 169 preferences do nothing; G7: Content-Aware Move previews every selection the command takes, coarse then exact, TOOL-213-4 done, #6680; G4: Pattern Stamp and Background Eraser draw live, TOOL-213-7; G9: Animated Zoom pref read: holding the Zoom tool zooms continuously, #6210, prefs that do nothing 25 of 166; G2: a cancelled 24 MP Gaussian Blur job stops in at most 44 ms, P25 under its 200 ms budget in local runs, baseline not re-run, #6205; G1: generated large-file fixtures, a 4.38 GB PSB opens on Windows through io, FILE-216-2 done, #5107; G9: fill and adjustment layers copy and paste whole, #2344; G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-23 · **Change:** minor (G7: Select and Mask is Photoshop's workspace with its own tools, #7069, #8148, TOOL-214-1 still partial; G8: paragraph direction buttons in the Paragraph panel and options bar, TYPE-218-2 partial; G1: 32-bit Hue/Saturation and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; G11: compound layer properties export as separate Photoshop Set events, rename last, #8304; G11: Batch and droplets take the result at the action's Save step, so actions ending in Save As and Close work; G11: `.atn` steps that switch to another open document import, play and save back, #7103; G14: the Nikon D4 white level follows the sample depth, so 12-bit D4 NEFs no longer open 2.6 stops dark, #5978; G14: a Nikon NEF's Adobe RGB preview is read as Adobe RGB (maker-note ColorSpace 0x001E), #5987; Apply Layer Comp action mapping, #7101; G10: JPEG Options dialog landed, FILE-215-19 partial (no Matte, progressive Scans or size preview); G10: Cineon write; G10: DPX read and write, #1049, Cineon and Amiga IFF read; Classical Object Finder improvement; learned segmentation remains open; G4: named, stateful section locks and visible keyboard focus in Brush Settings; G4: independent Brush Pose tilt-axis overrides, #3825 partial; G4: Transfer Mixer-only controls, #3825 partial; G9: Preferences › File Handling › Save in Background takes effect, #6207, 24 of 169 preferences do nothing; G7: Content-Aware Move previews every selection the command takes, coarse then exact, TOOL-213-4 done, #6680; G4: Pattern Stamp and Background Eraser draw live, TOOL-213-7; G9: Animated Zoom pref read: holding the Zoom tool zooms continuously, #6210, prefs that do nothing 25 of 166; G2: a cancelled 24 MP Gaussian Blur job stops in at most 44 ms, P25 under its 200 ms budget in local runs, baseline not re-run, #6205; G1: generated large-file fixtures, a 4.38 GB PSB opens on Windows through io, FILE-216-2 done, #5107; G9: fill and adjustment layers copy and paste whole, #2344; G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026
|
||||
|
||||
Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impact
|
||||
on the way to beta. This is the work list agents pick from: take the highest-ranked entry that
|
||||
@@ -69,8 +69,10 @@ what an agent can't finish alone.
|
||||
- **Estimate:** 60–100 h (2–9 h each, per the calibration).
|
||||
|
||||
### G7. Workspaces shown as parameter dialogs
|
||||
- **Missing:** Select and Mask workspace layout
|
||||
(TOOL-214-1, Refine Hair #2671; its view modes preview live since #1754, Refine Edge Brush #2972); Content-Aware Fill workspace with a paintable sampling area
|
||||
- **Missing:** Select and Mask's Refine Hair (#2671), Object Aware refine mode (#2788) and Presets
|
||||
(TOOL-214-1; the workspace landed 2026-10-23, #7069, #8148: Photoshop's layout with its own
|
||||
Quick Selection, Refine Edge Brush, Brush, Object Selection, Lasso and Polygonal Lasso, Hand and
|
||||
Zoom, the view modes since #1754, Real-Time Refinement and High Quality Preview); Content-Aware Fill workspace with a paintable sampling area
|
||||
(TOOL-214-15); Vanishing Point plane editor (TOOL-214-14). Content-Aware Move's live preview
|
||||
of the result is done (TOOL-213-4, 2026-10-16, #6680: every selection the command takes, coarse
|
||||
first for large ones, then the exact result), as are Transform On Drop and Content-Aware Scale
|
||||
@@ -346,6 +348,7 @@ what an agent can't finish alone.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-23 | minor | G7: Select and Mask workspace (Photoshop's layout, its tools as `select.refineEdge` edits, Real-Time Refinement, High Quality Preview), #7069, #8148; Refine Hair, Object Aware and Presets remain; no estimate changed |
|
||||
| 2026-10-22 | minor | G1: 32-bit Hue/Saturation unclipped with Photoshop's saturation factor, bright colours keep their hue, Colorize's saturation scaled by 1 − \|Lightness\|; photoshop rgb32 hue-saturation and hue-saturation-colorize pass; Photoshop-oracle floor 188 → 190 of 258 (#5781) |
|
||||
| 2026-10-21 | minor | #8304: compound layer properties export as separate Set events, rename last; independent Photoshop replay pending; percentages and estimates unchanged |
|
||||
| 2026-10-21 | minor | G11: Batch and droplets take the result at the action's recorded Save / Save As step (Photoshop's "Override Action 'Save As' Commands"); estimate unchanged |
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ Corpus floors (`crates/io/tests/it/corpus.rs`): the enforced minimums; the corpu
|
||||
| TOOL-213-13 | Brush regression tests: no seams, hard edge, zero-scatter defaults, ABR never black | done | [#213](https://github.com/storytold/photocraft/issues/213) | Seam, hard-edge and zero-scatter tests in brush_tests.rs; ABR tip colour test in abr_map/tests.rs |
|
||||
| TOOL-213-14 | Tablet: no OS arrow cursor over the canvas on macOS, Windows and Linux | partial | [#213](https://github.com/storytold/photocraft/issues/213) | Brush tools set CursorIcon::None (canvas.rs:1259-1275); not verified per OS |
|
||||
| TOOL-213-18 | Pattern Stamp tool: sibling of Clone Stamp in the S flyout | done | [#213](https://github.com/storytold/photocraft/issues/213) | Tool::PatternStamp in the S group; paint.patternStamp stamps the Patterns-panel tile with Aligned and Impressionist (an approximation: it jitters each dab's tile phase, not Photoshop's smeared impressionist look); engine tests cover depths, seams, hostile input |
|
||||
| TOOL-214-1 | Select and Mask workspace: view modes, Refine Edge brush, 6 outputs | partial | [#214](https://github.com/storytold/photocraft/issues/214) | select.refineEdge dialog with a live preview in Photoshop's view modes: Onion Skin, Marching Ants, Overlay, On Black, On White, Black & White, On Layers, per-view Opacity, Show Edge (J), Show Original (P), F cycles, X shows the image (select_mask_view.rs, #1754); Refine Edge Brush (R, size, Expand Detection Area / Restore Original Edge, Alt swaps) paints select.refineEdge refineStrokes, estimated by colour-line matting (matting/brush.rs, #2972); outputs Selection, Layer Mask, New Layer, New Layer with Mask, New Document, New Document with Mask (#2998); the workspace tools Quick Selection, Brush, Lasso, Object Selection, Select Subject, Clear Selection and Invert run as select.refineEdge edits, drivable by agents (#7069); no workspace layout or toolbar yet |
|
||||
| TOOL-214-1 | Select and Mask workspace: view modes, Refine Edge brush, 6 outputs | partial | [#214](https://github.com/storytold/photocraft/issues/214) | select.refineEdge dialog with a live preview in Photoshop's view modes: Onion Skin, Marching Ants, Overlay, On Black, On White, Black & White, On Layers, per-view Opacity, Show Edge (J), Show Original (P), F cycles, X shows the image (select_mask_view.rs, #1754); Refine Edge Brush (R, size, Expand Detection Area / Restore Original Edge, Alt swaps) paints select.refineEdge refineStrokes, estimated by colour-line matting (matting/brush.rs, #2972); outputs Selection, Layer Mask, New Layer, New Layer with Mask, New Document, New Document with Mask (#2998); Photoshop's workspace (select_mask_ui.rs, #7069, #8148): options bar, tools Quick Selection W, Refine Edge Brush R, Brush B, Object Selection W, Lasso and Polygonal Lasso L, Hand H, Zoom Z, Properties with Remember Settings, View Mode (Real-Time Refinement, High Quality Preview, Overlay colour and Indicates), Refine Mode, Edge Detection, Global Refinements with Clear Selection and Invert, Output Settings; the tools run as select.refineEdge edits; Ctrl+Z per edit; no Refine Hair (#2671), Object Aware (#2788) or Presets |
|
||||
| TOOL-214-2 | Marquee: Shift square, Alt from centre, live W x H readout | done | [#214](https://github.com/storytold/photocraft/issues/214) | canvas.rs marquee_corners: Shift square or circle, Alt from the centre, live W x H readout beside the cursor (marquee_readout); marquee_tests.rs |
|
||||
| TOOL-214-3 | Color Range test: Sampled Colors at Fuzziness 0 selects the exact match only | done | [#214](https://github.com/storytold/photocraft/issues/214) | color_range_fuzziness_zero_selects_exact_match_only in selection_cmds.rs asserts exact match is selected and 1-level-off pixels are rejected at fuzziness 0; tonal presets covered in color_range_presets |
|
||||
| TOOL-214-4 | Move tool: box-select layers, Auto-Select hover outline, double-click fit, drag to a tab | partial | [#214](https://github.com/storytold/photocraft/issues/214) | Auto-Select hover outline (Preferences › Tools › Show Highlight on Rollover, #2834) and box-select layers from an empty spot (move_box.rs:59, layer.selectInRect, #2844) done; dragging layers with the Move tool (or from the Layers panel) onto another document's tab copies them there (layer_transfer.rs:162, layer.copyToDocument, #589/#851); double-click fit and dragging a selection's pixels to another document open |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# PhotoCraft vs Adobe Photoshop: target-app parity
|
||||
|
||||
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-21 · **Change:** minor (compound layer properties export as separate Photoshop Set events, #8304; JPEG Options dialog landed, FILE-215-19 partial; Print › Functions › Bleed through `file.print`; Content-Aware Move live preview for every selection size, TOOL-213-4 done, #6680; retouching evidence: Pattern Stamp and Background Eraser draw live, only the Mixer Brush is left of TOOL-213-7; fill and adjustment layers copy and paste whole, UI-217-23 partial, #2344; shape layers take Density and Feather, TOOL-214-12 done, #5846; on-canvas corner radius widgets, TOOL-214-12; `.atn` import maps 112 events; Free Transform H/V skew fields; stale rows corrected against `main` and the scorecard, estimates unchanged; Photoshop Actions `.atn` load and save; 2026-10-10: Tilt-Shift measurements added; earlier the same day: major, full re-measure against Photoshop 2026 27.11.0; merged `parity-estimate.md` and the roadmap's honest assessment; stale missing-tool rows corrected: Color Replacement and Red Eye are live toolbar tools, Frame landed; percentages unchanged) · **Target:** Adobe Photoshop 2026
|
||||
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-23 · **Change:** minor (Select and Mask workspace with its own tools, #7069, #8148, percentages not re-measured; compound layer properties export as separate Photoshop Set events, #8304; JPEG Options dialog landed, FILE-215-19 partial; Print › Functions › Bleed through `file.print`; Content-Aware Move live preview for every selection size, TOOL-213-4 done, #6680; retouching evidence: Pattern Stamp and Background Eraser draw live, only the Mixer Brush is left of TOOL-213-7; fill and adjustment layers copy and paste whole, UI-217-23 partial, #2344; shape layers take Density and Feather, TOOL-214-12 done, #5846; on-canvas corner radius widgets, TOOL-214-12; `.atn` import maps 112 events; Free Transform H/V skew fields; stale rows corrected against `main` and the scorecard, estimates unchanged; Photoshop Actions `.atn` load and save; 2026-10-10: Tilt-Shift measurements added; earlier the same day: major, full re-measure against Photoshop 2026 27.11.0; merged `parity-estimate.md` and the roadmap's honest assessment; stale missing-tool rows corrected: Color Replacement and Red Eye are live toolbar tools, Frame landed; percentages unchanged) · **Target:** Adobe Photoshop 2026
|
||||
|
||||
The authoritative answer to "how close is PhotoCraft to Photoshop, and how much work is left". The
|
||||
one-page summary is [`ROADMAP.md`](../ROADMAP.md); the ranked work list is [`gaps.md`](gaps.md);
|
||||
@@ -75,7 +75,7 @@ Weights reflect what a working Photoshop user depends on (photographers, retouch
|
||||
|
||||
| Dimension | Weight | % ready | Remaining (agent-h) | Evidence | Detail |
|
||||
|---|---:|---:|---:|---|---|
|
||||
| Features in depth (tools, layers, selections, type, filters, transforms) | 25% | 55% | 600–1,000 | Scorecard checklists: Tools 20 done / 15 partial / 6 missing, Type 0 / 3 / 6, Automation 3 / 2 / 6. 14 tools missing; Select and Mask, Vanishing Point and Content-Aware Fill are parameter dialogs, not workspaces; type on a path, manual kerning, RTL paragraphs missing | [gaps.md](gaps.md) |
|
||||
| Features in depth (tools, layers, selections, type, filters, transforms) | 25% | 55% | 600–1,000 | Scorecard checklists: Tools 20 done / 15 partial / 6 missing, Type 0 / 3 / 6, Automation 3 / 2 / 6. 14 tools missing; Vanishing Point and Content-Aware Fill are parameter dialogs, not workspaces (Select and Mask is one since 2026-10-23); type on a path, manual kerning, RTL paragraphs missing | [gaps.md](gaps.md) |
|
||||
| UI / UX fidelity and feel | 15% | 40% | 350–600 | ~150 open UI issues; Workspace checklist 13 / 5 / 5 (2026-10-12; 5 / 7 / 11 on 2026-10-10); 27 of 156 preferences do nothing (was 46 of 149); no floating panel groups, thin Color panel, brush lag and pressure jumps reported | [ui-parity.md](ui-parity.md), [brush-parity.md](brush-parity.md) |
|
||||
| File formats and fidelity | 15% | 60% | 300–500 | PSD oracle on Photoshop-authored files 133/256 (52%); io corpus 146/170 (86%); psd-tools 236/309 (76%); round trips ~100% of corpus; but users report Photoshop refusing our files (#1281, #2469; a text-layer case, #2374, was fixed 2026-10-10); no Photoshop PDF, EPS, JPEG 2000, JPEG XL, AVIF read, CR3 | [file-format-parity.md](file-format-parity.md) |
|
||||
| Performance | 10% | 25% | 200–350 | 3 of 25 budgeted scenarios meet budget (baseline 2026-10-05); 150-layer nudge crashes the GPU path (P12); layer move on 15000×10000 16-bit 2.7 s p50; users report brush and cursor lag (#2619, #2566, #1994) | [scorecard.md](scorecard.md#performance) |
|
||||
@@ -168,7 +168,7 @@ parity for the area and are already contained in the dimension rows above.
|
||||
| Area | % | Hours | Notes |
|
||||
|---|---:|---:|---|
|
||||
| Layers, groups, masks, blend modes, smart objects, layer styles | 65% | 150–250 | Broad and GPU-accelerated. Open: a single pixel layer copies its pixels without its mask and styles (UI-217-23: smart object, type, shape, group, fill and adjustment layers and multi-layer selections copy and paste whole), smart-object perspective (FILE-215-6), a user contour library (FILE-215-15). Multi-layer Smart Object conversion (#2052, #2651), Stamp Visible (UI-217-22) and mask targeting by command (#2458) are done |
|
||||
| Selections, Select and Mask, channels | 55% | 120–200 | All selection tools, single row/column marquee included (#2837). Select and Mask is a dialog with Photoshop's view modes, a Refine Edge Brush and six outputs, not a workspace (TOOL-214-1), no Refine Hair (#2671); Select Subject/Sky classical, 559 ms p50 on 24 MP vs a 100 ms budget |
|
||||
| Selections, Select and Mask, channels | 55% | 120–200 | All selection tools, single row/column marquee included (#2837). Select and Mask is Photoshop's workspace with its own tools (Quick Selection, Refine Edge Brush, Brush, Object Selection, Lasso, Polygonal Lasso), view modes and six outputs (TOOL-214-1, #7069, #8148), no Refine Hair (#2671), Object Aware or Presets; Select Subject/Sky classical, 559 ms p50 on 24 MP vs a 100 ms budget |
|
||||
| Painting and brush engine | 55% | 150–250 | Every Brush Settings section exists; feel is the gap: lag on big brushes, pressure jumps, smoothing and edge quality reports ([brush-parity.md](brush-parity.md)) |
|
||||
| Retouching (healing, clone, patch, remove, content-aware) | 50% | 100–180 | Remove tool non-generative; Content-Aware Fill has no workspace (TOOL-214-15); no live stroke preview for the Mixer Brush yet (TOOL-213-7) |
|
||||
| Transform, warp, puppet, perspective, liquify | 55% | 100–180 | Free Transform modifiers right, with a right-click transform menu (TOOL-214-5) and H/V skew fields; Puppet Warp mesh follows the object outline (TOOL-214-6); Liquify called "useless" by a user (#2606) |
|
||||
@@ -565,6 +565,7 @@ See [method, raw measurements and reproduction](five-algorithm-performance.md).
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-23 | minor | Select and Mask is Photoshop's workspace with its own tools (#7069, #8148); TOOL-214-1 stays partial (Refine Hair, Object Aware, Presets); percentages and estimates unchanged |
|
||||
| 2026-10-21 | minor | #8304: compound layer properties export as separate Set events, rename last; independent Photoshop replay pending; percentages and estimates unchanged |
|
||||
| 2026-10-19 | minor | JPEG Options dialog landed (FILE-215-19 partial: no Matte, progressive Scans or size preview); percentages unchanged |
|
||||
| 2026-10-18 | minor | Layers: with no selection, Copy takes fill and adjustment layers whole and Paste recreates them (#2344); UI-217-23 stays partial; percentages unchanged |
|
||||
|
||||
@@ -115,7 +115,7 @@ id = "TOOL-214-1"
|
||||
target = "Select and Mask workspace: view modes, Refine Edge brush, 6 outputs"
|
||||
status = "partial"
|
||||
issue = 214
|
||||
note = "select.refineEdge dialog with a live preview in Photoshop's view modes: Onion Skin, Marching Ants, Overlay, On Black, On White, Black & White, On Layers, per-view Opacity, Show Edge (J), Show Original (P), F cycles, X shows the image (select_mask_view.rs, #1754); Refine Edge Brush (R, size, Expand Detection Area / Restore Original Edge, Alt swaps) paints select.refineEdge refineStrokes, estimated by colour-line matting (matting/brush.rs, #2972); outputs Selection, Layer Mask, New Layer, New Layer with Mask, New Document, New Document with Mask (#2998); the workspace tools Quick Selection, Brush, Lasso, Object Selection, Select Subject, Clear Selection and Invert run as select.refineEdge edits, drivable by agents (#7069); no workspace layout or toolbar yet"
|
||||
note = "select.refineEdge dialog with a live preview in Photoshop's view modes: Onion Skin, Marching Ants, Overlay, On Black, On White, Black & White, On Layers, per-view Opacity, Show Edge (J), Show Original (P), F cycles, X shows the image (select_mask_view.rs, #1754); Refine Edge Brush (R, size, Expand Detection Area / Restore Original Edge, Alt swaps) paints select.refineEdge refineStrokes, estimated by colour-line matting (matting/brush.rs, #2972); outputs Selection, Layer Mask, New Layer, New Layer with Mask, New Document, New Document with Mask (#2998); Photoshop's workspace (select_mask_ui.rs, #7069, #8148): options bar, tools Quick Selection W, Refine Edge Brush R, Brush B, Object Selection W, Lasso and Polygonal Lasso L, Hand H, Zoom Z, Properties with Remember Settings, View Mode (Real-Time Refinement, High Quality Preview, Overlay colour and Indicates), Refine Mode, Edge Detection, Global Refinements with Clear Selection and Invert, Output Settings; the tools run as select.refineEdge edits; Ctrl+Z per edit; no Refine Hair (#2671), Object Aware (#2788) or Presets"
|
||||
|
||||
[[item]]
|
||||
id = "TOOL-214-2"
|
||||
|
||||
Reference in new issue
Block a user