Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Free Transform: H and V skew fields in the options bar (#4699)

Dan Hiorns4fd08b5395b7
diff --git a/crates/ui-egui/src/cam_transform.rs b/crates/ui-egui/src/cam_transform.rs
index 27b0943a0..a2afa8d81 100644
--- a/crates/ui-egui/src/cam_transform.rs
+++ b/crates/ui-egui/src/cam_transform.rs
@@ -59,6 +59,7 @@ pub(crate) fn begin(app: &mut PhotocraftApp, offset: [i32; 2]) -> bool {
made: None,
mode: Default::default(),
content_aware: None,
+ skew_v: 0.0,
};
app.ui.cam_transform = Some(CamTransform { document, revision, offset, frame, gesture: None });
app.ui.status = crate::i18n::fmt(tl!("Scale or rotate the moved area, then press {key}"), &[("key", &crate::shortcuts::pretty("Enter"))]);
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 8785f2b8e..178f3d183 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -161,6 +161,8 @@
Transform Again on a Copy Duplikovat a opakovat transformaci
Scale Měřítko
Rotate Otočit
+ Set horizontal skew Nastavit vodorovné zkosení
+ Set vertical skew Nastavit svislé zkosení
Skew Zkosit
Distort Zkreslit
Perspective Perspektiva
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index b41bf78ac..15a8f3d53 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -158,6 +158,8 @@
Transform Again on a Copy Erneut auf Kopie transformieren
Scale Skalieren
Rotate Drehen
+ Set horizontal skew Horizontale Neigung festlegen
+ Set vertical skew Vertikale Neigung festlegen
Skew Neigen
Distort Verzerren
Perspective Perspektive
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index d0e64a7a2..33ed8e158 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -173,6 +173,8 @@
Transform Μετασχηματισμός
Free Transform Ελεύθερος μετασχηματισμός
Rotate Περιστροφή
+ Set horizontal skew Ορισμός οριζόντιας λοξής παραμόρφωσης
+ Set vertical skew Ορισμός κατακόρυφης λοξής παραμόρφωσης
Flip Horizontal Οριζόντια αναστροφή
Flip Vertical Κατακόρυφη αναστροφή
Crop Περικοπή
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index 1b41bd811..4982af80a 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -155,6 +155,8 @@
Transform Again on a Copy Transformar de nuevo una copia
Scale Escalar
Rotate Rotar
+ Set horizontal skew Definir sesgado horizontal
+ Set vertical skew Definir sesgado vertical
Skew Sesgar
Distort Distorsionar
Perspective Perspectiva
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index eae456798..e29496ad5 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -158,6 +158,8 @@
Again Répéter
Scale Mise à l'échelle
Rotate Rotation
+ Set horizontal skew Définir l'inclinaison horizontale
+ Set vertical skew Définir l'inclinaison verticale
Skew Inclinaison
Distort Déformation
Perspective Perspective
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index 023f69a27..2f83eb910 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -206,6 +206,8 @@
Reveal All Minden megjelenítése
Revert Visszaállítás
Rotate Forgatás
+ Set horizontal skew Vízszintes döntés beállítása
+ Set vertical skew Függőleges döntés beállítása
Rotate 180° Forgatás 180°-kal
Rotate 90° Clockwise Forgatás 90°-kal az óramutató járása szerint
Rotate 90° Counter Clockwise Forgatás 90°-kal az óramutató járásával szemben
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index fbe5a2384..ba8ac9667 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -151,6 +151,8 @@
Again Lagi
Scale Skala
Rotate Putar
+ Set horizontal skew Atur kemiringan horizontal
+ Set vertical skew Atur kemiringan vertikal
Skew Miringkan
Distort Distorsi
Perspective Perspektif
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index cd6d991da..dc52628d2 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -154,6 +154,8 @@
Transform Again on a Copy Trasforma di nuovo su una copia
Scale Scala
Rotate Ruota
+ Set horizontal skew Imposta inclinazione orizzontale
+ Set vertical skew Imposta inclinazione verticale
Skew Inclina
Distort Distorci
Perspective Prospettiva
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index d28ff1b6b..9461dd82b 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -156,6 +156,8 @@
Transform Again on a Copy 複製してもう一度変形
Scale 拡大・縮小
Rotate 回転
+ Set horizontal skew 水平方向の斜体を設定
+ Set vertical skew 垂直方向の斜体を設定
Skew 斜体
Distort ゆがみ
Perspective 遠近法
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 84a67f4d1..f33aefd40 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -145,6 +145,8 @@
Transform Again on a Copy 사본에 변형 다시 적용
Scale 크기 조절
Rotate 회전
+ Set horizontal skew 가로 기울이기 설정
+ Set vertical skew 세로 기울이기 설정
Skew 기울이기
Distort 왜곡
Perspective 원근
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index a84deb41c..e5f74527d 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -147,6 +147,8 @@
Transform Again on a Copy Opnieuw transformeren op een kopie
Scale Schalen
Rotate Roteren
+ Set horizontal skew Horizontale schuinte instellen
+ Set vertical skew Verticale schuinte instellen
Skew Schuintrekken
Distort Vervormen
Perspective Perspectief
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 1012ca21c..8291a0a3b 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -154,6 +154,8 @@
Transform Again on a Copy Przekształć ponownie na kopii
Scale Skaluj
Rotate Obróć
+ Set horizontal skew Ustaw pochylenie poziome
+ Set vertical skew Ustaw pochylenie pionowe
Skew Pochyl
Distort Zniekształć
Perspective Perspektywa
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index c21ddd5e4..002d26806 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -153,6 +153,8 @@
Again Novamente
Scale Escala
Rotate Girar
+ Set horizontal skew Definir inclinação horizontal
+ Set vertical skew Definir inclinação vertical
Skew Inclinar
Distort Distorcer
Perspective Perspectiva
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 41649e75d..9be736f71 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -1187,6 +1187,8 @@
Offset Смещение
Reset Transform Сбросить трансформацию
Rotate Повернуть
+ Set horizontal skew Задать наклон по горизонтали
+ Set vertical skew Задать наклон по вертикали
Flip Horizontal Отразить по горизонтали
Flip Vertical Отразить по вертикали
Frame Sync Синхронизация кадров
diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv
index 87b908197..412a2e958 100644
--- a/crates/ui-egui/src/i18n/sr.tsv
+++ b/crates/ui-egui/src/i18n/sr.tsv
@@ -159,6 +159,8 @@
Scale Skaliranje
Rotate Rotacija
Skew Iskošenje
+ Set horizontal skew Podesi horizontalno iskošenje
+ Set vertical skew Podesi vertikalno iskošenje
Distort Izobličenje
Perspective Perspektiva
Warp Krivljenje
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index 897eb2e3e..139f6d457 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -144,6 +144,8 @@
Transform Again on a Copy Bir Kopyada Yeniden Dönüştür
Scale Ölçekle
Rotate Döndür
+ Set horizontal skew Yatay eğmeyi ayarla
+ Set vertical skew Dikey eğmeyi ayarla
Skew Eğ
Distort Çarpıt
Perspective Perspektif
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 39ab35aed..72f4cffb7 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -1165,6 +1165,8 @@
Offset Зсув
Reset Transform Скинути трансформацію
Rotate Повернути
+ Set horizontal skew Задати горизонтальний скіс
+ Set vertical skew Задати вертикальний скіс
Flip Horizontal Віддзеркалити горизонтально
Flip Vertical Віддзеркалити вертикально
Frame Sync Синхронізація кадрів
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index 9725a54c9..590c4b87e 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -145,6 +145,8 @@
Restore Khôi phục
Revert Hoàn nguyên
Rotate Xoay
+ Set horizontal skew Đặt độ nghiêng ngang
+ Set vertical skew Đặt độ nghiêng dọc
Rotate 180° Xoay 180°
Rotate 90° Clockwise Xoay 90° theo chiều kim đồng hồ
Rotate 90° Counter Clockwise Xoay 90° ngược chiều kim đồng hồ
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 044f8cfc8..50ba2bb7b 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -154,6 +154,8 @@
Transform Again on a Copy 复制并再次变换
Scale 缩放
Rotate 旋转
+ Set horizontal skew 设置水平斜切
+ Set vertical skew 设置垂直斜切
Skew 斜切
Distort 扭曲
Perspective 透视
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 7e2cb9b30..ca23a7451 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -162,6 +162,8 @@
Transform Again on a Copy 複製並再次變形
Scale 縮放
Rotate 旋轉
+ Set horizontal skew 設定水平傾斜
+ Set vertical skew 設定垂直傾斜
Skew 傾斜
Distort 扭曲
Perspective 透視
diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs
index a76640314..b82c7cb02 100644
--- a/crates/ui-egui/src/state.rs
+++ b/crates/ui-egui/src/state.rs
@@ -919,6 +919,10 @@ pub struct TransformSession {
/// `edit.contentAwareScale` with these options instead of `edit.transform`.
#[serde(default)]
pub content_aware: Option<ContentAwareOptions>,
+ /// The options bar's V (vertical skew, degrees) last typed. Any box can be read as scale,
+ /// skew and rotation with any vertical skew, so the bar keeps showing the typed one.
+ #[serde(default)]
+ pub skew_v: f64,
}
/// Content-Aware Scale's options bar: Amount, Protect and Protect Skin Tones.
diff --git a/crates/ui-egui/src/transform_tool.rs b/crates/ui-egui/src/transform_tool.rs
index b16831332..8ee9c08e6 100644
--- a/crates/ui-egui/src/transform_tool.rs
+++ b/crates/ui-egui/src/transform_tool.rs
@@ -259,6 +259,7 @@ pub fn begin(app: &mut PhotocraftApp, ctx: &egui::Context) -> Result<(), String>
made: None,
mode: Default::default(),
content_aware: None,
+ skew_v: 0.0,
});
start_steps(app);
Ok(())
@@ -359,6 +360,7 @@ pub(crate) fn begin_content_aware(
made: None,
mode: Default::default(),
content_aware: Some(Default::default()),
+ skew_v: 0.0,
});
start_steps(app);
Ok(())
@@ -479,6 +481,7 @@ fn begin_lone(
made: None,
mode: Default::default(),
content_aware: None,
+ skew_v: 0.0,
});
start_steps(app);
Ok(())
@@ -531,6 +534,7 @@ fn begin_path(app: &mut PhotocraftApp, ctx: &egui::Context, params: serde_json::
made: None,
mode: Default::default(),
content_aware: None,
+ skew_v: 0.0,
});
start_steps(app);
Ok(())
@@ -615,6 +619,7 @@ pub fn begin_selection(app: &mut PhotocraftApp, ctx: &egui::Context) -> Result<(
made: None,
mode: Default::default(),
content_aware: None,
+ skew_v: 0.0,
});
start_steps(app);
Ok(())
@@ -2414,14 +2419,102 @@ fn quad_scale(t: &TransformSession) -> f32 {
if s.is_finite() { s as f32 } else { 1.0 }
}
-/// Scale (%), angle (°) and translation implied by the current quad (affine readout).
+/// W and H (%), the angle (°) and the horizontal skew (°) the options bar shows for the box.
fn readout(t: &TransformSession) -> (f64, f64, f64, f64) {
- let (w0, h0) = (t.rect[2] - t.rect[0], t.rect[3] - t.rect[1]);
- let e = [t.quad[1][0] - t.quad[0][0], t.quad[1][1] - t.quad[0][1]];
- let f = [t.quad[3][0] - t.quad[0][0], t.quad[3][1] - t.quad[0][1]];
- let sx = (e[0].hypot(e[1]) / w0.max(1e-9)) * 100.0;
- let sy = (f[0].hypot(f[1]) / h0.max(1e-9)) * 100.0;
- (sx, sy, e[1].atan2(e[0]).to_degrees(), 0.0)
+ let p = Parts::of(t);
+ (p.sx * 100.0, p.sy.abs() * 100.0, p.angle.to_degrees(), p.skew_h.to_degrees())
+}
+
+/// The box's affine part read as Photoshop's options bar does: the frame scaled (W, H), skewed
+/// (H, V) and then rotated about the reference point. Angles are radians; positive turns
+/// clockwise on screen, so a positive H skew leans the box's sides like the angle field would
+/// turn them, and a positive V skew its top and bottom.
+#[derive(Clone, Copy, Debug, PartialEq)]
+struct Parts {
+ sx: f64,
+ /// Negative when the box is flipped vertically relative to its rotation.
+ sy: f64,
+ angle: f64,
+ skew_h: f64,
+ skew_v: f64,
+}
+
+/// The skew fields' reach: a skew of ±90° would flatten the box.
+const SKEW_LIMIT_DEG: f32 = 89.0;
+
+impl Parts {
+ /// The box's columns: where the frame's unit X and Y edges went (from the top-left corner).
+ fn columns(t: &TransformSession) -> Option<[[f64; 2]; 2]> {
+ let (w0, h0) = (t.rect[2] - t.rect[0], t.rect[3] - t.rect[1]);
+ if w0.abs() < 1e-9 || h0.abs() < 1e-9 {
+ return None;
+ }
+ let q = &t.quad;
+ let m = [[(q[1][0] - q[0][0]) / w0, (q[1][1] - q[0][1]) / w0], [(q[3][0] - q[0][0]) / h0, (q[3][1] - q[0][1]) / h0]];
+ m.iter().flatten().all(|v| v.is_finite()).then_some(m)
+ }
+
+ /// The box as scale, skew and rotation, keeping the session's typed V skew (any box can be
+ /// written with any V skew short of ±90°).
+ fn of(t: &TransformSession) -> Parts {
+ let skew_v = t.skew_v.to_radians();
+ let none = Parts { sx: 1.0, sy: 1.0, angle: 0.0, skew_h: 0.0, skew_v };
+ Parts::columns(t).map_or(none, |m| Parts::from_columns(m, skew_v))
+ }
+
+ fn from_columns([c0, c1]: [[f64; 2]; 2], skew_v: f64) -> Parts {
+ // X edge = sx · R(angle) · (1, tan v): its direction is the angle plus v.
+ let angle = c0[1].atan2(c0[0]) - skew_v;
+ let sx = c0[0].hypot(c0[1]) * skew_v.cos();
+ // Y edge = sy · R(angle) · (−tan h, 1).
+ let (gx, gy) = unturn(c1, angle);
+ let skew_h = if gy.abs() < 1e-12 { 0.0 } else { (-gx / gy).atan() };
+ Parts { sx, sy: gy, angle, skew_h, skew_v }
+ }
+
+ fn columns_of(self) -> [[f64; 2]; 2] {
+ let (sn, cs) = self.angle.sin_cos();
+ let rot = |x: f64, y: f64| [x * cs - y * sn, x * sn + y * cs];
+ let c0 = rot(self.sx, self.sx * self.skew_v.tan());
+ let c1 = rot(-self.sy * self.skew_h.tan(), self.sy);
+ [c0, c1]
+ }
+}
+
+/// `c` turned back by `angle` (radians).
+fn unturn(c: [f64; 2], angle: f64) -> (f64, f64) {
+ let (sn, cs) = angle.sin_cos();
+ (c[0] * cs + c[1] * sn, -c[0] * sn + c[1] * cs)
+}
+
+/// Sets the box's H and V skew (degrees), keeping its scale, angle and reference point: the
+/// options bar's skew fields.
+fn skew_about_pivot(app: &mut PhotocraftApp, skew_h: f64, skew_v: f64) {
+ let Some(s) = app.ui.transform.as_mut() else { return };
+ let Some(m) = Parts::columns(s) else { return };
+ let limit = f64::from(SKEW_LIMIT_DEG);
+ let (skew_h, skew_v) = (skew_h.clamp(-limit, limit), skew_v.clamp(-limit, limit));
+ let from = Parts::from_columns(m, s.skew_v.to_radians());
+ let to = Parts { skew_h: skew_h.to_radians(), skew_v: skew_v.to_radians(), ..from }.columns_of();
+ // The map from the old box to the new one: to · m⁻¹.
+ let det = m[0][0] * m[1][1] - m[1][0] * m[0][1];
+ if det.abs() < 1e-12 {
+ return;
+ }
+ let inv = [[m[1][1] / det, -m[0][1] / det], [-m[1][0] / det, m[0][0] / det]];
+ let l = |x: f64, y: f64| {
+ let (u, v) = (inv[0][0] * x + inv[1][0] * y, inv[0][1] * x + inv[1][1] * y);
+ [to[0][0] * u + to[1][0] * v, to[0][1] * u + to[1][1] * v]
+ };
+ let c = s.pivot;
+ let quad = s.quad.map(|q| {
+ let d = l(q[0] - c[0], q[1] - c[1]);
+ [c[0] + d[0], c[1] + d[1]]
+ });
+ if quad.iter().flatten().all(|v| v.is_finite()) {
+ s.quad = quad;
+ s.skew_v = skew_v;
+ }
}
/// Width of the mode, cancel and commit cluster kept on the right of the options bar.
@@ -2507,7 +2600,7 @@ pub fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
fn transform_fields(app: &mut PhotocraftApp, ui: &mut egui::Ui, t: &TransformSession) {
let tk = crate::theme::Tokens::get(ui.ctx());
- let (_, _, angle, _) = readout(t);
+ let (_, _, angle, skew_h) = readout(t);
let lbl = |ui: &mut egui::Ui, s: &str| {
ui.label(egui::RichText::new(s).color(tk.text_dim).size(12.0));
};
@@ -2520,6 +2613,16 @@ fn transform_fields(app: &mut PhotocraftApp, ui: &mut egui::Ui, t: &TransformSes
if crate::widgets::value_field(ui, &mut a, -180.0..=180.0, "°", 60.0).changed() {
rotate_about_pivot(app, (a as f64 - angle).to_radians());
}
+ // Photoshop's H and V skew fields: the box's sides lean by H, its top and bottom by V.
+ let (mut h, mut v) = (skew_h as f32, t.skew_v as f32);
+ let lim = -SKEW_LIMIT_DEG..=SKEW_LIMIT_DEG;
+ lbl(ui, "H:");
+ let rh = crate::widgets::value_field(ui, &mut h, lim.clone(), "°", 56.0).on_hover_text(tl!("Set horizontal skew"));
+ lbl(ui, "V:");
+ let rv = crate::widgets::value_field(ui, &mut v, lim, "°", 56.0).on_hover_text(tl!("Set vertical skew"));
+ if rh.changed() || rv.changed() {
+ skew_about_pivot(app, f64::from(h), f64::from(v));
+ }
crate::widgets::vline(ui, 22.0);
lbl(ui, tl!("Interpolation:"));
let mut interp = t.interpolation.clone();
@@ -2850,6 +2953,7 @@ mod tests {
made: None,
mode: Default::default(),
content_aware: None,
+ skew_v: 0.0,
}
}
@@ -3015,6 +3119,58 @@ mod tests {
assert!(h.state().ui.transform.as_ref().unwrap().warp.as_ref().unwrap().is_identity());
}
+ fn eq6(a: f64, b: f64) -> bool {
+ (a - b).abs() < 1e-6
+ }
+
+ /// Scale, skew and rotation read back exactly from the box they make, flips included.
+ #[test]
+ fn parts_round_trip() {
+ for (sx, sy, angle, h, v) in [(1.0, 1.0, 0.0, 0.0, 0.0), (1.5, 0.5, 30.0, 20.0, 0.0), (0.8, -1.2, -120.0, -35.0, 15.0), (2.0, 1.0, 179.0, 0.0, -60.0)] {
+ let p = Parts { sx, sy, angle: f64::to_radians(angle), skew_h: f64::to_radians(h), skew_v: f64::to_radians(v) };
+ let back = Parts::from_columns(p.columns_of(), p.skew_v);
+ for (a, b) in [(back.sx, p.sx), (back.sy, p.sy), (back.angle, p.angle), (back.skew_h, p.skew_h)] {
+ assert!(eq6(a, b), "{p:?} read back as {back:?}");
+ }
+ }
+ }
+
+ /// A box sheared sideways keeps W, H and the angle; only H skew moves (it used to read as a
+ /// taller box).
+ #[test]
+ fn a_sheared_box_reads_as_horizontal_skew() {
+ let mut t = session();
+ // The 100×50 frame with its bottom slid 50·tan 20° to the left: a positive H skew.
+ let d = 50.0 * 20f64.to_radians().tan();
+ t.quad = [[0.0, 0.0], [100.0, 0.0], [100.0 - d, 50.0], [-d, 50.0]];
+ let (w, h, angle, skew) = readout(&t);
+ assert!(eq6(w, 100.0) && eq6(h, 100.0) && eq6(angle, 0.0), "{w} {h} {angle}");
+ assert!(eq6(skew, 20.0), "{skew}");
+ }
+
+ /// Typing H and V skews leans the box about the reference point; the angle, W and H fields keep
+ /// their values, and V stays as typed.
+ #[test]
+ fn skew_fields_lean_the_box_about_the_reference_point() {
+ let t = type_into_bar_field(5, "20");
+ let (w, h, angle, skew) = readout(&t);
+ assert!(eq6(skew, 20.0) && eq6(angle, 0.0) && eq6(w, 100.0) && eq6(h, 100.0), "{w} {h} {angle} {skew}");
+ // The pivot (50, 25) stays put: the top edge slid right, the bottom left, by the same amount.
+ let d = 25.0 * 20f64.to_radians().tan();
+ assert!(eq6(t.quad[0][0], d) && eq6(t.quad[0][1], 0.0) && eq6(t.quad[3][0], -d) && eq6(t.quad[3][1], 50.0), "{:?}", t.quad);
+
+ let t = type_into_bar_field(6, "-10");
+ assert!(eq6(t.skew_v, -10.0));
+ let (w, h, angle, skew) = readout(&t);
+ assert!(eq6(skew, 0.0) && eq6(angle, 0.0) && eq6(w, 100.0) && eq6(h, 100.0), "{w} {h} {angle} {skew}");
+ // The right side rose: tan(−10°) per pixel across, about the pivot.
+ let d = 50.0 * (-10f64).to_radians().tan();
+ assert!(eq6(t.quad[1][1], d) && eq6(t.quad[0][1], -d), "{:?}", t.quad);
+ // A skew past ±90° would flatten the box: the field stops at the limit.
+ let t = type_into_bar_field(5, "120");
+ assert!(eq6(readout(&t).3, f64::from(SKEW_LIMIT_DEG)), "{}", readout(&t).3);
+ }
+
/// Types `text` + Enter into the `n`th numeric field of the transform bar (X, Y, W, H, angle…).
fn type_into_bar_field(n: usize, text: &str) -> TransformSession {
type_into_bar_field_with(|_| {}, n, text)
diff --git a/crates/ui-egui/src/type_transform.rs b/crates/ui-egui/src/type_transform.rs
index 784162b25..2a68366d6 100644
--- a/crates/ui-egui/src/type_transform.rs
+++ b/crates/ui-egui/src/type_transform.rs
@@ -126,6 +126,7 @@ pub(crate) fn frame(app: &mut PhotocraftApp) -> Option<TransformSession> {
made: None,
mode: Default::default(),
content_aware: None,
+ skew_v: 0.0,
})
}
diff --git a/docs/gaps.md b/docs/gaps.md
index 70b2dde40..4b8d7283f 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,6 +1,6 @@
# Where PhotoCraft falls short of Photoshop
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed) · **Target:** Adobe Photoshop 2026
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed) · **Target:** Adobe Photoshop 2026
Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impact
on the way to beta. This is the work list agents pick from: take the highest-ranked entry that
@@ -154,7 +154,7 @@ what an agent can't finish alone.
- **Estimate:** 100–180 h. **Human:** checking feel on real tablets.
### G5. Transform, handles and modifiers
-- **Missing:** H/V skew fields and the full interpolation list; blend mode/opacity edits during
+- **Missing:** the full interpolation list; blend mode/opacity edits during
a transform (#1384); path-point nudge; autoscroll at the edge while selecting (#2231);
wheel and pinch behaviour (#2485, #2463, #1989);
toolbar press-and-hold flyouts (#2301).
@@ -165,7 +165,7 @@ what an agent can't finish alone.
snapping (#2681, #2684); Auto-Select box follows the picked layer (#2666, #2675); ⌘-arrow
layer nudge (#2474, #2556); polygonal lasso Shift angles (#2352, #2396); double-click Zoom tool
to 100% (#2508, #2527); tool-key memory in a group (#2608, #2625); hold-a-key spring-loaded
- tools (#2672).
+ tools (#2672); H/V skew fields in the Free Transform options bar.
- **Detail:** [`ui-parity.md`](ui-parity.md).
- **Estimate:** 60–110 h.
@@ -242,6 +242,7 @@ what an agent can't finish alone.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-12 | minor | G5: Free Transform options bar H/V skew fields done |
| 2026-10-12 | minor | G9: toolbar tool shortcut editing (#4086); the remaining workspace gaps stay open |
| 2026-10-12 | minor | G1: #2465 (CS2 `PlLd`-only smart objects) marked fixed |
| 2026-10-12 | minor | G5: spring-loaded tool letters done (#2672) |
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index 1322980b8..7fbd5bdc9 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1,6 +1,6 @@
# PhotoCraft vs Adobe Photoshop: target-app parity
-> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-12 · **Change:** minor (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) · **Target:** Adobe Photoshop 2026
+> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-12 · **Change:** minor (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) · **Target:** Adobe Photoshop 2026
The authoritative answer to "how close is PhotoCraft to Photoshop, and how much work is left". The
one-page summary is [`ROADMAP.md`](../ROADMAP.md); the ranked work list is [`gaps.md`](gaps.md);
@@ -171,7 +171,7 @@ parity for the area and are already contained in the dimension rows above.
| Selections, Select and Mask, channels | 55% | 120–200 | All selection tools, single row/column marquee included (#2837). Select and Mask is a dialog with Photoshop's view modes, a Refine Edge Brush and six outputs, not a workspace (TOOL-214-1), no Refine Hair (#2671); Select Subject/Sky classical, 559 ms p50 on 24 MP vs a 100 ms budget |
| Painting and brush engine | 55% | 150–250 | Every Brush Settings section exists; feel is the gap: lag on big brushes, pressure jumps, smoothing and edge quality reports ([brush-parity.md](brush-parity.md)) |
| Retouching (healing, clone, patch, remove, content-aware) | 50% | 100–180 | Remove tool non-generative; Content-Aware Fill has no workspace (TOOL-214-15); live stroke preview only for Brush/Eraser (TOOL-213-7) |
-| Transform, warp, puppet, perspective, liquify | 55% | 100–180 | Free Transform modifiers right, with a right-click transform menu (TOOL-214-5); no skew fields; Puppet Warp mesh follows the object outline (TOOL-214-6); Liquify called "useless" by a user (#2606) |
+| Transform, warp, puppet, perspective, liquify | 55% | 100–180 | Free Transform modifiers right, with a right-click transform menu (TOOL-214-5) and H/V skew fields; Puppet Warp mesh follows the object outline (TOOL-214-6); Liquify called "useless" by a user (#2606) |
| Adjustments and filters | 70% | 120–200 | All present; smart-filter re-render matches Photoshop on 5 of 30 files; Filter Gallery looks approximate; no Neural Filters |
| Type | 40% | 120–200 | Engine works; no type on a path, manual kerning, RTL paragraphs, OpenType panel UI, live Warp Text preview; Type tool freeze on macOS (#2518) |
| Vector shapes and paths | 55% | 80–140 | Pen, Direct/Path Selection, shapes, shape strokes. Freeform and Curvature Pen (#1054). Add/Delete Anchor Point and Convert Point tools exist (`Tool` enum); missing on-canvas corner radius (TOOL-214-12), path-point nudge; shape parity tracking issue #2496 |
@@ -563,6 +563,7 @@ See [method, raw measurements and reproduction](five-algorithm-performance.md).
| Date | Change | Summary |
|---|---|---|
+| 2026-10-12 | minor | Free Transform options bar H/V skew fields; percentages unchanged |
| 2026-10-12 | minor | Photoshop Actions `.atn` load and save (90 events mapped both ways); percentages unchanged |
| 2026-10-12 | minor | Rows checked against `main` and the regenerated scorecard: menu count 631, Workspace checklist and preference count, transform context menu, Puppet Warp mesh, Select and Mask, anchor-point tools, Smart Object conversion, Stamp Visible, mask targeting, Free Transform commit/cancel, Vietnamese catalog, Windows ARM64; percentages, weights and hours not re-measured |
| 2026-10-10 | minor | Added measured Tilt-Shift computation/filtered-proxy gains and inconclusive cases; parity percentages and budgets unchanged |
diff --git a/docs/ui-parity.md b/docs/ui-parity.md
index 708e5276a..2f620ecdc 100644
--- a/docs/ui-parity.md
+++ b/docs/ui-parity.md
@@ -1,6 +1,6 @@
# UI parity: tools, handles, modifiers and feel
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows) · **Target:** Adobe Photoshop 2026
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows) · **Target:** Adobe Photoshop 2026
How PhotoCraft's direct manipulation compares with Photoshop 2026 (27.11.0): the toolbox, the
handles and modifier keys of each gesture, nudging, snapping, numeric precision, navigation,
@@ -66,7 +66,7 @@ Triangle and Curvature Pen (minus legacy Rounded Rectangle and Targeted Adjustme
| ⌘-corner distort, ⌘-edge skew, ⌘⌥⇧ perspective, ⇧ rotate in 15° steps | done | |
| Warp: presets, bend, split crosswise/vertical/horizontal, 3×3–5×5 and custom grids | done | |
| Options bar X/Y, W/H % with link, angle | done | |
-| Options bar H/V skew fields | missing | |
+| Options bar H/V skew fields | done | `transform_tool.rs` (`Parts`, `skew_about_pivot`): W/H, angle and skew read as Photoshop decomposes the box; `skew_fields_lean_the_box_about_the_reference_point` |
| Interpolation in the options bar | partial | Bicubic/Bilinear/Nearest; no Bicubic Smoother/Sharper/Automatic, Preserve Details |
| Commit/cancel buttons in the options bar | missing | #2442 |
| Right-click menu during transform (Scale, Rotate, Skew, Distort, Perspective, Warp, flips, rotates) | missing | TOOL-214-5 |
@@ -228,3 +228,4 @@ Paragraph; the rest open as in-app floating windows.
| 2026-10-12 | minor | Pen Auto Add/Delete on the active path, with its options-bar checkbox, hover feedback and + / − cursor badge (#4144) |
| 2026-10-12 | minor | Toolbar tool shortcuts can be reassigned, removed and reset in Keyboard Shortcuts (#4086); capture, restart, group cycling, conflict and text-focus regressions |
| 2026-10-12 | minor | Smart filter rows can be selected, and dragged (⌥: copied) onto another smart object or onto Delete (#4271) |
+| 2026-10-12 | minor | Free Transform options bar: H and V skew fields; a sheared box reads as skew instead of a taller H |