From 8958e491682efa3ce26d3fed4f1ff84106193f69 Mon Sep 17 00:00:00 2001 From: Bauke Date: Thu, 29 Feb 2024 13:42:37 +0100 Subject: [PATCH] Add the Edge operation and associated enums. --- gegl/source/operations/enums.rs | 21 +++++++++++++++++++++ gegl/source/operations/mod.rs | 14 ++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/gegl/source/operations/enums.rs b/gegl/source/operations/enums.rs index 96440ad..338cc1b 100644 --- a/gegl/source/operations/enums.rs +++ b/gegl/source/operations/enums.rs @@ -2,6 +2,27 @@ use crate::gegl_enum; +gegl_enum!( + /// The abyss policy for various GEGL operations. + AbyssPolicy, + Black => "black", + Clamp => "clamp", + Loop => "loop", + None => "none", + White => "white", +); + +gegl_enum!( + /// The detection algorithm for [`Edge`][super::Edge]. + EdgeAlgorithm, + Differential => "differential", + Gradient => "gradient", + Laplace => "laplace", + PrewittCompass => "prewitt", + Roberts => "roberts", + Sobel => "sobel", +); + gegl_enum!( /// The shape for [`FocusBlur`][super::FocusBlur]. FocusBlurShape, diff --git a/gegl/source/operations/mod.rs b/gegl/source/operations/mod.rs index cac5723..9fdeda7 100644 --- a/gegl/source/operations/mod.rs +++ b/gegl/source/operations/mod.rs @@ -111,6 +111,20 @@ gegl_operation!( ), ); +gegl_operation!( + struct_name: Edge, + gegl_name: "edge", + append_crop: false, + values: ( + /// The edge detection algorithm to use. + algorithm: EdgeAlgorithm, EdgeAlgorithm::Sobel, + /// The amount of edge detection to perform. + amount: f64, 2.0, + /// The edge detection border behavior. + border_behavior: AbyssPolicy, AbyssPolicy::Clamp, + ), +); + gegl_operation!( struct_name: EdgeNeon, gegl_name: "edge-neon",