From 745dfdc468a02dc2c68dce13e212566f646cf8f4 Mon Sep 17 00:00:00 2001 From: Bauke Date: Thu, 29 Feb 2024 13:58:33 +0100 Subject: [PATCH] Add the Spiral operation and associated enums. --- gegl/source/operations/enums.rs | 14 ++++++++++++++ gegl/source/operations/mod.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/gegl/source/operations/enums.rs b/gegl/source/operations/enums.rs index 338cc1b..1153f07 100644 --- a/gegl/source/operations/enums.rs +++ b/gegl/source/operations/enums.rs @@ -90,6 +90,20 @@ gegl_enum!( WhiteOnBlack => "white-on-black", ); +gegl_enum!( + /// The spiral swirl direction for [`Spiral`][super::Spiral] + SpiralDirection, + Clockwise => "cw", + CounterClockwise => "ccw", +); + +gegl_enum!( + /// The spiral type for [`Spiral`][super::Spiral] + SpiralType, + Linear => "linear", + Logarithmic => "logarithmic", +); + gegl_enum!( /// The sampler type for [`StereographicProjection`][super::StereographicProjection]. StereographicProjectionSamplerType, diff --git a/gegl/source/operations/mod.rs b/gegl/source/operations/mod.rs index 9fdeda7..f0ce12c 100644 --- a/gegl/source/operations/mod.rs +++ b/gegl/source/operations/mod.rs @@ -415,6 +415,38 @@ gegl_operation!( ), ); +gegl_operation!( + struct_name: Spiral, + gegl_name: "spiral", + append_crop: true, + values: ( + /// The area balance between the two colors. + balance: f64, 0.0, + /// The logarithmic spiral base. + base: f64, 2.0, + /// The primary color. + color1: String, "#000".to_string(), + /// The secondary color. + color2: String, "#fff".to_string(), + /// The spiral swirl direction. + direction: SpiralDirection, SpiralDirection::Clockwise, + /// The height of the generated buffer. + height: i64, 768, + /// The spiral radius. + radius: f64, 100.0, + /// The spiral rotation. + rotation: f64, 0.0, + /// The spiral type. + spiral_type: SpiralType, SpiralType::Linear, + /// The X origin coordinate. + x: f64, 0.5, + /// The Y origin coordinate. + y: f64, 0.5, + /// The width of the generated buffer. + width: i64, 1024, + ), +); + gegl_operation!( struct_name: StereographicProjection, gegl_name: "stereographic-projection",