diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 4ff97724122..1bd19ea9033 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -35,7 +35,7 @@ next to them. | `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) | | 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 | | SIL OFL 1.1, [`assets/fonts/OFL-JetBrainsMono.txt`](assets/fonts/OFL-JetBrainsMono.txt) | -| `assets/icons/*.svg` except `slice-knife.svg`, `slice-select.svg`, `font-similar.svg`, `font-variable.svg`, `sampler.svg`, `artboard.svg`, `perspective-crop.svg`, `frame-placeholder.svg`, `ellipse-dashed.svg`, `gradient.svg`, `type-mask.svg`, `type-mask-vertical.svg`, `text-warp.svg`, `clip-below.svg`, `clip-release.svg`, `layer-mask.svg`, `adjustment-layer.svg`, `brush-replace.svg`, `history-brush.svg`, `quick-selection.svg`, `eraser-background.svg`, `eraser-magic.svg`, `lasso-magnetic.svg`, `direct-select.svg`, `convert-point.svg`, `pen-add-anchor.svg`, `pen-delete-anchor.svg`, `pen-freeform.svg`, `pen-curvature.svg`, `bandage-sparkle.svg`, `painting-symmetry.svg`, `symmetry-*.svg`, `path-op-*.svg` and `marquee-{row,column}.svg`, `align-edge-*.svg` and `distribute-*.svg`, `crop-overlay-*.svg` (113 files; `star-filled.svg` is `star.svg` with a solid fill) | Lucide icons | Lucide Icons and Contributors | (`icons/.svg`; `align-*` are now named `text-align-*` upstream) | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | +| `assets/icons/*.svg` except `slice-knife.svg`, `slice-select.svg`, `font-similar.svg`, `font-variable.svg`, `sampler.svg`, `artboard.svg`, `perspective-crop.svg`, `frame-placeholder.svg`, `ellipse-dashed.svg`, `gradient.svg`, `type-mask.svg`, `type-mask-vertical.svg`, `text-warp.svg`, `clip-below.svg`, `clip-release.svg`, `layer-mask.svg`, `adjustment-layer.svg`, `brush-replace.svg`, `history-brush.svg`, `quick-selection.svg`, `eraser-background.svg`, `eraser-magic.svg`, `lasso-magnetic.svg`, `direct-select.svg`, `convert-point.svg`, `pen-add-anchor.svg`, `pen-delete-anchor.svg`, `pen-freeform.svg`, `pen-curvature.svg`, `bandage-sparkle.svg`, `painting-symmetry.svg`, `symmetry-*.svg`, `path-op-*.svg` and `marquee-{row,column}.svg`, `brightness-contrast.svg`, `levels.svg`, `curves.svg`, `exposure.svg`, `vibrance.svg`, `hue-saturation.svg`, `black-white.svg`, `photo-filter.svg`, `channel-mixer.svg`, `color-lookup.svg`, `invert.svg`, `posterize.svg`, `threshold.svg`, `selective-color.svg`, `gradient-map.svg`, `scale.svg`, `align-edge-*.svg` and `distribute-*.svg`, `crop-overlay-*.svg` (113 files; `star-filled.svg` is `star.svg` with a solid fill) | Lucide icons | Lucide Icons and Contributors | (`icons/.svg`; `align-*` are now named `text-align-*` upstream) | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | | `assets/icons/{check,chevron-down,chevron-left,chevron-right,chevron-up,chevrons-left,chevrons-right,circle,clock,compass,info,link,link-2,lock,minus,monitor,moon,move,navigation,plus,search,square,trash,triangle,type,x,zoom-in}.svg` | Lucide icons derived from Feather (subset of the row above) | Cole Bemis (Feather), Lucide Contributors | via Lucide | MIT (Feather) and ISC (Lucide), [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | | `assets/icons/slice-knife.svg` | Slice tool glyph | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | | `assets/icons/slice-select.svg` | Slice Select tool glyph | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | @@ -55,6 +55,8 @@ next to them. | `assets/icons/ellipse-dashed.svg` | Elliptical Marquee tool glyph: a dashed horizontal ellipse, drawn on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | | `assets/icons/frame-placeholder.svg` | Frame tool glyph: an empty placeholder frame, crossed corner to corner | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | | `assets/icons/gradient.svg` | Gradient tool glyph: a rounded rectangle filled with a left-to-right linear ramp, drawn on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | +| `assets/icons/{brightness-contrast,levels,curves,exposure,vibrance,hue-saturation,black-white,photo-filter,channel-mixer,color-lookup,invert,posterize,threshold,selective-color,gradient-map}.svg` | Adjustment layer thumbnail glyphs for the Layers panel (Brightness/Contrast, Levels, Curves, Exposure, Vibrance, Hue/Saturation, Black & White, Photo Filter, Channel Mixer, Color Lookup, Invert, Posterize, Threshold, Selective Color, Gradient Map), drawn on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | +| `assets/icons/scale.svg` | Color Balance adjustment layer glyph: Lucide balance scale icon | Lucide Icons and Contributors | `icons/scale.svg` | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | | `assets/icons/eraser-background.svg`, `assets/icons/eraser-magic.svg` | Background Eraser and Magic Eraser tool glyphs: Lucide `eraser` plus added marks | Lucide Icons and Contributors; marks by PhotoCraft contributors | Derived from `icons/eraser.svg` | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | | `assets/icons/brush-replace.svg` | Color Replacement tool glyph: Lucide `brush` plus two swap arrows | Lucide Icons and Contributors; arrows by PhotoCraft contributors | Derived from `icons/brush.svg` | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | | `assets/icons/history-brush.svg` | History Brush tool glyph: Lucide `brush` plus counter-clockwise history rewind arrow | Lucide Icons and Contributors; arrow by PhotoCraft contributors | Derived from `icons/brush.svg` | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | diff --git a/assets/icons/black-white.svg b/assets/icons/black-white.svg new file mode 100644 index 00000000000..5cf94f89726 --- /dev/null +++ b/assets/icons/black-white.svg @@ -0,0 +1,15 @@ + + + + + diff --git a/assets/icons/brightness-contrast.svg b/assets/icons/brightness-contrast.svg new file mode 100644 index 00000000000..50daad2f56e --- /dev/null +++ b/assets/icons/brightness-contrast.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/assets/icons/channel-mixer.svg b/assets/icons/channel-mixer.svg new file mode 100644 index 00000000000..5b175ebd0ad --- /dev/null +++ b/assets/icons/channel-mixer.svg @@ -0,0 +1,11 @@ + + + + + diff --git a/assets/icons/color-lookup.svg b/assets/icons/color-lookup.svg new file mode 100644 index 00000000000..aad76adf2a6 --- /dev/null +++ b/assets/icons/color-lookup.svg @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/assets/icons/curves.svg b/assets/icons/curves.svg new file mode 100644 index 00000000000..a88a6145748 --- /dev/null +++ b/assets/icons/curves.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/assets/icons/exposure.svg b/assets/icons/exposure.svg new file mode 100644 index 00000000000..4b696b305a8 --- /dev/null +++ b/assets/icons/exposure.svg @@ -0,0 +1,13 @@ + + + + diff --git a/assets/icons/gradient-map.svg b/assets/icons/gradient-map.svg new file mode 100644 index 00000000000..9d4e8640293 --- /dev/null +++ b/assets/icons/gradient-map.svg @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/assets/icons/hue-saturation.svg b/assets/icons/hue-saturation.svg new file mode 100644 index 00000000000..351a0808512 --- /dev/null +++ b/assets/icons/hue-saturation.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + diff --git a/assets/icons/invert.svg b/assets/icons/invert.svg new file mode 100644 index 00000000000..d884e143bf8 --- /dev/null +++ b/assets/icons/invert.svg @@ -0,0 +1,12 @@ + + + diff --git a/assets/icons/levels.svg b/assets/icons/levels.svg new file mode 100644 index 00000000000..decde3957c0 --- /dev/null +++ b/assets/icons/levels.svg @@ -0,0 +1,16 @@ + + + diff --git a/assets/icons/photo-filter.svg b/assets/icons/photo-filter.svg new file mode 100644 index 00000000000..0bd3341517d --- /dev/null +++ b/assets/icons/photo-filter.svg @@ -0,0 +1,12 @@ + + + diff --git a/assets/icons/posterize.svg b/assets/icons/posterize.svg new file mode 100644 index 00000000000..a87d10296fb --- /dev/null +++ b/assets/icons/posterize.svg @@ -0,0 +1,16 @@ + + + + + + diff --git a/assets/icons/scale.svg b/assets/icons/scale.svg new file mode 100644 index 00000000000..ae70a270dda --- /dev/null +++ b/assets/icons/scale.svg @@ -0,0 +1,17 @@ + + + + + + + diff --git a/assets/icons/selective-color.svg b/assets/icons/selective-color.svg new file mode 100644 index 00000000000..5eebdec16e8 --- /dev/null +++ b/assets/icons/selective-color.svg @@ -0,0 +1,17 @@ + + + + + + + diff --git a/assets/icons/threshold.svg b/assets/icons/threshold.svg new file mode 100644 index 00000000000..2d220ab1ef2 --- /dev/null +++ b/assets/icons/threshold.svg @@ -0,0 +1,19 @@ + + + + + diff --git a/assets/icons/vibrance.svg b/assets/icons/vibrance.svg new file mode 100644 index 00000000000..71ed692d90d --- /dev/null +++ b/assets/icons/vibrance.svg @@ -0,0 +1,14 @@ + + + + diff --git a/contributors/people.toml b/contributors/people.toml index 59b4b9b7f0b..fc72d58f310 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -311,4 +311,6 @@ sync_github_name = false [people.davidvhk] real_name = "David Vanhoucke" + +[people.kobaltgit] sync_github_name = true diff --git a/crates/ui-egui/src/adjustment_icon_tests.rs b/crates/ui-egui/src/adjustment_icon_tests.rs new file mode 100644 index 00000000000..e0315120c13 --- /dev/null +++ b/crates/ui-egui/src/adjustment_icon_tests.rs @@ -0,0 +1,32 @@ +use crate::icons; +use crate::panels::adjustment_icon; +use photocraft_doc::Adjustment; + +/// Verifies that every `Adjustment` variant maps to an existing registered icon in `icon_data`. +#[test] +fn every_adjustment_kind_has_a_registered_icon() { + let adjustments = [ + Adjustment::BrightnessContrast { brightness: 0.0, contrast: 0.0, legacy: false }, + Adjustment::Levels { master: Default::default(), per_channel: Default::default(), space: Default::default(), black: Default::default() }, + Adjustment::Curves { master: Vec::new(), per_channel: Default::default(), space: Default::default(), black: Vec::new(), pencil: false }, + Adjustment::Exposure { exposure: 0.0, offset: 0.0, gamma: 1.0 }, + Adjustment::Vibrance { vibrance: 0.0, saturation: 0.0 }, + Adjustment::default_hue_saturation(), + Adjustment::ColorBalance { shadows: [0.0; 3], midtones: [0.0; 3], highlights: [0.0; 3], preserve_luminosity: true }, + Adjustment::BlackWhite { weights: [0.0; 6], tint: None }, + Adjustment::PhotoFilter { color: [0.0; 3], density: 0.25, preserve_luminosity: true }, + Adjustment::ChannelMixer { matrix: [[0.0; 4]; 3], monochrome: false }, + Adjustment::ColorLookup { name: "test".into(), lut: None, size: 0, tetrahedral: false, dither: false }, + Adjustment::Invert, + Adjustment::Posterize { levels: 4 }, + Adjustment::Threshold { level: 128.0 }, + Adjustment::GradientMap { stops: Vec::new(), reverse: false, dither: false }, + Adjustment::SelectiveColor { relative: false, adjustments: [[0.0; 4]; 9] }, + Adjustment::Unsupported { psd_key: "test".into(), raw: std::sync::Arc::new([]) }, + ]; + + for adj in &adjustments { + let icon_name = adjustment_icon(adj); + assert!(icons::exists(icon_name), "Icon '{icon_name}' for adjustment '{}' must be registered in icons map", adj.label()); + } +} diff --git a/crates/ui-egui/src/icon_data.rs b/crates/ui-egui/src/icon_data.rs index d66b8b8fbea..e2fb42988cb 100644 --- a/crates/ui-egui/src/icon_data.rs +++ b/crates/ui-egui/src/icon_data.rs @@ -26,10 +26,13 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("ban", include_bytes!("../../../assets/icons/ban.svg")), ("bandage", include_bytes!("../../../assets/icons/bandage.svg")), ("bandage-sparkle", include_bytes!("../../../assets/icons/bandage-sparkle.svg")), + ("black-white", include_bytes!("../../../assets/icons/black-white.svg")), ("blend", include_bytes!("../../../assets/icons/blend.svg")), + ("brightness-contrast", include_bytes!("../../../assets/icons/brightness-contrast.svg")), ("brush", include_bytes!("../../../assets/icons/brush.svg")), ("brush-replace", include_bytes!("../../../assets/icons/brush-replace.svg")), ("brush-cleaning", include_bytes!("../../../assets/icons/brush-cleaning.svg")), + ("channel-mixer", include_bytes!("../../../assets/icons/channel-mixer.svg")), ("check", include_bytes!("../../../assets/icons/check.svg")), ("chevron-down", include_bytes!("../../../assets/icons/chevron-down.svg")), ("chevron-left", include_bytes!("../../../assets/icons/chevron-left.svg")), @@ -44,6 +47,7 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("clip-release", include_bytes!("../../../assets/icons/clip-release.svg")), ("clock", include_bytes!("../../../assets/icons/clock.svg")), ("cloud", include_bytes!("../../../assets/icons/cloud.svg")), + ("color-lookup", include_bytes!("../../../assets/icons/color-lookup.svg")), ("compass", include_bytes!("../../../assets/icons/compass.svg")), ("contrast", include_bytes!("../../../assets/icons/contrast.svg")), // PhotoCraft original: the Convert Point tool glyph. @@ -57,6 +61,7 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("crop-overlay-grid", include_bytes!("../../../assets/icons/crop-overlay-grid.svg")), ("crop-overlay-thirds", include_bytes!("../../../assets/icons/crop-overlay-thirds.svg")), ("crop-overlay-triangle", include_bytes!("../../../assets/icons/crop-overlay-triangle.svg")), + ("curves", include_bytes!("../../../assets/icons/curves.svg")), ("diamond", include_bytes!("../../../assets/icons/diamond.svg")), ("direct-select", include_bytes!("../../../assets/icons/direct-select.svg")), ("droplet", include_bytes!("../../../assets/icons/droplet.svg")), @@ -67,6 +72,7 @@ pub static ICONS: &[(&str, &[u8])] = &[ // Derived from Lucide's eraser (ISC): with a sparkle (Magic Eraser) / a transparency grid (Background Eraser). ("eraser-background", include_bytes!("../../../assets/icons/eraser-background.svg")), ("eraser-magic", include_bytes!("../../../assets/icons/eraser-magic.svg")), + ("exposure", include_bytes!("../../../assets/icons/exposure.svg")), ("eye", include_bytes!("../../../assets/icons/eye.svg")), ("eye-off", include_bytes!("../../../assets/icons/eye-off.svg")), ("file", include_bytes!("../../../assets/icons/file.svg")), @@ -79,18 +85,22 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("gauge", include_bytes!("../../../assets/icons/gauge.svg")), // PhotoCraft original: the Gradient tool glyph (a rectangle filled with a linear ramp). ("gradient", include_bytes!("../../../assets/icons/gradient.svg")), + ("gradient-map", include_bytes!("../../../assets/icons/gradient-map.svg")), ("grid-2x2", include_bytes!("../../../assets/icons/grid-2x2.svg")), ("grid-3x3", include_bytes!("../../../assets/icons/grid-3x3.svg")), ("hand", include_bytes!("../../../assets/icons/hand.svg")), ("history-brush", include_bytes!("../../../assets/icons/history-brush.svg")), ("house", include_bytes!("../../../assets/icons/house.svg")), + ("hue-saturation", include_bytes!("../../../assets/icons/hue-saturation.svg")), ("image", include_bytes!("../../../assets/icons/image.svg")), ("info", include_bytes!("../../../assets/icons/info.svg")), + ("invert", include_bytes!("../../../assets/icons/invert.svg")), ("lasso", include_bytes!("../../../assets/icons/lasso.svg")), ("lasso-magnetic", include_bytes!("../../../assets/icons/lasso-magnetic.svg")), ("lasso-select", include_bytes!("../../../assets/icons/lasso-select.svg")), ("layer-mask", include_bytes!("../../../assets/icons/layer-mask.svg")), ("layers", include_bytes!("../../../assets/icons/layers.svg")), + ("levels", include_bytes!("../../../assets/icons/levels.svg")), ("link", include_bytes!("../../../assets/icons/link.svg")), ("link-2", include_bytes!("../../../assets/icons/link-2.svg")), ("lock", include_bytes!("../../../assets/icons/lock.svg")), @@ -126,11 +136,13 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("pencil", include_bytes!("../../../assets/icons/pencil.svg")), ("pentagon", include_bytes!("../../../assets/icons/pentagon.svg")), ("perspective-crop", include_bytes!("../../../assets/icons/perspective-crop.svg")), + ("photo-filter", include_bytes!("../../../assets/icons/photo-filter.svg")), ("pipette", include_bytes!("../../../assets/icons/pipette.svg")), ("play", include_bytes!("../../../assets/icons/play.svg")), ("pause", include_bytes!("../../../assets/icons/pause.svg")), ("plus", include_bytes!("../../../assets/icons/plus.svg")), ("pointer", include_bytes!("../../../assets/icons/pointer.svg")), + ("posterize", include_bytes!("../../../assets/icons/posterize.svg")), ("quick-selection", include_bytes!("../../../assets/icons/quick-selection.svg")), ("rectangle-horizontal", include_bytes!("../../../assets/icons/rectangle-horizontal.svg")), ("rectangle-vertical", include_bytes!("../../../assets/icons/rectangle-vertical.svg")), @@ -138,11 +150,13 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("rotate-cw", include_bytes!("../../../assets/icons/rotate-cw.svg")), ("ruler", include_bytes!("../../../assets/icons/ruler.svg")), ("sampler", include_bytes!("../../../assets/icons/sampler.svg")), + ("scale", include_bytes!("../../../assets/icons/scale.svg")), ("scaling", include_bytes!("../../../assets/icons/scaling.svg")), ("scan", include_bytes!("../../../assets/icons/scan.svg")), ("scan-line", include_bytes!("../../../assets/icons/scan-line.svg")), ("scissors", include_bytes!("../../../assets/icons/scissors.svg")), ("search", include_bytes!("../../../assets/icons/search.svg")), + ("selective-color", include_bytes!("../../../assets/icons/selective-color.svg")), ("settings", include_bytes!("../../../assets/icons/settings.svg")), ("slash", include_bytes!("../../../assets/icons/slash.svg")), ("slice-knife", include_bytes!("../../../assets/icons/slice-knife.svg")), @@ -169,6 +183,7 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("swatch-book", include_bytes!("../../../assets/icons/swatch-book.svg")), ("text-cursor", include_bytes!("../../../assets/icons/text-cursor.svg")), ("text-warp", include_bytes!("../../../assets/icons/text-warp.svg")), + ("threshold", include_bytes!("../../../assets/icons/threshold.svg")), ("toggle-left", include_bytes!("../../../assets/icons/toggle-left.svg")), ("toggle-right", include_bytes!("../../../assets/icons/toggle-right.svg")), ("trash", include_bytes!("../../../assets/icons/trash.svg")), @@ -180,6 +195,7 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("type-mask-vertical", include_bytes!("../../../assets/icons/type-mask-vertical.svg")), ("undo-2", include_bytes!("../../../assets/icons/undo-2.svg")), ("unlink", include_bytes!("../../../assets/icons/unlink.svg")), + ("vibrance", include_bytes!("../../../assets/icons/vibrance.svg")), ("wand", include_bytes!("../../../assets/icons/wand.svg")), ("wand-sparkles", include_bytes!("../../../assets/icons/wand-sparkles.svg")), ("x", include_bytes!("../../../assets/icons/x.svg")), diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 54edda6264b..2eff6c2bba2 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -930,3 +930,6 @@ mod saved_path_edit_tests; #[cfg(test)] mod pen_path_ownership_tests; + +#[cfg(test)] +mod adjustment_icon_tests; diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index ab5475ff9bf..04483667e90 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -85,7 +85,7 @@ pub(crate) use info::{SamplerReadouts, sampler_readouts}; use layer_drag::{background_drop_refused, layer_drop_payload}; pub(crate) use layer_drag::{dropped_on, layer_drag_edge_scroll}; #[cfg(test)] -pub(crate) use layer_row::thumb_load_badge; +pub(crate) use layer_row::{adjustment_icon, thumb_load_badge}; #[cfg(test)] use layer_row::{layer_thumb_fit, paint_clipping_indicator}; pub(crate) use layers::{blend_options, fx_button}; diff --git a/crates/ui-egui/src/panels/layer_row.rs b/crates/ui-egui/src/panels/layer_row.rs index d622a0e9db1..0efb4561f95 100644 --- a/crates/ui-egui/src/panels/layer_row.rs +++ b/crates/ui-egui/src/panels/layer_row.rs @@ -602,6 +602,30 @@ pub(super) fn layer_thumb_fit(cell: Rect, w: u32, h: u32) -> (Rect, Rect) { crate::channels_panel::fit_thumb(cell, w, h) } +/// The registered icon name matching Photoshop's adjustment layer glyph for `adj`. +pub(crate) fn adjustment_icon(adj: &photocraft_doc::Adjustment) -> &'static str { + use photocraft_doc::Adjustment; + match adj { + Adjustment::BrightnessContrast { .. } => "brightness-contrast", + Adjustment::Levels { .. } => "levels", + Adjustment::Curves { .. } => "curves", + Adjustment::Exposure { .. } => "exposure", + Adjustment::Vibrance { .. } => "vibrance", + Adjustment::HueSaturation { .. } => "hue-saturation", + Adjustment::ColorBalance { .. } => "scale", + Adjustment::BlackWhite { .. } => "black-white", + Adjustment::PhotoFilter { .. } => "photo-filter", + Adjustment::ChannelMixer { .. } => "channel-mixer", + Adjustment::ColorLookup { .. } => "color-lookup", + Adjustment::Invert => "invert", + Adjustment::Posterize { .. } => "posterize", + Adjustment::Threshold { .. } => "threshold", + Adjustment::GradientMap { .. } => "gradient-map", + Adjustment::SelectiveColor { .. } => "selective-color", + Adjustment::Unsupported { .. } => "adjustment-layer", + } +} + fn draw_layer_thumb(app: &mut PhotocraftApp, ctx: &egui::Context, ui: &egui::Ui, doc: &photocraft_doc::Document, l: &Layer, rect: Rect, selected: bool) { let t = Tokens::get(ctx); let p = ui.painter(); @@ -620,7 +644,11 @@ fn draw_layer_thumb(app: &mut PhotocraftApp, ctx: &egui::Context, ui: &egui::Ui, return; } match &l.content { - LayerContent::Adjustment(_) | LayerContent::Group(_) => { + LayerContent::Adjustment(adj) => { + p.rect_filled(rect, 6.0, t.field); + icons::paint(ui, rect, adjustment_icon(adj), 18.0, t.icon); + } + LayerContent::Group(_) => { p.rect_filled(rect, 6.0, t.field); let icon = if l.is_group() { "folder" } else { "contrast" }; icons::paint(ui, rect, icon, 18.0, t.icon); diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 9f202141045..29c01e02859 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -217,22 +217,22 @@ pub(super) fn adjustments_grid(app: &mut PhotocraftApp, ui: &mut egui::Ui) { ui.label(RichText::new(tl!("Add an adjustment")).color(t.text_dim)); ui.add_space(4.0); let items: [(&str, &str, &str); 16] = [ - ("brightnessContrast", "sun", tl!("Brightness/Contrast")), - ("levels", "gauge", tl!("Levels")), - ("curves", "pen-tool", tl!("Curves")), - ("exposure", "scan", tl!("Exposure")), - ("vibrance", "sparkles", tl!("Vibrance")), - ("hueSaturation", "droplet", tl!("Hue/Saturation")), - ("colorBalance", "blend", tl!("Color Balance")), - ("blackWhite", "contrast", tl!("Black & White")), - ("photoFilter", "circle-dot", tl!("Photo Filter")), - ("channelMixer", "sliders-horizontal", tl!("Channel Mixer")), - ("invert", "squares-subtract", tl!("Invert")), - ("posterize", "layers", tl!("Posterize")), - ("threshold", "square", tl!("Threshold")), - ("gradientMap", "palette", tl!("Gradient Map")), - ("selectiveColor", "swatch-book", tl!("Selective Color")), - ("colorLookup", "grid-3x3", tl!("Color Lookup")), + ("brightnessContrast", "brightness-contrast", tl!("Brightness/Contrast")), + ("levels", "levels", tl!("Levels")), + ("curves", "curves", tl!("Curves")), + ("exposure", "exposure", tl!("Exposure")), + ("vibrance", "vibrance", tl!("Vibrance")), + ("hueSaturation", "hue-saturation", tl!("Hue/Saturation")), + ("colorBalance", "scale", tl!("Color Balance")), + ("blackWhite", "black-white", tl!("Black & White")), + ("photoFilter", "photo-filter", tl!("Photo Filter")), + ("channelMixer", "channel-mixer", tl!("Channel Mixer")), + ("invert", "invert", tl!("Invert")), + ("posterize", "posterize", tl!("Posterize")), + ("threshold", "threshold", tl!("Threshold")), + ("gradientMap", "gradient-map", tl!("Gradient Map")), + ("selectiveColor", "selective-color", tl!("Selective Color")), + ("colorLookup", "color-lookup", tl!("Color Lookup")), ]; let mut run = None; ui.horizontal_wrapped(|ui| {