Skip to content

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

Fix: Preview pixelation in Sharpen filters (#3936)

Avraz S. Ibrahima6e1beb1be0e
diff --git a/crates/ui-egui/src/filter_dialog.rs b/crates/ui-egui/src/filter_dialog.rs
index 2c336672d..f118798aa 100644
--- a/crates/ui-egui/src/filter_dialog.rs
+++ b/crates/ui-egui/src/filter_dialog.rs
@@ -196,6 +196,10 @@ fn is_pixel_param_of(command: &str, key: &str) -> bool {
/// interval) and Tree, whose branches are built from 6 px segments. On a reduced proxy those
/// features come out k times too large (or a different tree grows), so these preview at full
/// resolution: what the preview shows is what OK applies, as in Photoshop (#2063).
+///
+/// Sharpen, Sharpen More, Sharpen Edges, Find Edges, Emboss and Despeckle use fixed one-pixel
+/// kernels with no size parameter, so a proxy changes their look: edges average away, making
+/// the sharpening and edge detection invisible. These must preview at full resolution (#3929).
const FULL_RESOLUTION_PREVIEW: &[&str] = &[
"filter.distort.ripple",
"filter.stylize.diffuse",
@@ -212,6 +216,12 @@ const FULL_RESOLUTION_PREVIEW: &[&str] = &[
"filter.stylize.wind",
"filter.stylize.extrude",
"filter.render.tree",
+ "filter.sharpen.sharpen",
+ "filter.sharpen.sharpenMore",
+ "filter.sharpen.sharpenEdges",
+ "filter.stylize.findEdges",
+ "filter.stylize.emboss",
+ "filter.noise.despeckle",
];
/// Whether `command` with `params` previews at full resolution: [`FULL_RESOLUTION_PREVIEW`], every
@@ -1565,6 +1575,12 @@ mod tests {
("filter.stylize.wind", json!({"method": "blast"})),
("filter.stylize.extrude", json!({})),
("filter.render.tree", json!({"baseTreeType": 1})),
+ ("filter.sharpen.sharpen", json!({})),
+ ("filter.sharpen.sharpenMore", json!({})),
+ ("filter.sharpen.sharpenEdges", json!({})),
+ ("filter.stylize.findEdges", json!({})),
+ ("filter.stylize.emboss", json!({})),
+ ("filter.noise.despeckle", json!({})),
("filter.gallery.graphicPen", json!({})),
("filter.gallery.stainedGlass", json!({"cellSize": 10})),
("image.mode.indexedColor", json!({"colors": 16})),