mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-14 11:16:53 -04:00
Select › Modify: bound the canvas-edge margin and translate Apply At Canvas Bounds
The margin Modify pads a canvas-edge selection with was twice the radius for every operation, so Feather 1000 added 2002 px a side. It now pads by each operation's reach (Feather 1.5 r, the others r) and refuses a padded mask over 2^30 pixels instead of aborting on the allocation. The new dialog option is translated in every shipped language. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UHgFEHEsefoQoBParH47JA
This commit is contained in:
1 parent
d7859f17c7
commit
4d4ab93f83
13 files changed
+25
-2
No files matched your search
@@ -244,8 +244,15 @@ fn modify(s: &mut Session, p: &Value, op: &str) -> Result<Value> {
|
||||
let (w, h) = (area.width() as usize, area.height() as usize);
|
||||
// Feather reaches 3σ = 1.5 r; the others reach r. A margin past that keeps the canvas edge out of
|
||||
// reach. A selection clear of the canvas edge needs none: both readings agree there.
|
||||
let pad = if touches_edge(&m, w, h) { (r * 2.0).ceil() as usize + 2 } else { 0 };
|
||||
let (pw, ph) = (w + 2 * pad, h + 2 * pad);
|
||||
let reach = if op == "feather" { r * 1.5 } else { r };
|
||||
let pad = if touches_edge(&m, w, h) { reach.ceil() as usize + 2 } else { 0 };
|
||||
let grown = |n: usize| pad.checked_mul(2).and_then(|p| n.checked_add(p));
|
||||
let (Some(pw), Some(ph)) = (grown(w), grown(h)) else {
|
||||
return Err(EngineError::BadParams { cmd: format!("select.modify.{op}"), msg: "the selection is too large to modify".into() });
|
||||
};
|
||||
if pw.checked_mul(ph).is_none_or(|n| n > MAX_MODIFY_PIXELS) {
|
||||
return Err(EngineError::BadParams { cmd: format!("select.modify.{op}"), msg: "the selection is too large to modify".into() });
|
||||
}
|
||||
let padded = pad_mask(&m, w, h, pad, at_bounds);
|
||||
let out = match op {
|
||||
"expand" => sel::expand(&padded, pw, ph, r),
|
||||
@@ -265,6 +272,10 @@ fn modify(s: &mut Session, p: &Value, op: &str) -> Result<Value> {
|
||||
set_selection(s, label, area, out, SelectionMode::Replace)
|
||||
}
|
||||
|
||||
/// The largest padded mask Modify works on (a 300000 × 300000 canvas is 9e10 pixels; this caps a
|
||||
/// padded copy at ~4 GB of f32, beyond which the edit is refused rather than aborting on allocation).
|
||||
const MAX_MODIFY_PIXELS: usize = 1 << 30;
|
||||
|
||||
/// Whether any pixel on the outermost rows or columns of `m` (`w`×`h`) is selected.
|
||||
fn touches_edge(m: &[f32], w: usize, h: usize) -> bool {
|
||||
let sel = |x: usize, y: usize| m.get(y * w + x).is_some_and(|v| *v > 0.0);
|
||||
|
||||
@@ -2134,3 +2134,4 @@ cameraRaw Color Barvy
|
||||
% of all commits % všech commitů
|
||||
Lines +/− Řádky +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: PR: {prs}, commity: {commits}, řádky +{added} / −{deleted} (Δ {delta}), binární soubory +{binAdded} / −{binDeleted}, {first} – {last}
|
||||
Apply At Canvas Bounds Použít efekt na hranicích plátna
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2173,3 +2173,4 @@
|
||||
% of all commits % aller Commits
|
||||
Lines +/− Zeilen +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PRs, {commits} Commits, +{added} / −{deleted} Zeilen (Δ {delta}), +{binAdded} / −{binDeleted} Binärdateien, {first} – {last}
|
||||
Apply At Canvas Bounds Effekt an Arbeitsflächenbegrenzungen anwenden
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2205,3 +2205,4 @@ cameraRaw Amount Cantidad
|
||||
% of all commits % de todos los commits
|
||||
Lines +/− Líneas +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PR, {commits} commits, +{added} / −{deleted} líneas (Δ {delta}), +{binAdded} / −{binDeleted} archivos binarios, {first} – {last}
|
||||
Apply At Canvas Bounds Aplicar efecto en los límites del lienzo
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -2565,3 +2565,4 @@ cameraRaw Blending Fusion
|
||||
% of all commits % de tous les commits
|
||||
Lines +/− Lignes +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login} : {prs} PR, {commits} commits, +{added} / −{deleted} lignes (Δ {delta}), +{binAdded} / −{binDeleted} fichiers binaires, {first} – {last}
|
||||
Apply At Canvas Bounds Appliquer l’effet aux limites de la zone de travail
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2552,3 +2552,4 @@ cameraRaw Blending Pembauran
|
||||
% of all commits % dari semua commit
|
||||
Lines +/− Baris +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PR, {commits} commit, +{added} / −{deleted} baris (Δ {delta}), +{binAdded} / −{binDeleted} berkas biner, {first} – {last}
|
||||
Apply At Canvas Bounds Terapkan efek di batas kanvas
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -2207,3 +2207,4 @@ cameraRaw Amount Quantità
|
||||
Lines +/− Righe +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PR, {commits} commit, +{added} / −{deleted} righe (Δ {delta}), +{binAdded} / −{binDeleted} risorse binarie, {first} – {last}
|
||||
Convert to Layers Converti in livelli
|
||||
Apply At Canvas Bounds Applica effetto ai limiti dell’area di lavoro
|
||||
|
@@ -2117,3 +2117,4 @@ cameraRaw Color カラー
|
||||
% of all commits 全コミットに占める割合 (%)
|
||||
Lines +/− 行数 +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: PR {prs} 件、コミット {commits} 件、行 +{added} / −{deleted} (Δ {delta})、バイナリ +{binAdded} / −{binDeleted}、{first} – {last}
|
||||
Apply At Canvas Bounds カンバスの境界に効果を適用
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2718,3 +2718,4 @@ cameraRaw Color 색상
|
||||
% of all commits 전체 커밋 대비 %
|
||||
Lines +/− 줄 +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: PR {prs}개, 커밋 {commits}개, 줄 +{added} / −{deleted} (Δ {delta}), 바이너리 +{binAdded} / −{binDeleted}, {first} – {last}
|
||||
Apply At Canvas Bounds 캔버스 경계에 효과 적용
|
||||
|
@@ -2572,3 +2572,4 @@ cameraRaw Whites Brancos
|
||||
% of all commits % de todos os commits
|
||||
Lines +/− Linhas +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} linhas (Δ {delta}), +{binAdded} / −{binDeleted} arquivos binários, {first} – {last}
|
||||
Apply At Canvas Bounds Aplicar efeito nos limites da tela
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2408,3 +2408,4 @@ cameraRaw Roughness Неровность
|
||||
% of all commits % от всех коммитов
|
||||
Lines +/− Строки +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: PR: {prs}, коммиты: {commits}, строки +{added} / −{deleted} (Δ {delta}), двоичные файлы +{binAdded} / −{binDeleted}, {first} – {last}
|
||||
Apply At Canvas Bounds Применить эффект на границах холста
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2142,3 +2142,4 @@ cameraRaw Blending 混合
|
||||
% of all commits 占全部提交的 %
|
||||
Lines +/− 行数 +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}:{prs} 个 PR,{commits} 次提交,行 +{added} / −{deleted}(Δ {delta}),二进制文件 +{binAdded} / −{binDeleted},{first} – {last}
|
||||
Apply At Canvas Bounds 应用画布边界的效果
|
||||
|
@@ -2111,3 +2111,4 @@ cameraRaw Blending 混合
|
||||
% of all commits 佔全部提交的 %
|
||||
Lines +/− 行數 +/−
|
||||
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}:{prs} 個 PR,{commits} 次提交,行 +{added} / −{deleted}(Δ {delta}),二進位檔 +{binAdded} / −{binDeleted},{first} – {last}
|
||||
Apply At Canvas Bounds 套用效果至版面邊界
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
Reference in new issue
Block a user