Merge main into 11823

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
David MannandClaude Opus 5.5 committed 2026-11-07 20:45:18 +01:00
commit 3bc095040f
49 files changed
+6034 -104

No files matched your search

+1
View File
@@ -38,6 +38,7 @@ next to them.
| `crates/ui-egui/src/i18n/ro.tsv` | Romanian UI translations | @tronicum with Claude Code, AI-assisted (machine-translated); not yet reviewed by a native speaker | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/th.tsv` | Thai UI translations | @Thanawatttt and PhotoCraft contributors, with opencode (DeepSeek) as an AI contributor | Machine-assisted first draft from PhotoCraft's English labels, reviewed for UI terminology | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/ta.tsv` | Tamil UI translations | @newsbaba24x7 and PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/ka.tsv` | Georgian UI translations | @devius with Claude Code, AI-assisted | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `epaint_default_fonts::EGUI_ICONS` (build input; deflated into `OUT_DIR/egui_fonts/egui-icons.ttf.deflate`, registered by `crates/ui-egui/src/egui_fonts.rs`) | egui-icons, five-glyph subset of emoji-icon-font | John Slegers | [egui fork at 6d518fc](https://github.com/storytold/egui/tree/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts), [original](https://github.com/jslegers/emoji-icon-font); egui subset, unmodified here | MIT; Copyright (c) 2014 John Slegers; full upstream notice in [NOTICE](NOTICE) |
| `assets/fonts/Inter-Regular.ttf`, `Inter-Medium.ttf`, `Inter-SemiBold.ttf` | Inter 4.001 (UI font) | The Inter Project Authors (Rasmus Andersson) | <https://github.com/rsms/inter> | SIL OFL 1.1, [`assets/fonts/OFL-Inter.txt`](assets/fonts/OFL-Inter.txt) |
| `assets/fonts/JetBrainsMono-Regular.ttf` | JetBrains Mono 2.305 (numeric font) | The JetBrains Mono Project Authors | <https://github.com/JetBrains/JetBrainsMono> | SIL OFL 1.1, [`assets/fonts/OFL-JetBrainsMono.txt`](assets/fonts/OFL-JetBrainsMono.txt) |
+18 -6
View File
@@ -88,18 +88,21 @@ fn applies_at_canvas_bounds(p: &Value) -> bool {
}
/// Settings a mapped event has no field for, by command: `(param, the value the event plays as)`.
/// Photoshop's event has nowhere to put these, so a step that sets one cannot be written: it
/// The exported event has nowhere to put these, so a step that sets one cannot be written: it
/// would import as a different edit, silently. Such a step is refused, the way [`pixel_target`]
/// refuses a filter aimed at a mask -- and no key Photoshop does not define is invented for it,
/// which the clean-room rule forbids and which would make the file wrong in another reader.
///
/// A step that leaves the setting at the value the event plays as exports as before.
/// How a setting the event cannot carry behaves once the step is replayed without it. Which of
/// the two a setting takes follows the command's own reading of it, not the parameter spec.
/// these a setting takes follows the command's own reading of it, not the parameter spec.
enum Lost {
/// Replay uses this value, so only a step already at it survives. Numbers and strings are
/// both compared as written, since the commands below read these settings as written.
/// Replay uses this value, so only a step already at it survives. Numbers, strings and
/// booleans are compared as written, since the commands below read these settings as written.
ReplaysAs(&'static str),
/// Replay uses this boolean, and the command refuses any other type, so only a step at this
/// boolean survives: a string such as `"true"` is refused.
ReplaysAsBool(bool),
/// The command reads only this one spelling as anything other than what replay does, so every
/// other value survives -- a differently cased one included, because it too plays as replay's.
DiffersAt(&'static str),
@@ -114,6 +117,8 @@ const UNHOLDABLE: &[(&str, &[(&str, Lost)])] = &[
// the exact string "roundness" -- see `preserve` in filters.rs.
("filter.other.minimum", &[("preserve", Lost::DiffersAt("roundness"))]),
("filter.other.maximum", &[("preserve", Lost::DiffersAt("roundness"))]),
// Eqlz is exported with no fields; replay equalizes the selected area only.
("image.adjustments.equalize", &[("selectedAreaOnly", Lost::ReplaysAsBool(true))]),
];
/// Whether every setting of `p` that its event cannot hold would play the same without it
@@ -121,8 +126,15 @@ const UNHOLDABLE: &[(&str, &[(&str, Lost)])] = &[
fn holds_its_settings(id: &str, p: &Value) -> bool {
let Some((_, settings)) = UNHOLDABLE.iter().find(|(cmd, _)| *cmd == id) else { return true };
settings.iter().all(|(param, lost)| match (p.get(param), lost) {
(None | Some(Value::Null), _) => true,
(Some(v), Lost::ReplaysAs(played)) => v.as_str() == Some(played) || v.as_f64().is_some_and(|n| played.parse::<f64>().is_ok_and(|d| n == d)),
(None, _) => true,
// The command refuses null here too, so a null step is refused like any other non-boolean.
(Some(v), Lost::ReplaysAsBool(played)) => v.as_bool() == Some(*played),
(Some(Value::Null), _) => true,
(Some(v), Lost::ReplaysAs(played)) => {
v.as_str() == Some(played)
|| v.as_f64().is_some_and(|n| played.parse::<f64>().is_ok_and(|d| n == d))
|| v.as_bool().is_some_and(|b| played.parse::<bool>() == Ok(b))
}
(Some(v), Lost::DiffersAt(spelling)) => v.as_str() != Some(spelling),
})
}
+10 -3
View File
@@ -600,10 +600,11 @@ fn a_selective_color_step_in_the_scalar_form_keeps_its_values() {
assert_eq!(range(&nulled, "reds"), [35.0, 0.0, 0.0, 0.0], "{nulled}");
}
/// A setting Photoshop's event has no field for is dropped by export, and the step then plays back
/// A setting the exported event has no field for is dropped by export, and the step then plays back
/// as a different edit: Crystallize's `seed` (#7668), Radial Blur's centre, Minimum's and
/// Maximum's `preserve`. Such a step is refused, as one with no equivalent event already is. So is
/// an adjustment edit that names its layer: the event edits the active one (#8532).
/// Maximum's `preserve`, Equalize's `selectedAreaOnly`. Such a step is refused, as one with no
/// equivalent event already is. So is an adjustment edit that names its layer: the event edits the
/// active one (#8532).
#[test]
fn a_setting_the_event_cannot_hold_is_refused() {
for (id, params) in [
@@ -611,6 +612,10 @@ fn a_setting_the_event_cannot_hold_is_refused() {
("filter.blur.radialBlur", json!({"amount": 10, "centerX": 0.25, "centerY": 0.5})),
("filter.other.minimum", json!({"radius": 4, "preserve": "roundness"})),
("filter.other.maximum", json!({"radius": 4, "preserve": "roundness"})),
("image.adjustments.equalize", json!({"selectedAreaOnly": false})),
// Equalize reads `selectedAreaOnly` as a boolean only and refuses the string and null.
("image.adjustments.equalize", json!({"selectedAreaOnly": "true"})),
("image.adjustments.equalize", json!({"selectedAreaOnly": null})),
("layer.setAdjustment", json!({"kind": "exposure", "layer": "Target_existing", "exposure": -0.75, "offset": 0.035, "gamma": 1.37})),
("layer.setAdjustment", json!({"kind": "exposure", "document": 2, "exposure": -0.75})),
] {
@@ -645,6 +650,8 @@ fn settings_at_the_value_the_event_plays_still_export() {
// review).
("filter.other.minimum", json!({"radius": 4, "preserve": "Squareness"})),
("filter.other.maximum", json!({"radius": 4, "preserve": "Roundness"})),
("image.adjustments.equalize", json!({"selectedAreaOnly": true})),
("image.adjustments.equalize", json!({})),
] {
let mut s = Session::new();
s.actions.list.push(Action::new("A", vec![(id.into(), params.clone())]));
+26 -5
View File
@@ -76,12 +76,18 @@ pub(crate) fn step_key(s: &Session, what: &str) -> String {
/// Quick Mask or the layer mask (`Session::execute` fills that in from the Channels panel), that
/// grayscale surface is rewritten instead, as the core filters do (#935).
fn map_pixels(s: &mut Session, label: &str, p: &Value, f: impl FnOnce(Rect, &mut [[f32; 4]], &[f32])) -> Result<Value> {
map_pixels_in(s, label, p, false, f)
}
/// [`map_pixels`], or with `whole` the whole canvas: `f` still gets the selection coverage, and
/// every pixel takes its result in full.
fn map_pixels_in(s: &mut Session, label: &str, p: &Value, whole: bool, f: impl FnOnce(Rect, &mut [[f32; 4]], &[f32])) -> Result<Value> {
let id = layer_param(s, p)?;
let channel = crate::channel_cmds::target_of(p) != crate::channel_cmds::Target::Pixels;
s.edit(label, |doc, _| {
let canvas = doc.bounds();
let selection = doc.selection.clone();
let area = selection.as_ref().map_or(canvas, |m| m.content_bounds().intersect(&canvas));
let area = if whole { canvas } else { selection.as_ref().map_or(canvas, |m| m.content_bounds().intersect(&canvas)) };
let (surf, lock_alpha) = if channel {
let Some(surf) = crate::channel_cmds::channel_surface_for_filter(doc, Some(id), p)? else { return Ok(()) };
(surf, false)
@@ -109,7 +115,7 @@ fn map_pixels(s: &mut Session, label: &str, p: &Value, f: impl FnOnce(Rect, &mut
f(area, &mut px, &cover);
let mut enc = [0.0f32; 8];
for (i, out) in raw.chunks_exact_mut(n).enumerate() {
let k = cover[i];
let k = if whole { 1.0 } else { cover[i] };
if k <= 0.0 {
continue;
}
@@ -230,9 +236,16 @@ fn stroke(s: &mut Session, p: &Value) -> Result<Value> {
}
/// Histogram equalization, like Photoshop's: one CDF over the R, G and B values of
/// the selected pixels, applied to every channel.
/// the selected pixels, applied to every channel. With a selection, `selectedAreaOnly: false`
/// applies the selection's mapping to the layer within the canvas (Photoshop's Equalize Entire
/// Image Based On Selected Area).
fn equalize(s: &mut Session, p: &Value) -> Result<Value> {
map_pixels(s, "Equalize", p, |_, px, cover| {
let whole = match p.get("selectedAreaOnly") {
None => false,
Some(Value::Bool(only)) => !only,
Some(_) => return Err(EngineError::BadParams { cmd: "image.adjustments.equalize".into(), msg: "selectedAreaOnly must be true or false".into() }),
};
map_pixels_in(s, "Equalize", p, whole, |_, px, cover| {
let mut hist = [0f64; 256];
for (p, &k) in px.iter().zip(cover) {
if k > 0.0 && p[3] > 0.0 {
@@ -882,7 +895,15 @@ pub fn specs() -> Vec<CommandSpec> {
})?;
Ok(json!({"selected": true}))
}),
spec!("image.adjustments.equalize", "Equalize", &["Image", "Adjustments"], None, "{}", has_pixels, equalize),
spec!(
"image.adjustments.equalize",
"Equalize",
&["Image", "Adjustments"],
None,
r#"{"selectedAreaOnly":bool=true (with a selection, false equalizes the layer within the canvas by the selection's histogram)}"#,
has_pixels,
equalize
),
spec!("image.revealAll", "Reveal All", &["Image"], None, "{}", has_doc, |s, _| {
let d = s.active().ok_or(EngineError::NoDocument)?;
let all = reveal_all_bounds(&d.doc);
+58
View File
@@ -473,6 +473,64 @@ fn equalize_spreads_values() {
}
}
/// Equalize with a selection: by default only the selected pixels change, as Photoshop's
/// Equalize Selected Area Only; `selectedAreaOnly: false` maps the layer within the canvas by the
/// selected pixels' histogram, as its Equalize Entire Image Based On Selected Area.
#[test]
fn equalize_entire_image_based_on_the_selected_area() {
let setup = |depth: u32| {
let mut s = session(depth);
paint_square(&mut s, Rect::new(0, 0, 30, 15), [0.4, 0.4, 0.4, 1.0]);
paint_square(&mut s, Rect::new(0, 15, 30, 30), [0.5, 0.5, 0.5, 1.0]);
// Darker than anything selected: the selection's mapping sends it to black.
paint_square(&mut s, Rect::new(30, 0, 40, 30), [0.3, 0.3, 0.3, 1.0]);
s.execute("select.rect", json!({"x": 0, "y": 0, "width": 20, "height": 30})).unwrap();
s
};
for depth in [8, 16, 32] {
for params in [json!({}), json!({"selectedAreaOnly": true})] {
let mut s = setup(depth);
s.execute("image.adjustments.equalize", params.clone()).unwrap();
let inside = (pixel(&s, 1, 1)[0], pixel(&s, 1, 20)[0]);
assert!(inside.0 < 0.05 && inside.1 > 0.95, "{depth} {params}: inside {inside:?}");
let outside = [pixel(&s, 25, 1)[0], pixel(&s, 25, 20)[0], pixel(&s, 35, 1)[0]];
assert!(outside.iter().zip([0.4, 0.5, 0.3]).all(|(v, want)| (v - want).abs() < 0.01), "{depth} {params}: outside {outside:?}");
}
let mut s = setup(depth);
s.execute("image.adjustments.equalize", json!({"selectedAreaOnly": false})).unwrap();
for (x, y, want_light) in [(1, 1, false), (1, 20, true), (25, 1, false), (25, 20, true), (35, 1, false), (35, 20, false)] {
let v = pixel(&s, x, y)[0];
assert!(if want_light { v > 0.95 } else { v < 0.05 }, "{depth}: ({x}, {y}) = {v}");
}
assert!(doc(&s).selection.is_some(), "{depth}: the selection stays");
s.undo();
let undone = [pixel(&s, 1, 1)[0], pixel(&s, 25, 20)[0], pixel(&s, 35, 1)[0]];
assert!(undone.iter().zip([0.4, 0.5, 0.3]).all(|(v, want)| (v - want).abs() < 0.01), "{depth}: one undo step {undone:?}");
}
}
/// Without a selection, `selectedAreaOnly: false` gives the same pixels as plain Equalize.
#[test]
fn equalize_entire_image_without_a_selection_is_plain_equalize() {
let run = |params: Value| {
let mut s = session(8);
paint_square(&mut s, Rect::new(0, 0, 40, 15), [0.4, 0.4, 0.4, 1.0]);
paint_square(&mut s, Rect::new(0, 15, 40, 30), [0.5, 0.5, 0.5, 1.0]);
s.execute("image.adjustments.equalize", params).unwrap();
active(&s).surface().unwrap().read_region(Rect::new(0, 0, 40, 30))
};
assert_eq!(run(json!({"selectedAreaOnly": false})), run(json!({})));
}
#[test]
fn equalize_refuses_a_selected_area_only_that_is_not_a_boolean() {
for bad in [json!(null), json!("false"), json!(0), json!([true]), json!({})] {
let mut s = session(8);
let e = s.execute("image.adjustments.equalize", json!({"selectedAreaOnly": bad})).unwrap_err().to_string();
assert!(e.contains("selectedAreaOnly"), "{bad}: {e}");
}
}
/// A selection masks Clouds but doesn't change their size: inside it they are the canvas's
/// clouds, as when Clouds sized itself by the document (before it became a filter).
#[test]
+41 -2
View File
@@ -18,13 +18,17 @@ pub fn document_area(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
crate::brush_mode_menu::show(app, ui.ctx());
}
/// Where each docked document is drawn under Window › Arrange: its index and the cell it gets,
/// at the border positions the user has dragged them to. `None` with no docked document, or when
/// the arrangement is the plain single canvas. With more documents than the layout has cells, the
/// shown run starts at [`PhotocraftApp::arrange_start`] and always includes the active one.
pub(crate) fn arranged_cells(app: &PhotocraftApp, rect: Rect) -> Option<Vec<(usize, Rect)>> {
let documents = docked_document_indices(app);
let n = documents.len();
if n == 0 {
return None;
}
let cells = crate::view_cmds::cells(&app.ui.view.arrange, rect, n)?;
let cells = crate::view_cmds::cells(&app.ui.view.arrange, rect, n, &app.ui.view.arrange_splits)?;
// Keep stable tiles, expressing the remembered document index in the filtered docked list.
let start = documents.partition_point(|&d| d < app.arrange_start).min(n.saturating_sub(cells.len()));
let idx = app.session.active_index().and_then(|d| documents.iter().position(|&p| p == d));
@@ -109,19 +113,27 @@ fn documents(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
if let Some(shown) = arranged_cells(app, rect) {
app.arrange_start = shown.first().map_or(0, |(d, _)| *d);
let t = crate::theme::Tokens::get(ui.ctx());
// A press on a border grip drags the border (`drag_borders`); it activates no document.
// The grips are laid out after the canvases, so egui gives them the press (#10101).
let grips: Vec<Rect> = border_grips(app, rect).into_iter().map(|(_, grip)| grip).collect();
for (d, cell) in shown {
let cell = cell.shrink(1.0);
let view = app.ui.views[d].clone();
let v = canvas_view(app, ui, d, cell, view, d == active_doc);
if d != active_doc {
app.ui.views[d] = v;
if main_focused && ui.input(|i| i.pointer.primary_pressed() && i.pointer.interact_pos().is_some_and(|p| cell.contains(p))) {
if main_focused
&& ui.input(|i| {
i.pointer.primary_pressed() && i.pointer.interact_pos().is_some_and(|p| cell.contains(p) && !grips.iter().any(|g| g.contains(p)))
})
{
app.session.set_active(d);
}
}
let stroke = if d == active_doc { Stroke::new(1.5, t.accent) } else { Stroke::new(1.0, Color32::from_black_alpha(160)) };
ui.painter().rect_stroke(cell, 0, stroke, egui::StrokeKind::Inside);
}
drag_borders(app, ui, rect);
return;
}
if idx != active_doc && main_focused && ui.input(|i| i.pointer.primary_pressed() && i.pointer.interact_pos().is_some_and(|p| rect.contains(p))) {
@@ -131,6 +143,33 @@ fn documents(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
canvas_view(app, ui, idx, rect, view, app.session.active_index() == Some(idx));
}
/// Window › Arrange: the borders between the documents are dragged to give one more room, as in
/// Photoshop (#10101). Laid out after the canvases, so a grip over a cell's edge takes the press.
fn drag_borders(app: &mut PhotocraftApp, ui: &egui::Ui, rect: Rect) {
let n = docked_document_indices(app).len();
let layout = app.ui.view.arrange.clone();
for (border, grip) in border_grips(app, rect) {
let response = ui.interact(grip, ui.scope_id().with(("arrange-border", border.split)), Sense::drag());
if response.hovered() || response.dragged() {
ui.ctx().set_cursor_icon(if border.vertical { egui::CursorIcon::ResizeHorizontal } else { egui::CursorIcon::ResizeVertical });
}
if response.dragged()
&& let Some(p) = response.interact_pointer_pos()
{
crate::view_cmds::drag_border(&layout, rect, n, &mut app.ui.view.arrange_splits, border.split, p);
}
}
}
/// The arrangement's borders, each with the strip either side of it that grabs it.
fn border_grips(app: &PhotocraftApp, rect: Rect) -> Vec<(crate::view_cmds::Border, Rect)> {
let n = docked_document_indices(app).len();
crate::view_cmds::borders(&app.ui.view.arrange, rect, n, &app.ui.view.arrange_splits)
.into_iter()
.map(|b| (b, b.line.expand2(if b.vertical { egui::vec2(3.0, 0.0) } else { egui::vec2(0.0, 3.0) })))
.collect()
}
/// The tab strip; returns where its document tabs are.
pub(super) fn tabs(app: &mut PhotocraftApp, ui: &mut egui::Ui) -> TabStrip {
let t = crate::theme::Tokens::get(ui.ctx());
+13 -4
View File
@@ -349,6 +349,7 @@ fn command_body_more(app: &mut PhotocraftApp, ui: &mut egui::Ui, d: &Dialog, fie
_ if crate::blur_pins::owns(fields) => crate::blur_pins::body(ui, fields),
_ if fields.contains_key("__filter") => filter_body(app, ui, d, fields, id),
_ if crate::new_guide_ui::owns(fields) => crate::new_guide_ui::body(ui, fields),
_ if crate::equalize_ui::owns(fields) => crate::equalize_ui::body(ui, fields),
_ if fields.contains_key("__form") => {
if fields.get("__command").and_then(Value::as_str) == Some("file.fileInfo") {
let room = (ui.ctx().content_rect().height() - DIALOG_CHROME).max(120.0);
@@ -898,6 +899,7 @@ const ROUTES: &[fn(&Fields) -> bool] = &[
crate::variables_ui::owns,
crate::file_ui::owns,
crate::new_guide_ui::owns,
crate::equalize_ui::owns,
crate::color_picker_ui::owns,
crate::color_range_ui::owns,
crate::prefs_ui::owns,
@@ -1027,7 +1029,7 @@ fn confirm_generic_command(app: &mut PhotocraftApp, d: Dialog) -> Result<Value,
}
/// The checks before a dialog is confirmed: no open child picker, the automation gate for a handler
/// that touches files itself, and a valid guide layout.
/// that touches files itself, a valid guide layout, and Equalize's own document, layer and selection.
pub(crate) fn confirm_preflight(app: &mut PhotocraftApp, id: u64) -> Result<(), String> {
if crate::layer_style::color_picker::has_child(app, id) {
return Err("confirm or cancel the Layer Style color picker first".into());
@@ -1052,6 +1054,9 @@ pub(crate) fn confirm_preflight(app: &mut PhotocraftApp, id: u64) -> Result<(),
if let Some(d) = app.ui.dialogs.iter().find(|d| d.id == id).filter(|d| crate::guide_layout_ui::owns(&d.fields)) {
crate::guide_layout_ui::validate(app, &d.fields)?;
}
if let Some(d) = app.ui.dialogs.iter().find(|d| d.id == id).filter(|d| crate::equalize_ui::owns(&d.fields)) {
crate::equalize_ui::validate(app, &d.fields)?;
}
// Merge Channels with too few, repeated, closed or changed documents stays open (#11451).
merge_channels_ui::preflight(app, id)?;
Ok(())
@@ -1184,9 +1189,9 @@ pub fn cancel(app: &mut PhotocraftApp, id: u64) -> Result<Value, String> {
Ok(Value::Null)
}
/// Open the parameter dialog of `command`: the adjustment editor for `image.adjustments.*`, the
/// schema dialog for filters, the Color Range dialog for `select.colorRange`, otherwise a bare
/// confirm dialog.
/// Open the parameter dialog of `command`: the Equalize choices when there is a selection, the
/// adjustment editor for `image.adjustments.*`, the schema dialog for filters, the Color Range
/// dialog for `select.colorRange`, otherwise a bare confirm dialog.
pub fn open_command_dialog(app: &mut PhotocraftApp, command: &str, label: &str) -> u64 {
if command == "view.newGuideLayout" {
return crate::guide_layout_ui::open(app);
@@ -1194,6 +1199,9 @@ pub fn open_command_dialog(app: &mut PhotocraftApp, command: &str, label: &str)
if command == crate::stroke_ui::COMMAND {
return crate::stroke_ui::open(app);
}
if command == crate::equalize_ui::COMMAND && crate::equalize_ui::asks(app) {
return crate::equalize_ui::open(app);
}
if crate::new_group_ui::fronts(command) {
return crate::new_group_ui::open(app, command);
}
@@ -1241,6 +1249,7 @@ pub mod disk_change_prompt;
pub mod distort_ui;
pub mod duplicate_layer_ui;
pub mod edit_history;
pub mod equalize_ui;
pub mod export_dialog;
pub mod file_ui;
pub mod fill_ui;
+93
View File
@@ -0,0 +1,93 @@
//! Image › Adjustments › Equalize with a selection: the dialog that asks what to equalize, as in
//! Photoshop. Equalize Selected Area Only (the default) evenly distributes the selected pixels;
//! Equalize Entire Image Based On Selected Area maps the layer within the canvas by the selected
//! pixels' histogram. OK runs `image.adjustments.equalize` with `selectedAreaOnly`. Without a selection,
//! Equalize runs at once.
//!
//! The dialog is an ordinary one in the UI state, so `ui.inspect`, `ui.dialog.confirm` and
//! `ui.dialog.cancel` drive it.
use std::collections::HashMap;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::sync::Arc;
use serde_json::{Map, Value, json};
use crate::PhotocraftApp;
use crate::state::DialogKind;
const MARK: &str = "__equalize";
pub const COMMAND: &str = "image.adjustments.equalize";
const KEY: &str = "selectedAreaOnly";
pub fn owns(fields: &Map<String, Value>) -> bool {
fields.contains_key(MARK)
}
/// Whether Equalize asks first: the active document has a selection and Equalize can run.
pub fn asks(app: &PhotocraftApp) -> bool {
app.session.active().is_some_and(|st| st.doc.selection.is_some()) && app.session.is_enabled(COMMAND)
}
pub fn open(app: &mut PhotocraftApp) -> u64 {
let mut f = Map::new();
f.insert(MARK.into(), json!(true));
f.insert("__command".into(), json!(COMMAND));
f.insert("__label".into(), json!("Equalize"));
let st = app.session.active();
f.insert("__document".into(), st.map(|s| json!(s.doc.id)).unwrap_or(Value::Null));
f.insert("__layer".into(), st.and_then(|s| s.active_layer).map(|l| json!(l.0)).unwrap_or(Value::Null));
f.insert("__selection".into(), st.and_then(selection_fingerprint).map(Value::String).unwrap_or(Value::Null));
f.insert(KEY.into(), json!(true));
app.ui.open_dialog(DialogKind::Command, f)
}
/// A hash of the selection's stored tiles and its default value, so OK can tell whether the
/// selection changed after the dialog opened. Tiles that share one allocation (uniform tiles,
/// copy-on-write clones) are hashed once.
fn selection_fingerprint(st: &photocraft_engine::DocState) -> Option<String> {
let sel = st.doc.selection.as_ref()?;
let mut h = DefaultHasher::new();
// A point far outside every tile reads the default value.
sel.sample_channel(i32::MIN / 2, i32::MIN / 2, 0).to_bits().hash(&mut h);
let mut seen: HashMap<usize, u64> = HashMap::new();
for (c, t) in sel.tiles() {
let tile = *seen.entry(Arc::as_ptr(t) as usize).or_insert_with(|| {
let mut th = DefaultHasher::new();
t.bytes().hash(&mut th);
th.finish()
});
(c.tx, c.ty, tile).hash(&mut h);
}
Some(format!("{:016x}", h.finish()))
}
/// OK runs only while the document, layer and selection the dialog was opened for are still the
/// active ones; otherwise the dialog stays open.
pub fn validate(app: &PhotocraftApp, f: &Map<String, Value>) -> Result<(), String> {
let st = app.session.active().ok_or("no document")?;
if f.get("__document") != Some(&json!(st.doc.id)) {
return Err("the Equalize dialog belongs to another document".into());
}
if st.doc.selection.is_none() {
return Err("the selection was cleared while the Equalize dialog was open".into());
}
if f.get("__layer") != Some(&st.active_layer.map(|l| json!(l.0)).unwrap_or(Value::Null)) {
return Err("another layer was selected while the Equalize dialog was open".into());
}
if f.get("__selection") != Some(&selection_fingerprint(st).map(Value::String).unwrap_or(Value::Null)) {
return Err("the selection changed while the Equalize dialog was open".into());
}
Ok(())
}
pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
let mut only = f.get(KEY).and_then(Value::as_bool).unwrap_or(true);
ui.radio_value(&mut only, true, tl!("Equalize Selected Area Only"));
ui.radio_value(&mut only, false, tl!("Equalize Entire Image Based On Selected Area"));
f.insert(KEY.into(), json!(only));
}
#[cfg(test)]
mod tests;
@@ -0,0 +1,173 @@
use egui_kittest::kittest::Queryable;
use serde_json::json;
use super::*;
use crate::menus::invoke as menu;
/// A 40 × 30 layer: the top half at 0.4 gray, the bottom half at 0.5, with the left half selected
/// when `select`.
fn setup(select: bool) -> (PhotocraftApp, egui::Context) {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
app.run("file.new", json!({"width": 40, "height": 30})).unwrap();
app.run("layer.new.layer", json!({})).unwrap();
app.run("select.rect", json!({"x": 0, "y": 0, "width": 40, "height": 15})).unwrap();
app.run("edit.fill", json!({"color": [0.4, 0.4, 0.4]})).unwrap();
app.run("select.rect", json!({"x": 0, "y": 15, "width": 40, "height": 15})).unwrap();
app.run("edit.fill", json!({"color": [0.5, 0.5, 0.5]})).unwrap();
if select {
app.run("select.rect", json!({"x": 0, "y": 0, "width": 20, "height": 30})).unwrap();
} else {
app.run("select.deselect", json!({})).unwrap();
}
(app, egui::Context::default())
}
fn gray(app: &PhotocraftApp, x: i32, y: i32) -> f32 {
let st = app.session.active().unwrap();
st.doc.layer(st.active_layer.unwrap()).unwrap().surface().unwrap().pixel(x, y)[0]
}
#[test]
fn command_dialog_with_a_selection_opens_equalize_choices() {
let (mut app, _) = setup(true);
let id = crate::dialogs::open_command_dialog(&mut app, COMMAND, "Equalize");
let fields = &app.ui.dialog_mut(id).unwrap().fields;
assert!(owns(fields));
assert_eq!(fields[KEY], json!(true));
let (mut app, _) = setup(false);
let id = crate::dialogs::open_command_dialog(&mut app, COMMAND, "Equalize");
assert!(!owns(&app.ui.dialog_mut(id).unwrap().fields));
}
#[test]
fn equalize_marker_is_a_route_marker() {
assert!(crate::dialogs::is_route_marker(MARK));
}
#[test]
fn equalize_with_a_selection_asks_and_defaults_to_the_selected_area_only() {
let (mut app, ctx) = setup(true);
let d = menu(&mut app, &ctx, COMMAND, json!({})).unwrap()["dialog"].as_u64().unwrap();
let f = &app.ui.dialog_mut(d).unwrap().fields;
assert!(owns(f));
assert_eq!(f[KEY], json!(true));
assert!((gray(&app, 1, 1) - 0.4).abs() < 0.01, "nothing changes before OK");
crate::dialogs::confirm(&mut app, d).unwrap();
assert!(gray(&app, 1, 1) < 0.05 && gray(&app, 1, 20) > 0.95, "the selected area is equalized");
assert!((gray(&app, 30, 1) - 0.4).abs() < 0.01 && (gray(&app, 30, 20) - 0.5).abs() < 0.01, "the rest is unchanged");
}
#[test]
fn entire_image_based_on_the_selected_area_maps_the_whole_layer() {
let (mut app, ctx) = setup(true);
let d = menu(&mut app, &ctx, COMMAND, json!({})).unwrap()["dialog"].as_u64().unwrap();
app.ui.dialog_mut(d).unwrap().fields.insert(KEY.into(), json!(false));
crate::dialogs::confirm(&mut app, d).unwrap();
assert!(gray(&app, 30, 1) < 0.05 && gray(&app, 30, 20) > 0.95, "outside the selection too");
}
/// OK on a dialog opened for one document, while another document is active, equalizes nothing and
/// leaves the dialog open.
#[test]
fn ok_refuses_while_another_document_is_active() {
let (mut app, ctx) = setup(true);
let d = menu(&mut app, &ctx, COMMAND, json!({})).unwrap()["dialog"].as_u64().unwrap();
app.run("file.new", json!({"width": 40, "height": 30})).unwrap();
app.run("layer.new.layer", json!({})).unwrap();
app.run("edit.fill", json!({"color": [0.4, 0.4, 0.4]})).unwrap();
assert!(crate::dialogs::confirm(&mut app, d).is_err());
assert!(app.ui.dialogs.iter().any(|x| x.id == d), "the dialog stays open");
assert!((gray(&app, 1, 1) - 0.4).abs() < 0.01, "the other document is unchanged");
assert!(app.session.set_active(0));
assert!((gray(&app, 1, 1) - 0.4).abs() < 0.01, "nothing ran on the dialog's document either");
crate::dialogs::confirm(&mut app, d).unwrap();
assert!(gray(&app, 1, 1) < 0.05, "OK runs once its document is active again");
}
/// OK on a dialog whose selection was cleared while it was open equalizes nothing and leaves the
/// dialog open, so the choice is never applied to the whole layer.
#[test]
fn ok_refuses_after_the_selection_is_cleared() {
let (mut app, ctx) = setup(true);
let d = menu(&mut app, &ctx, COMMAND, json!({})).unwrap()["dialog"].as_u64().unwrap();
app.run("select.deselect", json!({})).unwrap();
assert!(crate::dialogs::confirm(&mut app, d).is_err());
assert!(app.ui.dialogs.iter().any(|x| x.id == d), "the dialog stays open");
assert!((gray(&app, 1, 1) - 0.4).abs() < 0.01 && (gray(&app, 30, 20) - 0.5).abs() < 0.01, "the layer is unchanged");
}
/// OK after another layer became active equalizes nothing and leaves the dialog open; it runs once
/// the layer the dialog was opened for is active again.
#[test]
fn ok_refuses_after_the_active_layer_changes() {
let (mut app, ctx) = setup(true);
let layer = app.session.active().unwrap().active_layer.unwrap();
let d = menu(&mut app, &ctx, COMMAND, json!({})).unwrap()["dialog"].as_u64().unwrap();
app.run("layer.new.layer", json!({})).unwrap();
app.run("edit.fill", json!({"color": [0.4, 0.4, 0.4]})).unwrap();
assert!(crate::dialogs::confirm(&mut app, d).is_err());
assert!(app.ui.dialogs.iter().any(|x| x.id == d), "the dialog stays open");
assert!((gray(&app, 1, 1) - 0.4).abs() < 0.01, "the new layer is unchanged");
app.run("layer.select", json!({"layer": layer.0})).unwrap();
assert!((gray(&app, 1, 1) - 0.4).abs() < 0.01, "nothing ran on the dialog's layer either");
crate::dialogs::confirm(&mut app, d).unwrap();
assert!(gray(&app, 1, 1) < 0.05 && gray(&app, 1, 20) > 0.95, "OK runs once its layer is active again");
}
/// OK after the selection changed equalizes nothing and leaves the dialog open; it runs once the
/// selection is the one the dialog was opened with again.
#[test]
fn ok_refuses_after_the_selection_changes() {
let (mut app, ctx) = setup(true);
let d = menu(&mut app, &ctx, COMMAND, json!({})).unwrap()["dialog"].as_u64().unwrap();
app.run("select.rect", json!({"x": 20, "y": 0, "width": 20, "height": 30})).unwrap();
assert!(crate::dialogs::confirm(&mut app, d).is_err());
assert!(app.ui.dialogs.iter().any(|x| x.id == d), "the dialog stays open");
assert!((gray(&app, 1, 1) - 0.4).abs() < 0.01 && (gray(&app, 30, 1) - 0.4).abs() < 0.01, "the layer is unchanged");
app.run("select.rect", json!({"x": 0, "y": 0, "width": 20, "height": 30})).unwrap();
crate::dialogs::confirm(&mut app, d).unwrap();
assert!(gray(&app, 1, 1) < 0.05 && (gray(&app, 30, 1) - 0.4).abs() < 0.01, "OK runs on the selection it was opened with");
}
#[test]
fn cancel_leaves_the_layer_unchanged() {
let (mut app, ctx) = setup(true);
let d = menu(&mut app, &ctx, COMMAND, json!({})).unwrap()["dialog"].as_u64().unwrap();
crate::dialogs::cancel(&mut app, d).unwrap();
assert!((gray(&app, 1, 1) - 0.4).abs() < 0.01 && (gray(&app, 1, 20) - 0.5).abs() < 0.01);
}
#[test]
fn without_a_selection_or_with_params_equalize_runs_at_once() {
let (mut app, ctx) = setup(false);
let r = menu(&mut app, &ctx, COMMAND, json!({})).unwrap();
assert!(r.get("dialog").is_none() && app.ui.dialogs.is_empty(), "{r}");
assert!(gray(&app, 30, 1) < 0.05 && gray(&app, 30, 20) > 0.95);
let (mut scripted, ctx) = setup(true);
menu(&mut scripted, &ctx, COMMAND, json!({"selectedAreaOnly": false})).unwrap();
assert!(scripted.ui.dialogs.is_empty());
assert!(gray(&scripted, 30, 1) < 0.05, "a script's `selectedAreaOnly` runs without the dialog");
}
#[test]
fn the_dialog_shows_both_choices() {
let (mut app, _) = setup(true);
open(&mut app);
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(900.0, 600.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()))) {
crate::dialogs::show(app, &ctx);
}
},
app,
);
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
h.run_steps(4);
assert!(h.query_by_label("Equalize Selected Area Only").is_some());
h.get_by_label("Equalize Entire Image Based On Selected Area").click();
h.run_steps(2);
assert_eq!(h.state().ui.dialogs[0].fields[KEY], json!(false));
assert!(h.query_by_label("OK").is_some() && h.query_by_label("Cancel").is_some());
}
+3 -1
View File
@@ -216,7 +216,7 @@ fn expand(packed: &str, keys: &[&str]) -> Result<String, String> {
}
/// The registry. English first: it is the fallback and the source language.
pub static LANGUAGES: [LangInfo; 34] = [
pub static LANGUAGES: [LangInfo; 35] = [
LangInfo { code: "en", name: "English", source: b"", plural: plural_one_other, complete_menus: false, catalog: OnceLock::new() },
LangInfo { code: "ja", name: "日本語", source: catalog!("ja"), plural: plural_none, complete_menus: true, catalog: OnceLock::new() },
LangInfo { code: "zh-hans", name: "简体中文", source: catalog!("zh-hans"), plural: plural_none, complete_menus: true, catalog: OnceLock::new() },
@@ -284,6 +284,8 @@ pub static LANGUAGES: [LangInfo; 34] = [
LangInfo { code: "ro", name: "Română", source: catalog!("ro"), plural: plural_romanian, complete_menus: true, catalog: OnceLock::new() },
// Tamil; `ta-IN`, `ta-LK` and `ta_IN.UTF-8` resolve here. CLDR plural: one|other.
LangInfo { code: "ta", name: "தமிழ்", source: catalog!("ta"), plural: plural_one_other, complete_menus: true, catalog: OnceLock::new() },
// Georgian: nouns stay singular after a numeral (`შრე: 5`, `5 შრე`), so one form serves every count.
LangInfo { code: "ka", name: "ქართული", source: catalog!("ka"), plural: plural_none, complete_menus: true, catalog: OnceLock::new() },
];
impl LangInfo {
+2
View File
@@ -410,6 +410,8 @@
Match Color… Přizpůsobit barvy…
Replace Color… Nahradit barvu…
Equalize Vyrovnat
Equalize Selected Area Only Vyrovnat pouze výběr
Equalize Entire Image Based On Selected Area Vyrovnat celý obraz podle výběru
Auto Tone Automatický tón
Auto Contrast Automatický kontrast
Auto Color Automatické barvy
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -381,6 +381,8 @@
Match Color… Farbabgleich…
Replace Color… Farbe ersetzen…
Equalize Angleichen
Equalize Selected Area Only Nur ausgewählten Bereich angleichen
Equalize Entire Image Based On Selected Area Gesamtes Bild anhand des ausgewählten Bereichs angleichen
Auto Tone Automatische Tonwertkorrektur
Auto Contrast Automatischer Kontrast
Auto Color Automatische Farbe
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -767,6 +767,8 @@
Channel Mixer Μείκτης καναλιών
Desaturate Αφαίρεση κορεσμού
Equalize Εξισορρόπηση
Equalize Selected Area Only Εξισορρόπηση μόνο της επιλεγμένης περιοχής
Equalize Entire Image Based On Selected Area Εξισορρόπηση ολόκληρης της εικόνας βάσει της επιλεγμένης περιοχής
Auto Tone Αυτόματη διόρθωση τόνων
Auto Contrast Αυτόματη αντίθεση
Auto Color Αυτόματη διόρθωση χρωμάτων
Can't render this file because it contains an unexpected character in line 47 and column 53.
+2
View File
@@ -347,6 +347,8 @@
Match Color… Igualar color…
Replace Color… Reemplazar color…
Equalize Ecualizar
Equalize Selected Area Only Ecualizar solo la selección
Equalize Entire Image Based On Selected Area Ecualizar toda la imagen según la selección
Auto Tone Tono automático
Auto Contrast Contraste automático
Auto Color Color automático
Can't render this file because it contains an unexpected character in line 4 and column 47.
+2
View File
@@ -372,6 +372,8 @@
Match Color… Faire correspondre la couleur…
Replace Color… Remplacer la couleur…
Equalize Égaliser
Equalize Selected Area Only Égaliser uniquement la sélection
Equalize Entire Image Based On Selected Area Égaliser toute l'image d'après la sélection
Auto Tone Tonalité automatique
Auto Contrast Contraste automatique
Auto Color Couleur automatique
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -194,6 +194,8 @@
Edit Szerkesztés
Enhanced Controls… Bővített vezérlők…
Equalize Kiegyenlítés
Equalize Entire Image Based On Selected Area A teljes kép kiegyenlítése a kijelölt terület alapján
Equalize Selected Area Only Csak a kijelölt terület kiegyenlítése
Exit Kilépés
Export As… Exportálás másként…
Export Preferences… Beállítások exportálása…
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -365,6 +365,8 @@
Match Color… Cocokkan Warna…
Replace Color… Ganti Warna…
Equalize Ekualisasi
Equalize Selected Area Only Ekualisasi seleksi saja
Equalize Entire Image Based On Selected Area Ekualisasi seluruh gambar berdasarkan seleksi
Auto Tone Auto Tone
Auto Contrast Auto Kontras
Auto Color Auto Warna
Can't render this file because it contains an unexpected character in line 4 and column 47.
+2
View File
@@ -393,6 +393,8 @@
Match Color… Corrispondenza colore…
Replace Color… Sostituisci colore…
Equalize Equalizza
Equalize Selected Area Only Equalizza solo l'area selezionata
Equalize Entire Image Based On Selected Area Equalizza l'intera immagine in base all'area selezionata
Auto Tone Tono automatico
Auto Contrast Contrasto automatico
Auto Color Colore automatico
Can't render this file because it contains an unexpected character in line 79 and column 53.
+2
View File
@@ -403,6 +403,8 @@
Match Color… カラーを一致…
Replace Color… 色を置き換え…
Equalize 平均化
Equalize Selected Area Only 選択範囲のみ平均化
Equalize Entire Image Based On Selected Area 選択範囲に基づいて画像全体を平均化
Auto Tone 自動トーン補正
Auto Contrast 自動コントラスト
Auto Color 自動カラー補正
Can't render this file because it contains an unexpected character in line 6 and column 47.
File diff suppressed because it is too large. Load diff
+2
View File
@@ -369,6 +369,8 @@
Match Color… 색상 일치…
Replace Color… 색상 대체…
Equalize 균일화
Equalize Selected Area Only 선택 영역만 균일화
Equalize Entire Image Based On Selected Area 선택 영역을 기준으로 전체 이미지 균일화
Auto Tone 자동 톤
Auto Contrast 자동 대비
Auto Color 자동 색상
Can't render this file because it contains an unexpected character in line 63 and column 53.
+2
View File
@@ -335,6 +335,8 @@
Match Color… Kleur afstemmen…
Replace Color… Kleur vervangen…
Equalize Egaliseren
Equalize Selected Area Only Alleen geselecteerd gebied egaliseren
Equalize Entire Image Based On Selected Area Hele afbeelding egaliseren op basis van geselecteerd gebied
Auto Tone Automatische tooncorrectie
Auto Contrast Automatisch contrast
Auto Color Automatische kleur
Can't render this file because it contains an unexpected character in line 8 and column 34.
+2
View File
@@ -378,6 +378,8 @@
Match Color… Dopasuj kolor…
Replace Color… Zamień kolor…
Equalize Wyrównaj
Equalize Selected Area Only Wyrównaj tylko zaznaczony obszar
Equalize Entire Image Based On Selected Area Wyrównaj cały obraz na podstawie zaznaczonego obszaru
Auto Tone Automatyczne tony
Auto Contrast Automatyczny kontrast
Auto Color Automatyczny kolor
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -368,6 +368,8 @@
Match Color… Corresponder cores…
Replace Color… Substituir cor…
Equalize Equalizar
Equalize Selected Area Only Equalizar somente a área selecionada
Equalize Entire Image Based On Selected Area Equalizar a imagem inteira com base na área selecionada
Auto Tone Tom automático
Auto Contrast Contraste automático
Auto Color Cor automática
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -996,6 +996,8 @@
Match Color… Подбор цвета…
Replace Color… Замена цвета…
Equalize Выравнивание
Equalize Selected Area Only Выровнять только выделенную область
Equalize Entire Image Based On Selected Area Выровнять всё изображение по выделенной области
HDR Toning… HDR-тонирование…
Shadows/Highlights… Тени/Света…
Amount Эффект
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -394,6 +394,8 @@
Match Color… Uskladi boje…
Replace Color… Zameni boju…
Equalize Izjednači
Equalize Selected Area Only Izjednači samo selekciju
Equalize Entire Image Based On Selected Area Izjednači celu sliku prema selekciji
Auto Tone Automatski ton
Auto Contrast Automatski kontrast
Auto Color Automatske boje
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -172,6 +172,7 @@ mod tests {
(vec!["nb-NO", "en-US"], "nb"),
(vec!["nn_NO.UTF-8", "en-US"], "nb"),
(vec!["is-IS", "no-NO"], "nb"),
(vec!["ka-GE", "ru-RU"], "ka"),
(vec![], "en"),
] {
with_system_tags(&tags, || assert_eq!(system_lang().code(), expected));
+15
View File
@@ -7,6 +7,7 @@ const CS: fn() -> Lang = || Lang::from_code("cs").expect("cs registered");
const ID: fn() -> Lang = || Lang::from_code("id").expect("id registered");
const VI: fn() -> Lang = || Lang::from_code("vi").expect("vi registered");
const HI: fn() -> Lang = || Lang::from_code("hi").expect("hi registered");
const KA: fn() -> Lang = || Lang::from_code("ka").expect("ka registered");
#[test]
fn hindi_has_the_reveal_and_camera_raw_rows() {
@@ -28,6 +29,20 @@ fn hindi_tags_resolve() {
assert_eq!(Lang::from_pref("HI"), HI());
}
#[test]
fn georgian_tags_resolve() {
for tag in ["ka", "ka-GE", "ka_GE", "ka_GE.UTF-8"] {
assert_eq!(lang_from_tag(tag), Some(KA()), "{tag}");
}
assert_eq!(KA().name(), "ქართული");
assert_eq!(Lang::from_pref("ka"), KA());
assert_eq!(Lang::from_pref("KA"), KA());
assert_eq!(tr(KA(), "Layer"), "შრე");
assert_eq!(tr(KA(), "File"), "ფაილი");
assert_eq!(trn(KA(), 1, "{n} layer", "{n} layers"), "შრე: 1");
assert_eq!(trn(KA(), 3, "{n} layer", "{n} layers"), "შრე: 3");
}
#[test]
fn indonesian_tags_resolve() {
for tag in ["id", "id-ID", "id_ID", "id_ID.UTF-8"] {
+2
View File
@@ -302,6 +302,8 @@
Match Color… Rengi Eşleştir…
Replace Color… Rengi Değiştir…
Equalize Eşitle
Equalize Selected Area Only Yalnızca Seçili Alanı Eşitle
Equalize Entire Image Based On Selected Area Tüm Görüntüyü Seçili Alana Göre Eşitle
Auto Tone Otomatik Ton
Auto Contrast Otomatik Kontrast
Auto Color Otomatik Renk
Can't render this file because it contains an unexpected character in line 8 and column 34.
+2
View File
@@ -967,6 +967,8 @@
Match Color… Узгодити колір…
Replace Color… Замінити колір…
Equalize Вирівняти гістограму
Equalize Selected Area Only Вирівняти лише виділену область
Equalize Entire Image Based On Selected Area Вирівняти все зображення за виділеною областю
HDR Toning… Тонування HDR…
Shadows/Highlights… Тіні/світлі ділянки…
Amount Величина
Can't render this file because it contains an unexpected character in line 152 and column 53.
+2
View File
@@ -411,6 +411,8 @@
Enable Vector Mask Bật mặt nạ vector
Entropy Entropy
Equalize Cân bằng histogram
Equalize Entire Image Based On Selected Area Cân bằng histogram toàn bộ hình ảnh theo vùng chọn
Equalize Selected Area Only Chỉ cân bằng histogram vùng chọn
Exclude Overlapping Shapes Loại phần chồng hình
Subtract Shapes at Overlap Loại phần chồng hình
Export Contents… Xuất nội dung…
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -385,6 +385,8 @@
Match Color… 匹配颜色…
Replace Color… 替换颜色…
Equalize 色调均化
Equalize Selected Area Only 仅色调均化选区
Equalize Entire Image Based On Selected Area 基于选区色调均化整个图像
Auto Tone 自动色调
Auto Contrast 自动对比度
Auto Color 自动颜色
Can't render this file because it contains an unexpected character in line 63 and column 53.
+2
View File
@@ -384,6 +384,8 @@
Match Color… 符合顏色…
Replace Color… 取代顏色…
Equalize 均勻分佈
Equalize Selected Area Only 僅均勻分佈選取範圍
Equalize Entire Image Based On Selected Area 依據選取範圍均勻分佈整個影像
Auto Tone 自動色調
Auto Contrast 自動對比
Auto Color 自動色彩
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -150,6 +150,7 @@ pub use dialogs::disk_change_prompt;
pub use dialogs::distort_ui;
pub use dialogs::duplicate_layer_ui;
pub use dialogs::edit_history;
pub use dialogs::equalize_ui;
pub use dialogs::export_dialog;
pub use dialogs::file_ui;
pub use dialogs::fill_ui;
+4
View File
@@ -687,6 +687,10 @@ fn invoke_view_command(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, p
Some(crate::sizing::open(app, sz).map(|dialog| json!({"dialog": dialog})).ok_or_else(|| "no document".to_string()))
}
"view.newGuide" if params.as_object().is_none_or(|object| object.is_empty()) => Some(Ok(json!({"dialog": crate::new_guide_ui::open(app)}))),
// Image › Adjustments › Equalize with a selection asks what to equalize, as in Photoshop.
crate::equalize_ui::COMMAND if params.as_object().is_none_or(|object| object.is_empty()) && crate::equalize_ui::asks(app) => {
Some(Ok(json!({"dialog": crate::equalize_ui::open(app)})))
}
fl if crate::filter_dialog::has_dialog(fl) && params.as_object().is_none_or(|object| object.is_empty()) => {
Some(Ok(json!({"dialog": crate::filter_dialog::open(app, fl)})))
}
+5 -1
View File
@@ -18,7 +18,7 @@ mod dialogs;
mod dispatch;
mod options;
pub use arrange::cells;
pub use arrange::{Border, borders, cells, drag_border};
pub(crate) use arrange::{document_is_floating, float_window};
pub(crate) use dialogs::write_copy;
#[cfg(test)]
@@ -106,6 +106,9 @@ pub struct ViewOptions {
pub pixel_art_preview: bool,
/// Window › Arrange layout of the document area: "tabs" or a tile/n-up layout id.
pub arrange: String,
/// Where the borders between arranged documents were dragged (#10101): fractions of the
/// area, column borders then row borders; empty (or not fitting the layout) is even cells.
pub arrange_splits: Vec<f32>,
/// Type › Font Preview Size: "small" | "medium" | "large" | "extraLarge" | "huge".
pub font_preview_size: String,
/// Type › Language Options: "defaultFeatures" | "eastAsianFeatures" | "middleEasternFeatures",
@@ -138,6 +141,7 @@ impl Default for ViewOptions {
pattern_preview: false,
pixel_art_preview: false,
arrange: "tabs".into(),
arrange_splits: Vec::new(),
font_preview_size: "medium".into(),
language_features: "defaultFeatures".into(),
middle_eastern_composer: false,
+163 -37
View File
@@ -48,9 +48,14 @@ pub(crate) fn float_window(app: &mut PhotocraftApp, doc: usize, offset: usize, f
wid
}
/// The Window › Arrange items: a layout (2-up, 4-up, Tiled…), which starts from even cells and
/// refits every document, or one of the window commands beside them — Consolidate All to Tabs,
/// New Window, Float in Window, Float All in Windows, Match Zoom and the rest.
pub(super) fn arrange(app: &mut PhotocraftApp, k: &str, p: &Value) -> Result<Value, String> {
if LAYOUTS.contains(&k) {
app.ui.view.arrange = k.to_string();
// A new arrangement starts from even cells.
app.ui.view.arrange_splits.clear();
// Each document fits its new cell.
app.ui.views.iter_mut().for_each(|v| v.fit_pending = true);
return Ok(json!({"arrange": k}));
@@ -137,43 +142,164 @@ pub(crate) fn document_is_floating(app: &PhotocraftApp, doc: usize) -> bool {
app.ui.windows.iter().any(|w| w.open && w.floating && w.document == doc)
}
/// Screen rectangles for `n` documents in an arrangement (`None` = tabs). The active document
/// always gets a cell; n-up layouts show that many documents starting from the active one.
pub fn cells(layout: &str, rect: egui::Rect, n: usize) -> Option<Vec<egui::Rect>> {
use craft_ui::layout::{SplitAxis, SplitSize, split_rect};
if n < 2 || !LAYOUTS.contains(&layout) {
return None;
}
let grid = |cols: usize, rows: usize, count: usize| -> Vec<egui::Rect> {
let (w, h) = (rect.width() / cols as f32, rect.height() / rows as f32);
(0..count.min(cols * rows))
.map(|i| egui::Rect::from_min_size(rect.min + egui::vec2((i % cols) as f32 * w, (i / cols) as f32 * h), egui::vec2(w, h)))
.collect()
};
Some(match layout {
"tileAllVertically" => grid(n, 1, n),
"tileAllHorizontally" => grid(1, n, n),
"twoUpVertical" => {
let panes = split_rect(rect, SplitAxis::Horizontal, SplitSize::Ratio(0.5), 0.0, 0.0)?;
vec![panes.first, panes.second]
}
"twoUpHorizontal" => {
let panes = split_rect(rect, SplitAxis::Vertical, SplitSize::Ratio(0.5), 0.0, 0.0)?;
vec![panes.first, panes.second]
}
"threeUpVertical" => grid(3, 1, 3),
"threeUpHorizontal" => grid(1, 3, 3),
"threeUpStacked" => {
let columns = split_rect(rect, SplitAxis::Horizontal, SplitSize::Ratio(0.5), 0.0, 0.0)?;
let rows = split_rect(columns.second, SplitAxis::Vertical, SplitSize::Ratio(0.5), 0.0, 0.0)?;
vec![columns.first, rows.first, rows.second]
}
"fourUp" => grid(2, 2, 4),
"sixUp" => grid(3, 2, 6),
_ => {
let cols = (n as f32).sqrt().ceil() as usize;
grid(cols, n.div_ceil(cols), n)
/// Screen rectangles for `n` documents in an arrangement (`None` = tabs), with the borders
/// where they were left (`splits`, [`ViewOptions::arrange_splits`](super::ViewOptions)). The
/// active document always gets a cell; n-up layouts show that many documents starting from the
/// active one.
pub fn cells(layout: &str, rect: egui::Rect, n: usize, splits: &[f32]) -> Option<Vec<egui::Rect>> {
let shape = Shape::of(layout, n)?;
let (xs, ys) = shape.lines(rect, splits);
Some(match shape {
Shape::Grid { cols, rows, count } => (0..count.min(cols * rows))
.filter_map(|i| {
let (c, r) = (i % cols, i / cols);
Some(egui::Rect::from_min_max(egui::pos2(*xs.get(c)?, *ys.get(r)?), egui::pos2(*xs.get(c + 1)?, *ys.get(r + 1)?)))
})
.collect(),
// One tall cell on the left; the right column is cut in two.
Shape::Stacked => {
let (x, y) = (xs.get(1).copied().unwrap_or(rect.center().x), ys.get(1).copied().unwrap_or(rect.center().y));
vec![
egui::Rect::from_min_max(rect.min, egui::pos2(x, rect.max.y)),
egui::Rect::from_min_max(egui::pos2(x, rect.min.y), egui::pos2(rect.max.x, y)),
egui::Rect::from_min_max(egui::pos2(x, y), rect.max),
]
}
})
}
/// A border between arranged documents that can be dragged, as in Photoshop (#10101).
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Border {
/// Which of the arrangement's splits it is: the index for [`drag_border`].
pub split: usize,
/// It runs top to bottom (and moves left and right).
pub vertical: bool,
/// Its line on screen: zero wide (or tall) across the cells it divides.
pub line: egui::Rect,
}
/// The borders of an arrangement, as laid out by [`cells`].
pub fn borders(layout: &str, rect: egui::Rect, n: usize, splits: &[f32]) -> Vec<Border> {
let Some(shape) = Shape::of(layout, n) else { return Vec::new() };
let (xs, ys) = shape.lines(rect, splits);
let inner = |v: &[f32]| v.get(1..v.len().saturating_sub(1)).unwrap_or_default().to_vec();
let (inner_x, inner_y) = (inner(&xs), inner(&ys));
let vertical = inner_x.iter().enumerate().map(|(i, &x)| Border {
split: i,
vertical: true,
line: egui::Rect::from_min_max(egui::pos2(x, rect.min.y), egui::pos2(x, rect.max.y)),
});
// 3-up Stacked's row border spans only the right column.
let left = match shape {
Shape::Stacked => inner_x.first().copied().unwrap_or(rect.min.x),
Shape::Grid { .. } => rect.min.x,
};
let horizontal = inner_y.iter().enumerate().map(|(i, &y)| Border {
split: inner_x.len() + i,
vertical: false,
line: egui::Rect::from_min_max(egui::pos2(left, y), egui::pos2(rect.max.x, y)),
});
vertical.chain(horizontal).collect()
}
/// Move border `split` of the arrangement to `pointer` (screen points), keeping every cell at
/// least [`MIN_CELL`] points across where the area allows. `splits` is rewritten in full, so a
/// stale or damaged list starts again from even cells.
pub fn drag_border(layout: &str, rect: egui::Rect, n: usize, splits: &mut Vec<f32>, split: usize, pointer: egui::Pos2) {
let Some(shape) = Shape::of(layout, n) else { return };
let (cols, rows) = shape.counts();
let mut fractions = shape.fractions(splits);
// The borders on the dragged one's axis are `fractions[first..first + count]`.
let (axis_start, axis_len, first, count, pos) = if split < cols - 1 {
(rect.min.x, rect.width(), 0, cols - 1, pointer.x)
} else if split < (cols - 1) + (rows - 1) {
(rect.min.y, rect.height(), cols - 1, rows - 1, pointer.y)
} else {
return;
};
if !(axis_len > 0.0 && pos.is_finite()) {
return;
}
let own = fractions.get(first..first + count).map(<[f32]>::to_vec).unwrap_or_default();
let k = split - first;
// [`MIN_CELL`] in fractions of this axis, whatever the number of cells: capping it by the
// even spacing would let a cell fall under the minimum on a long axis (#10101 review).
let gap = MIN_CELL / axis_len;
let lo = if k == 0 { 0.0 } else { own.get(k - 1).copied().unwrap_or(0.0) } + gap;
let hi = own.get(k + 1).copied().unwrap_or(1.0) - gap;
// The neighbours leave no room for a cell of the minimum width: the border stays where it is,
// rather than taking a value out of order that would invalidate the whole list.
if lo > hi {
return;
}
if let Some(f) = fractions.get_mut(split) {
*f = ((pos - axis_start) / axis_len).clamp(lo, hi);
}
*splits = fractions;
}
/// The narrowest a cell is dragged to, in points.
pub const MIN_CELL: f32 = 80.0;
/// An arrangement as columns and rows of cells.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Shape {
/// `cols` × `rows` even cells, the first `count` of them used.
Grid { cols: usize, rows: usize, count: usize },
/// 3-up Stacked: two columns, the right one in two rows.
Stacked,
}
impl Shape {
fn of(layout: &str, n: usize) -> Option<Shape> {
if n < 2 || !LAYOUTS.contains(&layout) {
return None;
}
let grid = |cols: usize, rows: usize, count: usize| Shape::Grid { cols, rows, count };
Some(match layout {
"tileAllVertically" => grid(n, 1, n),
"tileAllHorizontally" => grid(1, n, n),
"twoUpVertical" => grid(2, 1, 2),
"twoUpHorizontal" => grid(1, 2, 2),
"threeUpVertical" => grid(3, 1, 3),
"threeUpHorizontal" => grid(1, 3, 3),
"threeUpStacked" => Shape::Stacked,
"fourUp" => grid(2, 2, 4),
"sixUp" => grid(3, 2, 6),
_ => {
let cols = (n as f32).sqrt().ceil() as usize;
grid(cols, n.div_ceil(cols), n)
}
})
}
fn counts(self) -> (usize, usize) {
match self {
Shape::Grid { cols, rows, .. } => (cols, rows),
Shape::Stacked => (2, 2),
}
}
/// The split positions as fractions: the column borders, then the row borders. `splits`
/// is used only when it fits this shape (as many values, each axis increasing within 0–1);
/// otherwise the cells are even.
fn fractions(self, splits: &[f32]) -> Vec<f32> {
let (cols, rows) = self.counts();
let even = |k: usize| (1..k).map(move |i| i as f32 / k as f32);
let ordered = |v: &[f32]| v.iter().all(|f| f.is_finite() && *f > 0.0 && *f < 1.0) && v.windows(2).all(|w| matches!(w, [a, b] if a < b));
let fit = splits.len() == (cols - 1) + (rows - 1) && splits.get(..cols - 1).is_some_and(ordered) && splits.get(cols - 1..).is_some_and(ordered);
if fit { splits.to_vec() } else { even(cols).chain(even(rows)).collect() }
}
/// Every column line's x and every row line's y on screen, the area's edges included.
fn lines(self, rect: egui::Rect, splits: &[f32]) -> (Vec<f32>, Vec<f32>) {
let (cols, _) = self.counts();
let fractions = self.fractions(splits);
let (fx, fy) = fractions.split_at((cols - 1).min(fractions.len()));
let at = |start: f32, len: f32, inner: &[f32]| {
std::iter::once(start).chain(inner.iter().map(|f| start + len * f)).chain(std::iter::once(start + len)).collect::<Vec<f32>>()
};
(at(rect.min.x, rect.width(), fx), at(rect.min.y, rect.height(), fy))
}
}
+196 -7
View File
@@ -183,14 +183,14 @@ fn print_size_uses_the_screen_resolution_preference() {
#[test]
fn arrange_layouts_floating_windows_and_matching() {
let (mut app, ctx) = app_with(3);
assert!(cells("tabs", egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 600.0)), 3).is_none());
assert!(cells("tabs", egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 600.0)), 3, &[]).is_none());
menu(&mut app, &ctx, "window.arrange.threeUpStacked", json!({})).unwrap();
assert_eq!(checked(&app, "window.arrange.threeUpStacked"), Some(true));
let c = cells(&app.ui.view.arrange, egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 600.0)), 3).unwrap();
let c = cells(&app.ui.view.arrange, egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 600.0)), 3, &[]).unwrap();
assert_eq!(c.len(), 3);
assert_eq!(c[0].height(), 600.0);
assert_eq!(c[1].height(), 300.0);
let six = cells("sixUp", egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 600.0)), 3).unwrap();
let six = cells("sixUp", egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 600.0)), 3, &[]).unwrap();
assert_eq!((six.len(), six[1].min.x), (6, 300.0));
menu(&mut app, &ctx, "window.arrange.floatAllInWindows", json!({})).unwrap();
assert_eq!(app.ui.windows.len(), 3);
@@ -232,13 +232,109 @@ fn match_zoom_clamps_to_each_documents_zoom_range() {
fn two_up_and_stacked_cells_keep_their_existing_boundaries() {
let rect = egui::Rect::from_min_max(egui::pos2(40.0, 75.0), egui::pos2(940.0, 675.0));
let region = |left, top, right, bottom| egui::Rect::from_min_max(egui::pos2(left, top), egui::pos2(right, bottom));
assert_eq!(cells("twoUpVertical", rect, 2).unwrap(), vec![region(40.0, 75.0, 490.0, 675.0), region(490.0, 75.0, 940.0, 675.0)]);
assert_eq!(cells("twoUpHorizontal", rect, 2).unwrap(), vec![region(40.0, 75.0, 940.0, 375.0), region(40.0, 375.0, 940.0, 675.0)]);
assert_eq!(cells("twoUpVertical", rect, 2, &[]).unwrap(), vec![region(40.0, 75.0, 490.0, 675.0), region(490.0, 75.0, 940.0, 675.0)]);
assert_eq!(cells("twoUpHorizontal", rect, 2, &[]).unwrap(), vec![region(40.0, 75.0, 940.0, 375.0), region(40.0, 375.0, 940.0, 675.0)]);
assert_eq!(
cells("threeUpStacked", rect, 3).unwrap(),
cells("threeUpStacked", rect, 3, &[]).unwrap(),
vec![region(40.0, 75.0, 490.0, 675.0), region(490.0, 75.0, 940.0, 375.0), region(490.0, 375.0, 940.0, 675.0)]
);
assert!(cells("twoUpVertical", rect, 1).is_none());
assert!(cells("twoUpVertical", rect, 1, &[]).is_none());
}
#[test]
fn dragged_arrange_borders_resize_the_cells_beside_them() {
// #10101: in 2-up and the other arrangements the border between documents drags, as in
// Photoshop, and the documents on either side take the new sizes.
use super::arrange::{Border, MIN_CELL};
let near = |a: &[egui::Rect], b: &[egui::Rect]| {
a.len() == b.len() && a.iter().zip(b).all(|(a, b)| (a.min - b.min).length() < 0.01 && (a.max - b.max).length() < 0.01)
};
let rect = egui::Rect::from_min_max(egui::pos2(0.0, 0.0), egui::pos2(900.0, 600.0));
let region = |left, top, right, bottom| egui::Rect::from_min_max(egui::pos2(left, top), egui::pos2(right, bottom));
let mut splits = Vec::new();
let b = borders("twoUpVertical", rect, 2, &splits);
assert_eq!(b, vec![Border { split: 0, vertical: true, line: region(450.0, 0.0, 450.0, 600.0) }]);
drag_border("twoUpVertical", rect, 2, &mut splits, 0, egui::pos2(300.0, 250.0));
assert!(near(&cells("twoUpVertical", rect, 2, &splits).unwrap(), &[region(0.0, 0.0, 300.0, 600.0), region(300.0, 0.0, 900.0, 600.0)]));
assert!((borders("twoUpVertical", rect, 2, &splits)[0].line.min.x - 300.0).abs() < 0.01);
// No cell is dragged narrower than MIN_CELL, nor past the area.
drag_border("twoUpVertical", rect, 2, &mut splits, 0, egui::pos2(-500.0, 0.0));
assert!((cells("twoUpVertical", rect, 2, &splits).unwrap()[0].width() - MIN_CELL).abs() < 0.01);
drag_border("twoUpVertical", rect, 2, &mut splits, 0, egui::pos2(899.0, 0.0));
assert!((cells("twoUpVertical", rect, 2, &splits).unwrap()[1].width() - MIN_CELL).abs() < 0.01);
// 4-up: a column border and a row border, each across the whole area.
let mut splits = Vec::new();
let b = borders("fourUp", rect, 4, &splits);
assert_eq!(b.iter().map(|b| (b.split, b.vertical)).collect::<Vec<_>>(), vec![(0, true), (1, false)]);
drag_border("fourUp", rect, 4, &mut splits, 1, egui::pos2(10.0, 450.0));
let c = cells("fourUp", rect, 4, &splits).unwrap();
assert!(near(&[c[0], c[3]], &[region(0.0, 0.0, 450.0, 450.0), region(450.0, 450.0, 900.0, 600.0)]));
// 3-up Stacked: the row border is only across the right column, and follows the column.
let mut splits = Vec::new();
drag_border("threeUpStacked", rect, 3, &mut splits, 0, egui::pos2(600.0, 0.0));
drag_border("threeUpStacked", rect, 3, &mut splits, 1, egui::pos2(700.0, 200.0));
assert!(near(
&cells("threeUpStacked", rect, 3, &splits).unwrap(),
&[region(0.0, 0.0, 600.0, 600.0), region(600.0, 0.0, 900.0, 200.0), region(600.0, 200.0, 900.0, 600.0)]
));
assert!(near(&[borders("threeUpStacked", rect, 3, &splits)[1].line], &[region(600.0, 200.0, 900.0, 200.0)]));
// Tiled: a border stops short of its neighbours, so the cells keep their order.
let mut splits = Vec::new();
drag_border("threeUpVertical", rect, 3, &mut splits, 0, egui::pos2(800.0, 0.0));
let c = cells("threeUpVertical", rect, 3, &splits).unwrap();
assert!((c[0].max.x - (600.0 - MIN_CELL)).abs() < 0.01 && (c[1].width() - MIN_CELL).abs() < 0.01);
// #10101 review: the limit is MIN_CELL itself, not the even spacing. On a 300 pt axis a
// 2-up cell may still be dragged down to 80 pt, where capping the gap at 0.5/(n+1) would
// have stopped it at 75.
let narrow = egui::Rect::from_min_max(egui::pos2(0.0, 0.0), egui::pos2(300.0, 200.0));
let mut splits = Vec::new();
drag_border("twoUpVertical", narrow, 2, &mut splits, 0, egui::pos2(-100.0, 0.0));
assert!((cells("twoUpVertical", narrow, 2, &splits).unwrap()[0].width() - MIN_CELL).abs() < 0.01);
// And when the neighbours leave no room for a cell of that width, the border stays put and
// the list keeps its order rather than taking a value from the wrong side of them.
let tight = egui::Rect::from_min_max(egui::pos2(0.0, 0.0), egui::pos2(200.0, 200.0));
let mut splits = vec![0.45, 0.55];
drag_border("threeUpVertical", tight, 3, &mut splits, 1, egui::pos2(10.0, 0.0));
assert_eq!(splits, vec![0.45, 0.55], "no room: unchanged");
let mut splits = vec![0.45, 0.55];
drag_border("threeUpVertical", tight, 3, &mut splits, 0, egui::pos2(190.0, 0.0));
assert_eq!(splits, vec![0.45, 0.55], "and from the other side too");
}
#[test]
fn damaged_or_stale_arrange_splits_lay_out_even_cells() {
let rect = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 600.0));
let even = cells("threeUpVertical", rect, 3, &[]).unwrap();
// From a settings file or another layout: wrong count, out of order, outside 0–1, NaN.
for bad in [vec![0.5], vec![0.6, 0.3], vec![0.0, 0.5], vec![0.3, 1.5], vec![f32::NAN, 0.7], vec![0.2, 0.4, 0.6]] {
assert_eq!(cells("threeUpVertical", rect, 3, &bad).unwrap(), even, "{bad:?}");
assert_eq!(borders("threeUpVertical", rect, 3, &bad).len(), 2);
// A drag starts again from even cells.
let mut splits = bad.clone();
drag_border("threeUpVertical", rect, 3, &mut splits, 1, egui::pos2(700.0, 0.0));
assert_eq!(cells("threeUpVertical", rect, 3, &splits).unwrap()[0], even[0], "{bad:?}");
}
// A split that isn't the layout's, or a pointer off the numbers, changes nothing.
let mut splits = vec![0.25, 0.5];
drag_border("threeUpVertical", rect, 3, &mut splits, 2, egui::pos2(700.0, 0.0));
drag_border("threeUpVertical", rect, 3, &mut splits, 0, egui::pos2(f32::NAN, 0.0));
drag_border("threeUpVertical", egui::Rect::NOTHING, 3, &mut splits, 0, egui::pos2(10.0, 0.0));
assert_eq!(splits, vec![0.25, 0.5]);
assert!(borders("tabs", rect, 3, &[]).is_empty());
}
#[test]
fn choosing_an_arrangement_starts_from_even_cells() {
let (mut app, ctx) = app_with(2);
menu(&mut app, &ctx, "window.arrange.twoUpVertical", json!({})).unwrap();
app.ui.view.arrange_splits = vec![0.3];
menu(&mut app, &ctx, "window.arrange.twoUpHorizontal", json!({})).unwrap();
assert!(app.ui.view.arrange_splits.is_empty());
}
#[test]
@@ -1014,6 +1110,50 @@ fn arranged_documents_keep_their_tiles() {
assert_eq!(docs(&mut app, 1), vec![0, 1]);
}
/// #10101: dragging the border between two arranged documents moves it. Grabbed inside the
/// other document's edge, it doesn't make that document the active one.
#[test]
fn dragging_the_border_between_arranged_documents_resizes_them() {
use egui_kittest::Harness;
let (mut app, _) = app_with(2);
app.ui.view.arrange = "twoUpVertical".into();
app.ui.tool = crate::state::Tool::Brush;
// The right-hand document is active; the grab below is inside the left one's edge.
app.session.set_active(1);
let mut h = Harness::builder().with_size(egui::vec2(1000.0, 600.0)).build_ui_state(
|ui, app: &mut PhotocraftApp| {
if !ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
return;
}
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
},
app,
);
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
h.run_steps(4);
let area = h.state().last_canvas_rect;
let n = h.state().session.documents().len();
let border = borders("twoUpVertical", area, n, &[])[0].line;
// On the grip, 2 pt inside the left document (its cell ends 1 pt short of the border).
let from = border.center() - egui::vec2(2.0, 0.0);
let to = from - egui::vec2(200.0, 0.0);
let ev = |h: &mut Harness<'_, PhotocraftApp>, e: egui::Event| h.input_mut().events.push(e);
let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE };
ev(&mut h, egui::Event::PointerMoved(from));
h.run();
ev(&mut h, button(from, true));
h.run();
for step in 1..=10 {
ev(&mut h, egui::Event::PointerMoved(from + (to - from) * (step as f32 / 10.0)));
h.run();
}
ev(&mut h, button(to, false));
h.run_steps(2);
let cells = cells("twoUpVertical", area, n, &h.state().ui.view.arrange_splits).unwrap();
assert!((cells[0].max.x - to.x).abs() < 1.0, "the border follows the pointer: {cells:?}, pointer at {}", to.x);
assert_eq!(h.state().session.active_index(), Some(1), "grabbing the border activates no document");
}
/// #6017: rulers showed in the active tile only; the other tile had none and no room for them.
#[test]
fn every_arranged_tile_has_rulers() {
@@ -1108,3 +1248,52 @@ fn full_screen_modes_need_a_document() {
leave_full_screen_without_document(&mut app, &ctx);
assert_eq!(app.ui.view.screen_mode, "standard");
}
/// #10101 review: the grip overlaps the *active* document's edge too, and a press there must
/// drag the border without painting. The cells the canvases are actually drawn in follow.
#[test]
fn grabbing_the_border_inside_the_active_document_drags_it_without_painting() {
use egui_kittest::Harness;
let (mut app, _) = app_with(2);
app.ui.view.arrange = "twoUpVertical".into();
app.ui.tool = crate::state::Tool::Brush;
// The right-hand document is active, and the grab below is inside *its* edge.
app.session.set_active(1);
let mut h = Harness::builder().with_size(egui::vec2(1000.0, 600.0)).build_ui_state(
|ui, app: &mut PhotocraftApp| {
if !ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
return;
}
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
},
app,
);
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
h.run_steps(4);
let area = h.state().last_canvas_rect;
let n = h.state().session.documents().len();
let border = borders("twoUpVertical", area, n, &[])[0].line;
let steps = |h: &Harness<'_, PhotocraftApp>| h.state().session.active().map_or(0, |d| d.history.entries().len());
let before = steps(&h);
// 2 pt into the right-hand (active) document, where its canvas would otherwise take the press.
let from = border.center() + egui::vec2(2.0, 0.0);
let to = from + egui::vec2(150.0, 0.0);
let ev = |h: &mut Harness<'_, PhotocraftApp>, e: egui::Event| h.input_mut().events.push(e);
let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE };
ev(&mut h, egui::Event::PointerMoved(from));
h.run();
ev(&mut h, button(from, true));
h.run();
for step in 1..=10 {
ev(&mut h, egui::Event::PointerMoved(from + (to - from) * (step as f32 / 10.0)));
h.run();
}
ev(&mut h, button(to, false));
h.run_steps(2);
assert_eq!(steps(&h), before, "the press dragged the border and painted nothing");
assert_eq!(h.state().session.active_index(), Some(1), "the active document stays active");
// And the cells the documents are drawn in follow the border, not just the stored fractions.
let shown = crate::canvas::arranged_cells(h.state(), area).expect("two documents are arranged");
assert!((shown[0].1.max.x - to.x).abs() < 2.0, "the left cell ends at the border: {:?}, pointer at {}", shown[0].1, to.x);
assert!((shown[1].1.min.x - to.x).abs() < 2.0, "and the right one starts there: {:?}", shown[1].1);
}
+6 -1
View File
@@ -408,7 +408,12 @@ fn play_owned(app: &mut PhotocraftApp, params: &Value, suspended: Option<Value>,
}
// The dialog toggle: show the step's dialog with its recorded values and continue
// from the next step when it is confirmed (`resume`). Agents play headlessly.
if action.dialogs.contains(&i) && !app.automation_input && (crate::filter_dialog::has_dialog(id) || crate::adjust_dialog::has_dialog(id)) {
if action.dialogs.contains(&i)
&& !app.automation_input
&& (crate::filter_dialog::has_dialog(id)
|| crate::adjust_dialog::has_dialog(id)
|| (id == crate::equalize_ui::COMMAND && crate::equalize_ui::asks(app)))
{
let label = label_of(id);
let active_layer = app.session.active().and_then(|st| st.active_layer);
let dialog = crate::dialogs::open_command_dialog(app, id, &label);
@@ -2036,6 +2036,37 @@ fn a_dialog_toggled_step_pauses_playback_and_resumes_on_ok() {
assert!(v.get("paused").is_none());
}
#[test]
fn equalize_step_with_a_selection_opens_its_choices() {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
app.run("file.new", json!({"width": 16, "height": 16})).unwrap();
app.run("layer.new.layer", json!({})).unwrap();
app.run("select.rect", json!({"x": 0, "y": 0, "width": 16, "height": 8})).unwrap();
app.run("edit.fill", json!({"color": [0.4, 0.4, 0.4]})).unwrap();
app.run("select.rect", json!({"x": 0, "y": 8, "width": 16, "height": 8})).unwrap();
app.run("edit.fill", json!({"color": [0.5, 0.5, 0.5]})).unwrap();
app.run("select.rect", json!({"x": 0, "y": 0, "width": 8, "height": 16})).unwrap();
let mut action = Action::new("Equalize", vec![(crate::equalize_ui::COMMAND.into(), json!({}))]);
action.dialogs.insert(0);
app.session.actions.list.push(action);
let gray = |app: &PhotocraftApp, x: i32, y: i32| {
let st = app.session.active().unwrap();
st.doc.layer(st.active_layer.unwrap()).unwrap().surface().unwrap().pixel(x, y)[0]
};
let result = play(&mut app, &json!({"action": "Equalize"})).unwrap();
let id = result["paused"]["dialog"].as_u64().unwrap();
let fields = &app.ui.dialog_mut(id).unwrap().fields;
assert!(crate::equalize_ui::owns(fields));
assert_eq!(fields["selectedAreaOnly"], true);
assert!((gray(&app, 12, 1) - 0.4).abs() < 0.01, "nothing changes before OK");
// OK with the entire image chosen maps the pixels outside the selection too.
app.ui.dialog_mut(id).unwrap().fields.insert("selectedAreaOnly".into(), json!(false));
crate::dialogs::confirm(&mut app, id).unwrap();
assert!(gray(&app, 12, 1) < 0.05 && gray(&app, 12, 12) > 0.95, "outside the selection too");
}
/// An 8×6 document, a Child action whose first step (a blur) shows its dialog and whose
/// second step adds a "Suffix" layer, and recording into Owner started.
fn recording_with_dialog_child() -> PhotocraftApp {
+175
View File
@@ -210,6 +210,181 @@ fn the_pen_carries_on_an_open_path_from_either_end() {
assert_eq!((work.subpaths.len(), work.subpaths[1].closed, work.subpaths[1].knots.len()), (2, true, 3));
}
/// #10726: after another tool, the Curvature Pen carries an open path on as in Photoshop: a click on
/// its endpoint selects it, and the next click continues the path from there. The subpath is
/// extended in one History step, its segments keep their shape, and the new anchors take smooth
/// curvature handles.
#[test]
fn the_curvature_pen_carries_on_an_open_path() {
let mut app = app(Tool::Pen);
click(&mut app, 20.0, 20.0);
// A curve: the middle anchor's handles dragged out further than the Curvature Pen would set.
tool_event(&mut app, ToolEvent::Down { x: 80.0, y: 20.0, pressure: 1.0 }, Modifiers::NONE);
tool_event(&mut app, ToolEvent::Move { x: 130.0, y: 10.0, pressure: 1.0 }, Modifiers::NONE);
tool_event(&mut app, ToolEvent::Up { x: 130.0, y: 10.0 }, Modifiers::NONE);
click(&mut app, 80.0, 80.0);
crate::vector_ui::pen_commit(&mut app, false);
let before = work_path(&app).subpaths[0].knots.clone();
assert_ne!(before[1].out_ctrl, before[1].anchor, "the middle anchor has handles");
let steps = |app: &PhotocraftApp| app.session.active().unwrap().history.past_len();
let at = steps(&app);
app.ui.tool = Tool::CurvaturePen;
click(&mut app, 80.0, 80.0);
assert!(app.ui.pen.is_none(), "the click selects the endpoint, it draws nothing");
click(&mut app, 140.0, 120.0);
assert!(app.ui.pen.as_ref().is_some_and(|p| p.curvature && p.knots.len() == 4), "the next click carries the path on");
click(&mut app, 200.0, 80.0);
crate::vector_ui::pen_commit(&mut app, false);
let work = work_path(&app);
assert_eq!(work.subpaths.len(), 1, "the same subpath, extended");
let knots = &work.subpaths[0].knots;
let anchors: Vec<[f64; 2]> = knots.iter().map(|k| [k.anchor.x, k.anchor.y]).collect();
assert_eq!(anchors, [[20.0, 20.0], [80.0, 20.0], [80.0, 80.0], [140.0, 120.0], [200.0, 80.0]]);
assert_eq!(steps(&app), at + 1, "one History step");
// The Pen's straight segments keep their shape: the first knots are as they were, and the
// endpoint keeps its incoming handle.
assert_eq!((knots[0], knots[1]), (before[0], before[1]));
assert_eq!((knots[2].anchor, knots[2].in_ctrl), (before[2].anchor, before[2].in_ctrl));
// The new anchor in the middle is smooth: its handles lie either side of it.
let mid = &knots[3];
assert!(mid.in_ctrl != mid.anchor && mid.out_ctrl != mid.anchor, "{mid:?}");
assert!((mid.in_ctrl.x - mid.anchor.x) * (mid.out_ctrl.x - mid.anchor.x) < 0.0, "handles on either side: {mid:?}");
// While it draws on, the Curvature Pen moves only the new anchors: a press on an old corner
// adds an anchor there.
click(&mut app, 200.0, 80.0);
click(&mut app, 260.0, 40.0);
click(&mut app, 80.0, 20.0);
assert_eq!(app.ui.pen.as_ref().map(|p| p.knots.len()), Some(7), "a new anchor, the old one untouched");
assert_eq!(app.ui.pen.as_ref().map(|p| p.knots[1][0]), Some([80.0, 20.0]));
}
/// The work path set to `subpaths`, in one step.
fn set_work_path(app: &mut PhotocraftApp, subpaths: Vec<photocraft_doc::vector::Subpath>) {
app.session
.edit("path", |doc, _| {
doc.work_path = Some(Path::new(subpaths));
Ok(())
})
.unwrap();
}
/// Direct Selection's selection: anchor `[subpath, knot]` of `target`, alone.
fn select_anchor(app: &mut PhotocraftApp, target: crate::direct_select::PathRef, anchor: [usize; 2]) {
app.ui.direct_selection.target = Some(target);
app.ui.direct_selection.anchors = vec![anchor];
// Made now, on this document: not a stale selection the next press drops.
app.ui.direct_selection.owner = crate::direct_select::Owner::current(app);
}
/// CodeRabbit on #10744: two open subpaths end on the same point, and the Curvature Pen carries on
/// the one whose endpoint is selected, not the first one ending there.
#[test]
fn the_curvature_pen_carries_on_the_selected_subpath_of_two_that_end_together() {
use photocraft_doc::vector::Subpath;
let mut app = app(Tool::CurvaturePen);
set_work_path(&mut app, vec![Subpath::polyline(&[(20.0, 20.0), (80.0, 80.0)]), Subpath::polyline(&[(200.0, 20.0), (80.0, 80.0)])]);
select_anchor(&mut app, crate::direct_select::PathRef::Work, [1, 1]);
click(&mut app, 140.0, 150.0);
assert_eq!(app.ui.pen.as_ref().and_then(|p| p.resumes.as_ref()).map(|r| r.index), Some(1), "the selected subpath");
crate::vector_ui::pen_commit(&mut app, false);
let work = work_path(&app);
assert_eq!(work.subpaths.iter().map(|s| s.knots.len()).collect::<Vec<_>>(), [2, 3], "the second subpath grew");
}
/// Photoshop: an open Curvature Pen arc carried on from its endpoint goes on as a new Curvature
/// run from that endpoint. The old segments keep their shape, the endpoint keeps its incoming
/// handle, and its outgoing handle and the new knots are those of a path drawn from the endpoint
/// on, so the join is a cusp where both arcs meet, not bent smooth.
#[test]
fn a_carried_on_endpoint_starts_a_new_curvature_run() {
let draw = |points: &[(f64, f64)]| {
let mut app = app(Tool::CurvaturePen);
for &(x, y) in points {
click(&mut app, x, y);
}
assert!(crate::vector_ui::pen_commit(&mut app, false), "the commit goes through");
app
};
let fresh = work_path(&draw(&[(400.0, 300.0), (550.0, 150.0), (700.0, 300.0)])).subpaths[0].knots.clone();
let mut app = draw(&[(100.0, 300.0), (250.0, 150.0), (400.0, 300.0)]);
let before = work_path(&app).subpaths[0].knots.clone();
click(&mut app, 400.0, 300.0);
assert!(app.ui.pen.is_none(), "the click selects the endpoint, it draws nothing");
click(&mut app, 550.0, 150.0);
click(&mut app, 700.0, 300.0);
assert!(crate::vector_ui::pen_commit(&mut app, false), "the commit goes through");
let work = work_path(&app);
assert_eq!(work.subpaths.len(), 1, "the same subpath, extended");
let knots = &work.subpaths[0].knots;
assert_eq!(knots.len(), 5, "carried on by the new anchors");
assert_eq!((knots[0], knots[1]), (before[0], before[1]), "the old segments keep their shape");
assert_eq!((knots[2].anchor, knots[2].in_ctrl), (before[2].anchor, before[2].in_ctrl), "the endpoint keeps its incoming handle");
assert_eq!(knots[2].out_ctrl, fresh[0].out_ctrl, "the endpoint goes on as a new run's first knot: {knots:?}");
assert_eq!((knots[3], knots[4]), (fresh[1], fresh[2]), "the new knots are those of a new run");
// Both arcs meet at the endpoint from above: a cusp, as in Photoshop.
let k = &knots[2];
assert!(k.in_ctrl.y < k.anchor.y && k.out_ctrl.y < k.anchor.y, "{k:?}");
}
/// CodeRabbit on #10744: a curved path carried on from its first endpoint runs backwards, each
/// knot's handles swapped, and that endpoint keeps the handle it had towards the path.
#[test]
fn a_curved_path_carries_on_from_its_first_endpoint_with_its_handles_swapped() {
use photocraft_doc::vector::{Knot, Subpath};
use photocraft_geom::Point;
let mut app = app(Tool::CurvaturePen);
let start = Knot::smooth(Point::new(20.0, 20.0), Point::new(10.0, 30.0), Point::new(30.0, 10.0));
let middle = Knot::smooth(Point::new(50.0, 60.0), Point::new(40.0, 50.0), Point::new(60.0, 70.0));
set_work_path(&mut app, vec![Subpath { closed: false, knots: vec![start, middle, Knot::corner(80.0, 80.0)], op: Default::default() }]);
select_anchor(&mut app, crate::direct_select::PathRef::Work, [0, 0]);
click(&mut app, 0.0, 100.0);
let pen = app.ui.pen.as_ref().expect("the path is carried on");
assert_eq!(pen.resumes.as_ref().map(|r| r.index), Some(0));
let anchors: Vec<[f64; 2]> = pen.knots.iter().map(|k| k[0]).collect();
assert_eq!(anchors, [[80.0, 80.0], [50.0, 60.0], [20.0, 20.0], [0.0, 100.0]], "backwards, then the new anchor");
assert_eq!((pen.knots[1][1], pen.knots[1][2]), ([60.0, 70.0], [40.0, 50.0]), "the curved middle knot's handles are swapped");
assert_eq!(pen.knots[2][1], [30.0, 10.0], "the endpoint's handle towards the path: its old outgoing one");
}
/// CodeRabbit on #10744: a double-click on a knot of the path carried on (not the endpoint it
/// carries on from) changes nothing: those knots keep their handles.
#[test]
fn toggling_a_carried_knot_changes_nothing() {
use photocraft_doc::vector::Subpath;
let mut app = app(Tool::CurvaturePen);
set_work_path(&mut app, vec![Subpath::polyline(&[(20.0, 20.0), (80.0, 20.0), (80.0, 80.0)])]);
select_anchor(&mut app, crate::direct_select::PathRef::Work, [0, 2]);
click(&mut app, 140.0, 120.0);
let before = app.ui.pen.as_ref().map(|p| (p.unlinked.clone(), p.knots.clone()));
crate::vector_ui::curvature_toggle(&mut app, 80.0, 20.0);
assert_eq!(app.ui.pen.as_ref().map(|p| (p.unlinked.clone(), p.knots.clone())), before, "the old corner stays as it was, handles and all");
}
/// CodeRabbit on #10744: in Path mode the Pen carries on the work path, so an endpoint selected
/// on a shape layer, even one on the same point as the work path's, is not carried on: the
/// press starts a new path rather than carrying on the work path from there.
#[test]
fn an_endpoint_on_another_path_than_the_pen_draws_on_starts_a_new_one() {
use photocraft_doc::vector::Subpath;
let mut app = app(Tool::Pen);
app.ui.tool_options.vector_mode = "shape".into();
click(&mut app, 20.0, 20.0);
click(&mut app, 80.0, 80.0);
crate::vector_ui::pen_commit(&mut app, false);
let shape = app.session.active().and_then(|st| st.active_layer).expect("a shape layer").0;
app.ui.tool_options.vector_mode = "path".into();
// The Paths panel on no path: the Pen draws on the work path, not the layer's.
app.ui.selected_path = None;
set_work_path(&mut app, vec![Subpath::polyline(&[(200.0, 20.0), (80.0, 80.0)])]);
// The tool first: switching tools drops a Direct Selection selection.
app.ui.tool = Tool::CurvaturePen;
select_anchor(&mut app, crate::direct_select::PathRef::Layer(shape), [0, 1]);
assert!(crate::direct_select::selected_open_end(&app).is_some(), "the shape's endpoint is selected");
click(&mut app, 140.0, 150.0);
let pen = app.ui.pen.as_ref().expect("a new path");
assert!(pen.resumes.is_none() && pen.knots.len() == 1, "{pen:?}");
}
/// #6593 review: carrying on a subpath keeps its path operation, and a draft whose subpath changed
/// meanwhile refuses without overwriting newer work. The historical test name is retained
/// for reviewed-head provenance; captured-revision validation supersedes its stale fallback.
+12
View File
@@ -241,6 +241,18 @@ fn converting(tool: Tool, mods: Modifiers, pen_idle: bool) -> bool {
!mods.command && (tool == Tool::ConvertPoint || (tool == Tool::Pen && mods.alt && pen_idle))
}
/// The selected anchor when it is the only one and an endpoint of an open subpath of the active
/// path: where the Curvature Pen carries the path on from (#10726), as Photoshop does after a
/// click, or ⌘/Ctrl-click, on the last point. The path, the subpath's index and the knot's.
pub(crate) fn selected_open_end(app: &PhotocraftApp) -> Option<(PathRef, usize, usize)> {
let ds = &app.ui.direct_selection;
let ([[s, k]], Some(target)) = (ds.anchors.as_slice(), ds.target) else { return None };
let (_, path) = active_paths(app).into_iter().find(|(r, _)| *r == target)?;
let sub = path.subpaths.get(*s).filter(|sub| !sub.closed)?;
sub.knots.get(*k).filter(|_| *k == 0 || *k + 1 == sub.knots.len())?;
Some((target, *s, *k))
}
/// Is the Curvature Pen idle (no path being drawn, no ⌘/Ctrl)? Then it edits the active path in
/// place, as in Photoshop: a press on one of its anchors drags it, with no modifier.
fn curvature_idle(app: &PhotocraftApp, mods: Modifiers) -> bool {
+5
View File
@@ -169,6 +169,11 @@ pub struct PenPath {
/// commit replaces that subpath instead of adding one.
#[serde(default)]
pub resumes: Option<Resumed>,
/// The Curvature Pen carrying on a path: its knots as they were, which keep their shape while
/// the new anchors' handles follow them (`curvature_refresh`, #10726). The last one is the
/// endpoint drawing carries on from; only its outgoing handle bends into the new segment.
#[serde(default)]
pub fixed: Vec<[[f64; 2]; 3]>,
}
/// The subpath a Pen path carries on: where it is and what it was when drawing resumed. The
@@ -1,11 +1,58 @@
use super::pen::{cancel_stale, pen_commit};
use super::pen::{cancel_stale, pen_commit, resume_selected};
use super::{PenPath, PhotocraftApp};
/// Recompute a Curvature Pen path's handles from its anchors and corner points.
/// Recompute a Curvature Pen path's handles from its anchors and corner points. The knots of a
/// path it carries on (`PenPath::fixed`) keep theirs, but for the endpoint's outgoing handle
/// and, once the path closes, the first knot's incoming handle (#10726). As in Photoshop, an open
/// path carried on is a new Curvature run from the endpoint: the endpoint's outgoing handle and
/// the new knots are those of a path drawn from the endpoint on, so the join is not made smooth.
/// The first knot's incoming handle, bent into the closing segment, stays in line with its
/// outgoing one, so that knot stays smooth.
pub(super) fn curvature_refresh(pen: &mut PenPath, closed: bool) {
let anchors: Vec<[f64; 2]> = pen.knots.iter().map(|k| k[0]).collect();
let corners: Vec<bool> = (0..anchors.len()).map(|i| pen.unlinked.contains(&i)).collect();
pen.knots = photocraft_vector::edit::curvature_knots(&anchors, &corners, closed);
let last = pen.fixed.len().saturating_sub(1);
let extended = pen.knots.len() > pen.fixed.len();
if extended && !closed && !pen.fixed.is_empty() {
let run = photocraft_vector::edit::curvature_knots(anchors.get(last..).unwrap_or_default(), corners.get(last..).unwrap_or_default(), false);
for (k, r) in pen.knots.iter_mut().skip(last).zip(run) {
*k = r;
}
}
for (i, was) in pen.fixed.iter().enumerate() {
let Some(k) = pen.knots.get_mut(i) else { break };
let (keep_in, keep_out) = (!(closed && i == 0), !(extended && i == last));
k[0] = was[0];
if keep_in {
k[1] = was[1];
}
if keep_out {
k[2] = was[2];
}
if !keep_in && keep_out && !corners.get(i).copied().unwrap_or(false) {
// An outgoing handle on its anchor gives no direction: the kept segment leaves
// towards its next control point, else the next anchor, so the bent handle comes in
// from the far side and the knot is still smooth (CodeRabbit on #10744).
let across = pen.fixed.get(i + 1).map(|n| [n[1], n[0]]);
let toward = std::iter::once(k[2]).chain(across.into_iter().flatten());
if let Some(h) = toward.filter_map(|from| in_line(k[0], from, k[1])).next() {
k[1] = h;
}
}
}
}
/// A handle as long as `bent` from `anchor`, on the far side of it from `kept`: `None` when
/// `kept` lies on the anchor and gives no direction.
fn in_line(anchor: [f64; 2], kept: [f64; 2], bent: [f64; 2]) -> Option<[f64; 2]> {
let (dx, dy) = (anchor[0] - kept[0], anchor[1] - kept[1]);
let d = dx.hypot(dy);
if !(d > 1e-9 && d.is_finite()) {
return None;
}
let len = (bent[0] - anchor[0]).hypot(bent[1] - anchor[1]);
len.is_finite().then(|| [anchor[0] + dx / d * len, anchor[1] + dy / d * len])
}
/// The anchor of the Curvature Pen path being drawn under (x, y), for the cursor.
@@ -44,6 +91,19 @@ pub fn curvature_down(app: &mut PhotocraftApp, x: f64, y: f64) {
if app.ui.pen.is_none() {
app.ui.pen_doc = app.session.active().map(|st| st.doc.id);
}
// With an endpoint of an open path selected (a click, or ⌘/Ctrl-click, on it), the press
// carries that path on from there, as in Photoshop (#10726): its segments keep their shape,
// the press adds the next anchor and the commit extends that subpath.
if app.ui.pen.as_ref().is_none_or(|p| p.knots.is_empty())
&& let Some(mut resumed) = resume_selected(app)
{
resumed.curvature = true;
resumed.fixed = resumed.knots.clone();
app.ui.pen = Some(resumed);
}
// The anchors of the path carried on stay where they are; the new ones move.
let fixed = app.ui.pen.as_ref().map_or(0, |p| p.fixed.len());
let hit = hit.filter(|&i| i >= fixed);
let Some(owner) = capture_pen_owner(app) else { return };
let pen = app.ui.pen.get_or_insert_with(|| PenPath { curvature: true, ..Default::default() });
if pen.owner.is_none() {
@@ -86,6 +146,11 @@ pub fn curvature_toggle(app: &mut PhotocraftApp, x: f64, y: f64) {
cancel_stale_pen(app);
let Some(i) = curvature_hit(app, x, y) else { return };
let Some(pen) = app.ui.pen.as_mut() else { return };
// The knots of a path carried on keep their handles (`curvature_refresh`), but for the
// endpoint drawing carries on from: toggling one of the others would change nothing.
if i + 1 < pen.fixed.len() {
return;
}
if let Some(at) = pen.unlinked.iter().position(|&c| c == i) {
pen.unlinked.remove(at);
} else {
+65 -29
View File
@@ -509,28 +509,47 @@ fn doc_path<'a>(doc: &'a Document, name: &str) -> Option<&'a Path> {
if name == "work" { doc.work_path.as_ref() } else { doc.paths.iter().find(|p| p.name == name).map(|p| &p.path) }
}
/// The open subpath that has its first or last anchor at `(x, y)`, as a Pen path to carry on
/// drawing from there (#6593): of a targeted vector mask, else in Shape mode of the selected shape
/// layer, else of the path a new Pen path would join (the one selected in the Paths panel, else
/// the work path). Its knots run towards that anchor: reversed, handles swapped, when it is the
/// first.
fn resume_at(app: &PhotocraftApp, x: f64, y: f64, tol: f64) -> Option<PenPath> {
/// The path a Pen path carries on (#6593): a targeted vector mask, else in Shape mode the
/// selected shape layer's, else the path a new Pen path would join (the one selected in the Paths
/// panel, else the work path). Its Paths-panel name ("layer" for a layer's), layer and path.
fn resume_target(app: &PhotocraftApp) -> Option<(String, Option<u64>, Path)> {
let st = app.session.active()?;
let doc = st.doc.id.0;
let (name, layer, path) = if let Some((id, p)) = targeted_vector_mask(app) {
("layer".to_string(), Some(id), p)
} else if app.ui.tool_options.vector_mode == "shape" {
if let Some((id, p)) = targeted_vector_mask(app) {
return Some(("layer".to_string(), Some(id), p));
}
if app.ui.tool_options.vector_mode == "shape" {
let (id, p) = active_shape_path(app)?;
("layer".to_string(), Some(id), p)
} else {
let name = app.ui.selected_path.clone().filter(|n| path_exists(&st.doc, n)).unwrap_or_else(|| "work".into());
// A Work Path hidden by Make Selection isn't carried on: a new path replaces it (#6079).
if name == "work" && !work_path_shown(app) {
return None;
return Some(("layer".to_string(), Some(id), p));
}
let name = app.ui.selected_path.clone().filter(|n| path_exists(&st.doc, n)).unwrap_or_else(|| "work".into());
// A Work Path hidden by Make Selection isn't carried on: a new path replaces it (#6079).
if name == "work" && !work_path_shown(app) {
return None;
}
let p = doc_path(&st.doc, &name)?.clone();
Some((name, None, p))
}
/// Subpath `index` of the path a Pen path carries on, as a Pen path to carry on drawing from its
/// last anchor, or from its first when `reversed`: then its knots run backwards, handles swapped.
fn resumed(doc: u64, name: String, layer: Option<u64>, index: usize, sub: &photocraft_doc::vector::Subpath, reversed: bool) -> PenPath {
let mut knots: Vec<_> = sub.knots.iter().map(|k| (knot_points(k), k.smooth)).collect();
if reversed {
knots.reverse();
for (k, _) in &mut knots {
k.swap(1, 2);
}
let p = doc_path(&st.doc, &name)?.clone();
(name, None, p)
};
}
let unlinked = knots.iter().enumerate().filter(|(_, (_, smooth))| !smooth).map(|(i, _)| i).collect();
let resumes = Resumed { doc, path: name, layer, index, was: sub.clone() };
PenPath { knots: knots.into_iter().map(|(k, _)| k).collect(), unlinked, resumes: Some(resumes), ..Default::default() }
}
/// The open subpath that has its first or last anchor at `(x, y)` in the path a Pen path carries
/// on ([`resume_target`]), as a Pen path to carry on drawing from there (#6593).
pub(super) fn resume_at(app: &PhotocraftApp, x: f64, y: f64, tol: f64) -> Option<PenPath> {
let doc = app.session.active()?.doc.id.0;
let (name, layer, path) = resume_target(app)?;
let near = |k: &photocraft_doc::Knot| (k.anchor.x - x).hypot(k.anchor.y - y) < tol;
path.subpaths.iter().enumerate().filter(|(_, s)| !s.closed).find_map(|(i, s)| {
let reversed = if s.knots.last().is_some_and(near) {
@@ -540,19 +559,36 @@ fn resume_at(app: &PhotocraftApp, x: f64, y: f64, tol: f64) -> Option<PenPath> {
} else {
return None;
};
let mut knots: Vec<_> = s.knots.iter().map(|k| (knot_points(k), k.smooth)).collect();
if reversed {
knots.reverse();
for (k, _) in &mut knots {
k.swap(1, 2);
}
}
let unlinked = knots.iter().enumerate().filter(|(_, (_, smooth))| !smooth).map(|(i, _)| i).collect();
let resumes = Resumed { doc, path: name.clone(), layer, index: i, was: s.clone() };
Some(PenPath { knots: knots.into_iter().map(|(k, _)| k).collect(), unlinked, resumes: Some(resumes), ..Default::default() })
Some(resumed(doc, name.clone(), layer, i, s, reversed))
})
}
/// The endpoint Direct Selection has selected ([`crate::direct_select::selected_open_end`]), as
/// a Pen path carrying its very subpath on from it (#10726). `None` unless that endpoint is in
/// the path a Pen path carries on ([`resume_target`]): one in another path starts a new one.
pub(super) fn resume_selected(app: &PhotocraftApp) -> Option<PenPath> {
let (target, index, knot) = crate::direct_select::selected_open_end(app)?;
let st = app.session.active()?;
let (name, layer, path) = resume_target(app)?;
let carried = match layer {
Some(id) => crate::direct_select::PathRef::Layer(id),
None if name == "work" => crate::direct_select::PathRef::Work,
None => crate::direct_select::PathRef::Saved(st.doc.paths.iter().position(|p| p.name == name)?),
};
if carried != target {
return None;
}
let sub = path.subpaths.get(index).filter(|s| !s.closed)?;
let reversed = if knot + 1 == sub.knots.len() {
false
} else if knot == 0 {
true
} else {
return None;
};
Some(resumed(st.doc.id.0, name, layer, index, sub, reversed))
}
/// The resumed path with its subpath carried on: the one subpath of `drawn` takes the old one's
/// anchors and closing, which keeps its other settings (its path operation). `None` when the
/// subpath is no longer the one drawing resumed (another document, or the path changed).
+84
View File
@@ -0,0 +1,84 @@
# Georgian localization and terminology
This note goes with the Georgian catalog (`crates/ui-egui/src/i18n/ka.tsv`). It covers every key
`cargo xtask i18n-coverage` measures and the runtime labels the other complete catalogs carry
(filter and adjustment parameters, Camera Raw, panels, dialogs, status messages). Translations are
written from the meaning of PhotoCraft's English labels; no proprietary translation resources,
fonts, screenshots or user documents are included.
## Choosing Georgian
Open **Edit > Preferences > Interface > Language** (Georgian: **რედაქტირება › პარამეტრები ›
ინტერფეისი › ენა**) and choose **ქართული**. With `interface.language` set to `auto`, the system
locales `ka`, `ka-GE` and `ka_GE.UTF-8` resolve to Georgian.
## Register and style
Commands are verbal nouns (masdar: *შენახვა*, *გახსნა*, *შრის წაშლა*), not imperatives; prompts
and hints address the user politely (*დაწკაპეთ*, *გადაათრიეთ*). Product and technology names
(PhotoCraft, OpenType, CMYK, Lab) stay as they are, and the trailing `…` of dialog commands is kept.
## Georgian script
- Mkhedruli has no letter case, so nothing is capitalised and labels never use Mtavruli.
The text engine's **All Caps** maps Mkhedruli to Mtavruli through Unicode `to_uppercase`, which
is the Unicode-standard behaviour; there is no title-case feature that needs a Georgian guard.
- Nouns stay singular after a numeral, so the catalog uses one plural form and count-neutral
wording: `{n} layers` is `შრე: {n}` (`plural_none` in the registry).
- UI font: PhotoCraft bundles no Georgian face. The fallback list in `crates/text/src/scripts.rs`
uses system fonts: Noto Sans Georgian, Segoe UI, Sylfaen, DejaVu Sans and
FreeSans. The web build has no system fonts, so it needs a Georgian face before Georgian can render
there.
- PhotoCraft has no per-language date or number formatting, so nothing Georgian-specific applies.
## Terminology
Follow this table when adding or changing Georgian strings.
| English source | Georgian | Note |
|---|---|---|
| File / Edit / Select / View / Window | ფაილი / რედაქტირება / მონიშვნა / ხედი / ფანჯარა | menu bar |
| Image | გამოსახულება | the edited picture |
| Canvas / Canvas Size… | ტილო / ტილოს ზომა… | |
| Layer / Layers | შრე / შრეები | |
| Selection | მონიშნული | the selected area; the menu is მონიშვნა |
| Layer Mask / Vector Mask | შრის ნიღაბი / ვექტორული ნიღაბი | |
| Clipping Mask | მომჭრელი ნიღაბი | |
| Smart Object | ჭკვიანი ობიექტი | |
| Rasterize | რასტრირება | |
| Path / Work Path | ტრაექტორია / სამუშაო ტრაექტორია | not კონტური |
| Stroke | კონტური | outline of a shape or text |
| Channel / Alpha | არხი / ალფა | |
| Spot Color / Spot Channel | სპოტ-ფერი / სპოტ-ფერის არხი | |
| Adjustments | კორექცია | |
| Blend Mode / Blending Options | შერევის რეჟიმი / შერევის პარამეტრები | |
| Opacity | გაუმჭვირვალობა | |
| Preset / Presets | პრესეტი / პრესეტები | |
| Pattern | პატერნი | |
| Swatches | ფერის ნიმუშები | |
| Slice | ნაჭერი | |
| Crop | ჩამოჭრა | |
| Feather | კიდეების შერბილება | |
| Hue / Lightness | ფერის ტონი / სიღიავე | |
| Threshold | ზღვარი | |
| Brush / Eraser / Smudge | ფუნჯი / საშლელი / გადღაბნა | |
| Healing Brush | აღმდგენი ფუნჯი | |
| Reset | ჩამოყრა | |
| Paste | ჩასმა | |
| Workspace | სამუშაო სივრცე | |
| Foreground / Background Color | წინა პლანის ფერი / ფონის ფერი | |
## Not covered
Engine error and status messages, user document, layer and preset names, automation command IDs
and the default `Untitled` / `Background` names stay in English, as in every language.
## Maintenance
Add a row to `ka.tsv` for each new English label: `context<TAB>source<TAB>translation`, with
`@plural` rows holding one Georgian form and `@id` rows overriding a command id. Keep `{name}`
placeholders, `\n`, `…` and shortcut text exactly as in the source. Checks:
- `cargo test -p photocraft-ui-egui --lib i18n`: registry, locale tags, placeholders and catalog
consistency.
- `cargo xtask i18n-coverage`: measured key coverage for `ka`.
+7 -5
View File
@@ -1,10 +1,10 @@
# Localization parity
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-11-06 · **Change:** minor (Azerbaijani UI catalog merged with current languages; native review pending; Bosnian UI catalog; previously minor: Swedish, Finnish, Danish and Norwegian Bokmål UI catalogs; previously minor: Arabic UI catalog) · **Target:** Adobe Photoshop 2026
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-11-06 · **Change:** minor (Georgian interface catalog; previously minor: Azerbaijani UI catalog merged with current languages; native review pending; Bosnian UI catalog; previously minor: Swedish, Finnish, Danish and Norwegian Bokmål UI catalogs; previously minor: Arabic UI catalog) · **Target:** Adobe Photoshop 2026
Per-language status of PhotoCraft's UI. How catalogs work and how to add one:
[`localization.md`](localization.md). Language notes: [Korean](localization-ko.md), [Spanish](localization-es.md),
[Simplified Chinese](localization-zh-hans.md), [Italian](localization-it.md), [Russian](localization-ru.md).
[Simplified Chinese](localization-zh-hans.md), [Italian](localization-it.md), [Russian](localization-ru.md), [Georgian](localization-ka.md).
**How measured.** `cargo xtask i18n-coverage` (`xtask/src/i18n_coverage.rs`) defines the key
universe: `tl!("…")` literals and `trn(` plurals in `ui-egui` (tests excluded), menu-catalog
@@ -24,7 +24,7 @@ Vietnamese UI; Arabic and Hebrew users get English "Middle East" builds with the
composer, and its text engine handles RTL, Devanagari and Indic scripts.
**Summary.** 7 of the 12 key languages at 100% of measured keys (status `partial` because of the
engine messages), 2 absent (Hindi, Vietnamese), plus 17 other registered languages. Weighted by
engine messages), 2 absent (Hindi, Vietnamese), plus 18 other registered languages. Weighted by
speakers, ~55% ready. Remaining: 80–140 h, plus native-speaker review (recorded only for Italian,
2026-10-12).
@@ -47,13 +47,14 @@ speakers, ~55% ready. Remaining: 80–140 h, plus native-speaker review (recorde
## Other shipped languages
17 registered languages are outside the twelve-language table. The following eight have
18 registered languages are outside the twelve-language table. The following nine have
1,608 / 1,608 measured keys, status `partial` for the same reason: Traditional
Chinese `zh-hant` (2,329 rows), Russian `ru` (4,227 keys; also every dynamic label the
other catalogs translate, [notes](localization-ru.md)), Ukrainian `uk` (3,375), Czech `cs` (3,522),
Polish `pl` (3,366), Greek `el` (3,481), Dutch `nl` (3,568), Italian `it` (4,164; also every dynamic label the
other catalogs translate; reviewed by a native speaker, [notes](localization-it.md)). Hungarian
`hu` (4,347 rows) is also registered. Turkish `tr`
`hu` (4,347 rows) is also registered. Georgian `ka` (4,530 rows; every measured key on 2026-10-31;
Georgian UI fallback font: Noto Sans Georgian, Segoe UI, Sylfaen, SF Georgian, DejaVu Sans; on the web the first served font for `Geor`). Turkish `tr`
(3,731 rows) also covers every measured key. Serbian `sr` (4,022 rows, Latin script, Ekavian, added 2026-10-12) covers every
measured key and the union of the other catalogs' dynamic labels; its one/few/many plurals reuse
the Russian rule. Swedish `sv` (4,552 rows, added 2026-10-28) covers every measured key and the
@@ -113,6 +114,7 @@ engine localization or native review is complete.
| 2026-10-13 | minor | Italian: the `Screen` blend mode read *Schermo* (the display) and is now *Scherma*; the Dodge/Burn/Sponge tool names were already Adobe's (*Scherma*, *Brucia*, *Spugna*) and stay. Pinned by a test |
| 2026-10-18 | minor | Russian: 1,229 dynamic labels added (filter and adjustment parameters, Camera Raw, lighting, History/Layers/paths menus, metadata, System Info, status templates, dialogs) with a terminology note ([localization-ru](localization-ru.md)) |
| 2026-10-22 | minor | Arabic row: paragraph direction has Auto / Left-to-right / Right-to-left buttons in the Paragraph panel and Type options bar (#6793); the visual RTL caret is still missing (TYPE-218-2 partial) |
| 2026-10-22 | minor | Georgian (`ka`) catalog |
| 2026-10-28 | minor | Arabic (`ar`) UI catalog: every measured key, six plural forms; layer names and the title bar no longer reversed on egui 0.37 |
| 2026-10-29 | minor | Swedish (`sv`) UI catalog: every measured key plus the dynamic labels, combined from #5985 and #9536 |
| 2026-10-29 | minor | Finnish (`fi`), Danish (`da`) and Norwegian Bokmål (`nb`) UI catalogs: every measured key plus the dynamic labels, combined from #5666, #6961, #7267, #8072 and #9025 |
+1
View File
@@ -36,6 +36,7 @@ contextual, command-ID and plural translations; missing entries fall back to Eng
| Suomi | `fi` | one / other (partitive after every count but 1) |
| Dansk | `da` | one / other |
| Norsk bokmål | `nb` | one / other |
| ქართული | `ka` | one form (count-neutral: `შრე: {n}`) |
| עברית | `he` | one / other |
| اردو | `ur` | one / other |
| Română | `ro` | one / few (0, 2–19, 101–119 …) / other (20–100, 120 …) |
+1 -1
View File
@@ -1,6 +1,6 @@
# PhotoCraft vs Adobe Photoshop: target-app parity
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-11-02 · **Change:** minor (RGB and CMYK documents preview their spot inks as an overprint, FILE-215-17 narrows to PDF Separation, #10249; tile-sparse Select and Mask outputs and preview coverage, #8822; classical Select › Sky can seed substantial high-confidence components beneath an obstructed top band; learned segmentation remains open; Art History Brush Opacity on the options bar, #10263; no estimate changed; Automation Batch Esc Continue/Stop and read-only input previews now follow the measured cancellation flow; full live tabs remain partial, AUTO-219-5, #4579; Automation recording folds Move-tool nudge runs, records keyboard document switches by opening-order offset and scales point text placement; paragraph boxes remain open, #4514; Automation Batch output naming and UTF-16 logs now follow measured Photoshop behavior; progress and cancel prompt remain partial, AUTO-219-5, #4579; 11 of 183 preferences do nothing: startup reads Graphics Adapter through the typed Performance section, so the scorecard audit sees it; selected colour sets edit drawing, tone and supported filters; geometry remains open; Smooth and Feather command masks cropped to selection bounds plus blur reach; cropped selection morphology and command mask conversion performance evidence added; the Camera Raw row names per-camera colour for non-DNG cameras as missing, not the Calibration panel, which landed 2026-10-13; Content-Aware Scale measurements added, #5236; Help › Check for Updates and an opt-out check once per launch, DIST-220-1 partial, #5485; area type, TYPE-218-10 partial, Type scorecard 5 / 5 / 0; 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; PSD spot plates in Photoshop's polarity, #7415 split; TIFF spot plates, FILE-215-17's TIFF part, #7415) · **Target:** Adobe Photoshop 2026; Print: Japanese paper sizes — はがき, 往復はがき, JIS B5/B4, A6, L判, 2L判, KG判, 六切, 四切;
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-11-02 · **Change:** minor (RGB and CMYK documents preview their spot inks as an overprint, FILE-215-17 narrows to PDF Separation, #10249; tile-sparse Select and Mask outputs and preview coverage, #8822; classical Select › Sky can seed substantial high-confidence components beneath an obstructed top band; learned segmentation remains open; Art History Brush Opacity on the options bar, #10263; no estimate changed; Automation Batch Esc Continue/Stop and read-only input previews now follow the measured cancellation flow; full live tabs remain partial, AUTO-219-5, #4579; Automation recording folds Move-tool nudge runs, records keyboard document switches by opening-order offset and scales point text placement; paragraph boxes remain open, #4514; Automation Batch output naming and UTF-16 logs now follow measured Photoshop behavior; progress and cancel prompt remain partial, AUTO-219-5, #4579; 11 of 183 preferences do nothing: startup reads Graphics Adapter through the typed Performance section, so the scorecard audit sees it; selected colour sets edit drawing, tone and supported filters; geometry remains open; Smooth and Feather command masks cropped to selection bounds plus blur reach; Equalize with a selection asks Selected Area Only or Entire Image Based On Selected Area; cropped selection morphology and command mask conversion performance evidence added; the Camera Raw row names per-camera colour for non-DNG cameras as missing, not the Calibration panel, which landed 2026-10-13; Content-Aware Scale measurements added, #5236; Help › Check for Updates and an opt-out check once per launch, DIST-220-1 partial, #5485; area type, TYPE-218-10 partial, Type scorecard 5 / 5 / 0; 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; PSD spot plates in Photoshop's polarity, #7415 split; TIFF spot plates, FILE-215-17's TIFF part, #7415) · **Target:** Adobe Photoshop 2026; Print: Japanese paper sizes — はがき, 往復はがき, JIS B5/B4, A6, L判, 2L判, KG判, 六切, 四切;
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);