Skip to content

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

Layer Style: Bevel & Emboss Technique dropdown (#5147) (#5181)

Valentin Kleinda6ceeaf9626
diff --git a/crates/engine/src/layer_style.rs b/crates/engine/src/layer_style.rs
index fa6f5be2e..95b547685 100644
--- a/crates/engine/src/layer_style.rs
+++ b/crates/engine/src/layer_style.rs
@@ -98,7 +98,7 @@ pub fn effect_defaults(kind: &str) -> Value {
}
"patternOverlay" => json!({"blend": "Normal", "opacity": 100, "pattern": "", "angle": 0, "scale": 100, "link": true}),
"bevelEmboss" => {
- json!({"style": "inner", "depth": 100, "direction": "up", "size": 5, "soften": 0, "angle": 120, "useGlobalLight": true, "altitude": 30, "glossContour": "Linear", "contour": false, "contourName": "Linear", "contourRange": 50, "contourAntiAlias": false})
+ json!({"style": "inner", "technique": "smooth", "depth": 100, "direction": "up", "size": 5, "soften": 0, "angle": 120, "useGlobalLight": true, "altitude": 30, "glossContour": "Linear", "contour": false, "contourName": "Linear", "contourRange": 50, "contourAntiAlias": false})
}
"satin" => {
json!({"blend": "Multiply", "color": "#000000", "opacity": 50, "angle": 19, "distance": 11, "size": 14, "contour": "Linear", "antiAlias": true, "invert": true})
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 843908a97..c256200fc 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -3753,4 +3753,8 @@ navigator Zoom Zvětšení
Sent to {printer} Odesláno do {printer}
set in Print Settings… nastavuje se v nastavení tisku…
ICO is limited to 256 × 256 pixels ICO je omezen na 256 × 256 pixelů
+# Bevel & Emboss Technique.
+ Technique Technika
+ Chisel Hard Tvrdé tesání
+ Chisel Soft Měkké tesání
Open color-less EXR as ACEScg Otevřít EXR bez údaje o barevném prostoru jako ACEScg
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index df4f60854..7e403a498 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -3143,4 +3143,8 @@ curves Smooth Glätten
Sent to {printer} An {printer} gesendet
set in Print Settings… in den Druckeinstellungen festlegen…
ICO is limited to 256 × 256 pixels ICO ist auf 256 × 256 Pixel begrenzt
+# Bevel & Emboss Technique.
+ Technique Technik
+ Chisel Hard Meißeln hart
+ Chisel Soft Meißeln weich
Open color-less EXR as ACEScg Farbangabenloses EXR als ACEScg öffnen
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index cb8c21371..0b53fe2b7 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -3843,4 +3843,8 @@ curves Smooth Εξομάλυνση
Sent to {printer} Στάλθηκε στον {printer}
set in Print Settings… ορίζεται στις ρυθμίσεις εκτύπωσης…
ICO is limited to 256 × 256 pixels Το ICO περιορίζεται σε 256 × 256 εικονοστοιχεία
+# Bevel & Emboss Technique.
+ Technique Τεχνική
+ Chisel Hard Σκληρή σμίλευση
+ Chisel Soft Μαλακή σμίλευση
Open color-less EXR as ACEScg Άνοιγμα EXR χωρίς χρωματική δήλωση ως ACEScg
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index 202cafb22..f3a9df7e2 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -2830,4 +2830,8 @@ curves Smooth Suavizar
Sent to {printer} Enviado a {printer}
set in Print Settings… se establece en Ajustes de impresión…
ICO is limited to 256 × 256 pixels ICO está limitado a 256 × 256 píxeles
+# Bevel & Emboss Technique.
+ Technique Técnica
+ Chisel Hard Cincelar duro
+ Chisel Soft Cincelar suave
Open color-less EXR as ACEScg Abrir EXR sin espacio de color como ACEScg
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index b7895538e..8d54a8cdc 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -3147,4 +3147,8 @@ curves Smooth Lisser
Sent to {printer} Envoyé à {printer}
set in Print Settings… défini dans les paramètres d’impression…
ICO is limited to 256 × 256 pixels Le format ICO est limité à 256 × 256 pixels
+# Bevel & Emboss Technique.
+ Technique Technique
+ Chisel Hard Ciselage dur
+ Chisel Soft Ciselage doux
Open color-less EXR as ACEScg Ouvrir les EXR sans espace colorimétrique en ACEScg
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index a62c83811..78a661346 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -4066,4 +4066,8 @@ cameraRaw Yellow Sárga
Ink Characteristics Festék jellemzői
Solidity: Fedőképesség:
Redrawing Újrarajzolás
+# Bevel & Emboss Technique.
+ Technique Technika
+ Chisel Hard Kemény vésés
+ Chisel Soft Lágy vésés
Open color-less EXR as ACEScg Színinformáció nélküli EXR megnyitása ACEScg-ként
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 662bf7564..6497616c4 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -3134,4 +3134,8 @@ curves Smooth Haluskan
Sent to {printer} Dikirim ke {printer}
set in Print Settings… diatur di Pengaturan Cetak…
ICO is limited to 256 × 256 pixels ICO dibatasi hingga 256 × 256 piksel
+# Bevel & Emboss Technique.
+ Technique Teknik
+ Chisel Hard Pahat Keras
+ Chisel Soft Pahat Lembut
Open color-less EXR as ACEScg Buka EXR tanpa informasi warna sebagai ACEScg
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index ee60c0a59..bea1a0867 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -4108,6 +4108,10 @@ navigator Zoom Zoom
Sent to {printer} Inviato a {printer}
set in Print Settings… impostato nelle impostazioni di stampa…
ICO is limited to 256 × 256 pixels ICO è limitato a 256 × 256 pixel
+# Bevel & Emboss Technique.
+ Technique Tecnica
+ Chisel Hard Cesello duro
+ Chisel Soft Cesello morbido
Open color-less EXR as ACEScg Apri gli EXR senza spazio colore come ACEScg
# Color management, Liquify, glyph group, warp and Camera Raw labels the Serbian, Vietnamese and Japanese catalogs added
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index e5a286ce0..901549c75 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -3822,4 +3822,8 @@ curves Smooth スムーズ
Reset All Locked Settings ロックされた設定をすべて初期化
Copy Texture to Other Tools テクスチャを他のツールにコピー
ICO is limited to 256 × 256 pixels ICO は 256 × 256 ピクセルまでです
+# Bevel & Emboss Technique.
+ Technique テクニック
+ Chisel Hard チゼルハード
+ Chisel Soft チゼルソフト
Open color-less EXR as ACEScg 色空間のないEXRをACEScgとして開く
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 0ebcd6414..79cc195b7 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -3320,4 +3320,8 @@ curves Smooth 매끄럽게
Sent to {printer} {printer}(으)로 전송됨
set in Print Settings… 인쇄 설정에서 지정…
ICO is limited to 256 × 256 pixels ICO는 256 × 256픽셀로 제한됩니다
+# Bevel & Emboss Technique.
+ Technique 기법
+ Chisel Hard 단단하게 조각
+ Chisel Soft 부드럽게 조각
Open color-less EXR as ACEScg 색 공간 정보 없는 EXR을 ACEScg로 열기
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index 419025367..dce4d0920 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -3905,4 +3905,8 @@ curves Smooth Vloeiend maken
Sent to {printer} Verzonden naar {printer}
set in Print Settings… instellen in de afdrukinstellingen…
ICO is limited to 256 × 256 pixels ICO is beperkt tot 256 × 256 pixels
+# Bevel & Emboss Technique.
+ Technique Techniek
+ Chisel Hard Beitel hard
+ Chisel Soft Beitel zacht
Open color-less EXR as ACEScg EXR zonder kleurruimte als ACEScg openen
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index cd2e402b7..9a8f77098 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -3743,4 +3743,8 @@ curves Smooth Wygładź
Sent to {printer} Wysłano do {printer}
set in Print Settings… ustawiane w ustawieniach druku…
ICO is limited to 256 × 256 pixels ICO jest ograniczony do 256 × 256 pikseli
+# Bevel & Emboss Technique.
+ Technique Technika
+ Chisel Hard Dłuto twarde
+ Chisel Soft Dłuto miękkie
Open color-less EXR as ACEScg Otwieraj EXR bez profilu koloru jako ACEScg
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index d10389c22..f89e09eb0 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -3935,4 +3935,8 @@ layerLabel No Color Sem cor
Sent to {printer} Enviado para {printer}
set in Print Settings… definido nas configurações de impressão…
ICO is limited to 256 × 256 pixels ICO é limitado a 256 × 256 pixels
+# Bevel & Emboss Technique.
+ Technique Técnica
+ Chisel Hard Cinzel duro
+ Chisel Soft Cinzel suave
Open color-less EXR as ACEScg Abrir EXR sem espaço de cor como ACEScg
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index eab0ee691..e32e5114b 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -3111,4 +3111,8 @@ curves Smooth Сгладить
Gray Value (Median) Уровень серого (медиана)
Integrated Density Интегральная плотность
Length Длина
+# Bevel & Emboss Technique.
+ Technique Метод
+ Chisel Hard Жесткая огранка
+ Chisel Soft Мягкая огранка
Open color-less EXR as ACEScg Открывать EXR без цветового профиля как ACEScg
diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv
index 7c9d18be9..8365404d7 100644
--- a/crates/ui-egui/src/i18n/sr.tsv
+++ b/crates/ui-egui/src/i18n/sr.tsv
@@ -4219,5 +4219,9 @@ shape Appearance Izgled
Ink Characteristics Karakteristike mastila
Solidity: Punoća:
Redrawing Ponovno iscrtavanje
+# Bevel & Emboss Technique.
+ Technique Tehnika
+ Chisel Hard Tvrdo klesanje
+ Chisel Soft Meko klesanje
Open color-less EXR as ACEScg Otvori EXR bez podatka o bojama kao ACEScg
Show home recent files Prikaži nedavne datoteke na početnom ekranu
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index 1809208ab..eaa32fcbb 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -3877,4 +3877,8 @@ cameraData Lens Lens
Ink Characteristics Mürekkep Özellikleri
Solidity: Doluluk:
Redrawing Yeniden çiziliyor
+# Bevel & Emboss Technique.
+ Technique Teknik
+ Chisel Hard Sert Keski
+ Chisel Soft Yumuşak Keski
Open color-less EXR as ACEScg Renk bilgisi olmayan EXR'yi ACEScg olarak aç
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 25bafee65..c6212c5d0 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -3844,4 +3844,8 @@ curves Smooth Згладити
Sent to {printer} Надіслано на {printer}
set in Print Settings… задається в параметрах друку…
ICO is limited to 256 × 256 pixels ICO обмежено розміром 256 × 256 пікселів
+# Bevel & Emboss Technique.
+ Technique Метод
+ Chisel Hard Жорстке різьблення
+ Chisel Soft М'яке різьблення
Open color-less EXR as ACEScg Відкривати EXR без колірного профілю як ACEScg
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index cdbd73bfd..9208112bf 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -3632,4 +3632,8 @@ curves Smooth Làm mượt
Sent to {printer} Đã gửi tới {printer}
set in Print Settings… đặt trong thiết lập in…
ICO is limited to 256 × 256 pixels ICO giới hạn ở 256 × 256 pixel
+# Bevel & Emboss Technique.
+ Technique Kỹ thuật
+ Chisel Hard Đục cứng
+ Chisel Soft Đục mềm
Open color-less EXR as ACEScg Mở EXR không khai báo màu sắc dưới dạng ACEScg
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 22bfcfc64..2ebc4c71c 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2755,4 +2755,8 @@ curves Smooth 平滑
Sent to {printer} 已发送到 {printer}
set in Print Settings… 在打印设置中设置…
ICO is limited to 256 × 256 pixels ICO 最大为 256 × 256 像素
+# Bevel & Emboss Technique.
+ Technique 方法
+ Chisel Hard 雕刻清晰
+ Chisel Soft 雕刻柔和
Open color-less EXR as ACEScg 将无色彩空间信息的 EXR 以 ACEScg 打开
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 3c426d047..92302285c 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -2740,4 +2740,8 @@ curves Smooth 平滑
Sent to {printer} 已傳送至 {printer}
set in Print Settings… 在列印設定中設定…
ICO is limited to 256 × 256 pixels ICO 最大為 256 × 256 像素
+# Bevel & Emboss Technique.
+ Technique 方法
+ Chisel Hard 雕刻清晰
+ Chisel Soft 雕刻柔和
Open color-less EXR as ACEScg 將無色彩空間資訊的 EXR 以 ACEScg 開啟
diff --git a/crates/ui-egui/src/layer_style.rs b/crates/ui-egui/src/layer_style.rs
index 52e53963d..c2781157a 100644
--- a/crates/ui-egui/src/layer_style.rs
+++ b/crates/ui-egui/src/layer_style.rs
@@ -86,6 +86,7 @@ fn spec(kind: &str) -> &'static [(&'static str, &'static str, P)] {
const POS: &[(&str, &str)] = &[("outside", "Outside"), ("inside", "Inside"), ("center", "Center")];
const GSTYLE: &[(&str, &str)] = &[("linear", "Linear"), ("radial", "Radial"), ("angle", "Angle"), ("reflected", "Reflected"), ("diamond", "Diamond")];
const BSTYLE: &[(&str, &str)] = &[("inner", "Inner Bevel"), ("outer", "Outer Bevel"), ("emboss", "Emboss"), ("pillow", "Pillow Emboss")];
+ const TECHNIQUE: &[(&str, &str)] = &[("smooth", "Smooth"), ("chiselHard", "Chisel Hard"), ("chiselSoft", "Chisel Soft")];
const DIR: &[(&str, &str)] = &[("up", "Up"), ("down", "Down")];
const SRC: &[(&str, &str)] = &[("edge", "Edge"), ("center", "Center")];
const CONTOUR: P = P::Contour(Some("antiAlias"));
@@ -163,6 +164,7 @@ fn spec(kind: &str) -> &'static [(&'static str, &'static str, P)] {
],
"bevelEmboss" => &[
("style", "Style", P::Choice(BSTYLE)),
+ ("technique", "Technique", P::Choice(TECHNIQUE)),
("depth", "Depth", P::Slider(1.0, 1000.0, "%")),
("direction", "Direction", P::Choice(DIR)),
("size", "Size", P::Slider(0.0, 250.0, "px")),
@@ -1857,6 +1859,26 @@ mod tests {
assert_eq!(d.doc.layer(id).unwrap().effects.items.len(), 2);
}
+ #[test]
+ fn bevel_technique_is_selectable_and_round_trips() {
+ let Some((_, _, P::Choice(options))) = spec("bevelEmboss").iter().find(|(k, _, _)| *k == "technique") else {
+ panic!("Bevel & Emboss has no Technique dropdown");
+ };
+ let values: Vec<&str> = options.iter().map(|(v, _)| *v).collect();
+ assert_eq!(values, ["smooth", "chiselHard", "chiselSoft"]);
+
+ let mut s = session();
+ s.execute("layer.layerStyle.bevelEmboss", json!({"technique": "chiselSoft"})).unwrap();
+ let st = s.active().unwrap();
+ let id = st.active_layer.unwrap();
+ let mut f = initial_fields(st.doc.layer(id).unwrap(), Some("bevelEmboss"), st.doc.global_light.angle);
+ assert_eq!(entry(&f, "fx1").unwrap()["params"]["technique"], json!("chiselSoft"));
+ set_param(&mut f, "fx1", "technique", json!("chiselHard"));
+ apply(&f, |cmd, p| s.execute(cmd, p).map_err(|e| e.to_string())).unwrap();
+ let Effect::BevelEmboss(b) = &s.active().unwrap().doc.layer(id).unwrap().effects.items[0] else { panic!("expected bevel") };
+ assert_eq!(b.technique, photocraft_doc::effects::BevelTechnique::ChiselHard);
+ }
+
#[test]
fn unchanged_global_light_angle_is_not_applied() {
let layer = Layer::raster("x", photocraft_doc::PixelFormat::RGBA8);