diff --git a/gegl/source/operations/macros.rs b/gegl/source/operations/macros.rs index 4afb976..e7ee1b3 100644 --- a/gegl/source/operations/macros.rs +++ b/gegl/source/operations/macros.rs @@ -7,13 +7,18 @@ macro_rules! gegl_operation { struct_name: $struct_name:ident, gegl_name: $gegl_name:expr, append_crop: $append_crop:expr, - values: ($($key:ident: $key_type:ty, $key_default:expr, $key_doc:expr),*,), + values: ( + $( + $(#[$key_meta:meta])* + $key:ident: $key_type:ty, $key_default:expr + ),*, + ), ) => { #[doc = concat!(" The `gegl:", $gegl_name, "` operation.")] #[derive(Debug)] pub struct $struct_name { $( - #[doc = concat!(" ", $key_doc)] + $(#[$key_meta])* pub $key: $key_type, )* } diff --git a/gegl/source/operations/mod.rs b/gegl/source/operations/mod.rs index 1b118e5..b2be670 100644 --- a/gegl/source/operations/mod.rs +++ b/gegl/source/operations/mod.rs @@ -12,11 +12,16 @@ gegl_operation!( gegl_name: "bloom", append_crop: false, values: ( - limit_exposure: bool, false, "Don't over-expose highlights.", - radius: f64, 10.0, "Glow radius.", - softness: f64, 25.0, "Glow-area edge softness.", - strength: f64, 50.0, "Glow strength.", - threshold: f64, 50.0, "Glow-area brightness threshold.", + /// Don't over-expose highlights. + limit_exposure: bool, false, + /// Glow radius. + radius: f64, 10.0, + /// Glow-area edge softness. + softness: f64, 25.0, + /// Glow strength. + strength: f64, 50.0, + /// Glow-area brightness threshold. + threshold: f64, 50.0, ), ); @@ -25,8 +30,10 @@ gegl_operation!( gegl_name: "cartoon", append_crop: true, values: ( - mask_radius: f64, 7.0, "The mask radius.", - pct_black: f64, 0.2, "The percentage of black.", + /// The mask radius. + mask_radius: f64, 7.0, + /// The percentage of black. + pct_black: f64, 0.2, ), ); @@ -35,12 +42,18 @@ gegl_operation!( gegl_name: "cell-noise", append_crop: true, values: ( - iterations: i64, 1, "The number of noise octaves.", - palettize: bool, false, "Fill each cell with a random color.", - rank: i64, 1, "Select the n-th closest point", - scale: f64, 1.0, "The scale of the noise function.", - seed: f64, 0.0, "The random seed for the noise function.", - shape: f64, 2.0, "Interpolate between Manhattan and Euclidean distance.", + /// The number of noise octaves. + iterations: i64, 1, + /// Fill each cell with a random color. + palettize: bool, false, + /// Select the n-th closest point + rank: i64, 1, + /// The scale of the noise function. + scale: f64, 1.0, + /// The random seed for the noise function. + seed: f64, 0.0, + /// Interpolate between Manhattan and Euclidean distance. + shape: f64, 2.0, ), ); @@ -49,11 +62,16 @@ gegl_operation!( gegl_name: "crop", append_crop: false, values: ( - height: f64, 0.0, "The wanted height of the buffer.", - reset_origin: bool, false, "Reset the origin for the coordinates.", - width: f64, 0.0, "The wanted width of the buffer.", - x: f64, 0.0, "The X coordinate to start from.", - y: f64, 0.0, "The Y coordinate to start from.", + /// The wanted height of the buffer. + height: f64, 0.0, + /// Reset the origin for the coordinates. + reset_origin: bool, false, + /// The wanted width of the buffer. + width: f64, 0.0, + /// The X coordinate to start from. + x: f64, 0.0, + /// The Y coordinate to start from. + y: f64, 0.0, ), ); @@ -62,20 +80,34 @@ gegl_operation!( gegl_name: "diffraction-patterns", append_crop: true, values: ( - blue_contours: f64, 0.97, "Number of contours (blue);", - blue_frequency: f64, 1.12, "Light frequency (blue).", - blue_sedges: f64, 0.64, "Number of sharp edges (blue).", - brightness: f64, 0.07, "Brightness and shifting/fattening of contours.", - green_contours: f64, 0.82, "Number of contours (green);", - green_frequency: f64, 1.22, "Light frequency (green).", - green_sedges: f64, 0.68, "Number of sharp edges (green).", - height: i64, 200, "Height of the generated buffer.", - polarization: f64, -0.47, "Polarization.", - red_contours: f64, 0.82, "Number of contours (red);", - red_frequency: f64, 0.81, "Light frequency (red).", - red_sedges: f64, 0.61, "Number of sharp edges (red).", - scattering: f64, 37.13, "Scattering (speed vs. quality).", - width: i64, 200, "Width of the generated buffer.", + /// Number of contours (blue); + blue_contours: f64, 0.97, + /// Light frequency (blue). + blue_frequency: f64, 1.12, + /// Number of sharp edges (blue). + blue_sedges: f64, 0.64, + /// Brightness and shifting/fattening of contours. + brightness: f64, 0.07, + /// Number of contours (green); + green_contours: f64, 0.82, + /// Light frequency (green). + green_frequency: f64, 1.22, + /// Number of sharp edges (green). + green_sedges: f64, 0.68, + /// Height of the generated buffer. + height: i64, 200, + /// Polarization. + polarization: f64, -0.47, + /// Number of contours (red); + red_contours: f64, 0.82, + /// Light frequency (red). + red_frequency: f64, 0.81, + /// Number of sharp edges (red). + red_sedges: f64, 0.61, + /// Scattering (speed vs. quality). + scattering: f64, 37.13, + /// Width of the generated buffer. + width: i64, 200, ), ); @@ -84,20 +116,34 @@ gegl_operation!( gegl_name: "focus-blur", append_crop: false, values: ( - aspect_ratio: f64, 0.0, "The aspect ratio of the focus region.", - blur_radius: f64, 25.0, "Out-of-focus blur radius.", - blur_type: FocusBlurType, FocusBlurType::Gaussian, "The blur type.", - focus: f64, 0.25, "The focus region's inner limit.", - highlight_factor: f64, 0.0, "Relative highlight strength.", - highlight_threshold_high: f64, 1.0, "Highlight threshold (high).", - highlight_threshold_low: f64, 0.0, "Highlight threshold (low).", - high_quality: bool, false, "Generate more accurate and consistent output.", - midpoint: f64, 0.5, "The focus region's transition midpoint.", - radius: f64, 0.75, "The focus region's outer radius.", - rotation: f64, 0.0, "The rotation of the focus region.", - shape: FocusBlurShape, FocusBlurShape::Circle, "The blur shape.", - x: f64, 0.5, "The X coordinate for the center of the blur.", - y: f64, 0.5, "The Y coordinate for the center of the blur.", + /// The aspect ratio of the focus region. + aspect_ratio: f64, 0.0, + /// Out-of-focus blur radius. + blur_radius: f64, 25.0, + /// The blur type. + blur_type: FocusBlurType, FocusBlurType::Gaussian, + /// The focus region's inner limit. + focus: f64, 0.25, + /// Relative highlight strength. + highlight_factor: f64, 0.0, + /// Highlight threshold (high). + highlight_threshold_high: f64, 1.0, + /// Highlight threshold (low). + highlight_threshold_low: f64, 0.0, + /// Generate more accurate and consistent output. + high_quality: bool, false, + /// The focus region's transition midpoint. + midpoint: f64, 0.5, + /// The focus region's outer radius. + radius: f64, 0.75, + /// The rotation of the focus region. + rotation: f64, 0.0, + /// The blur shape. + shape: FocusBlurShape, FocusBlurShape::Circle, + /// The X coordinate for the center of the blur. + x: f64, 0.5, + /// The Y coordinate for the center of the blur. + y: f64, 0.5, ), ); @@ -106,13 +152,20 @@ gegl_operation!( gegl_name: "maze", append_crop: false, values: ( - algorithm_type: MazeAlgorithmType, MazeAlgorithmType::DepthFirst, "Maze algorithm type", - bg_color: String, "#fff".to_string(), "The background color.", - fg_color: String, "#000".to_string(), "The foreground color.", - seed: f64, 0.0, "The random seed.", - tileable: bool, false, "Whether the maze should be tileable.", - x: i64, 16, "Horizontal width of cells pixels.", - y: i64, 16, "Vertical width of cells pixels.", + /// Maze algorithm type + algorithm_type: MazeAlgorithmType, MazeAlgorithmType::DepthFirst, + /// The background color. + bg_color: String, "#fff".to_string(), + /// The foreground color. + fg_color: String, "#000".to_string(), + /// The random seed. + seed: f64, 0.0, + /// Whether the maze should be tileable. + tileable: bool, false, + /// Horizontal width of cells pixels. + x: i64, 16, + /// Vertical width of cells pixels. + y: i64, 16, ), ); @@ -121,12 +174,19 @@ gegl_operation!( gegl_name: "median-blur", append_crop: false, values: ( - abyss_policy: MedianBlurAbyssPolicy, MedianBlurAbyssPolicy::Clamp, "How image edges are handled.", - alpha_percentile: f64, 50.0, "Neighborhood alpha percentile.", - high_precision: bool, false, "Avoid clipping and quantization", - neighborhood: MedianBlurNeighborhood, MedianBlurNeighborhood::Circle, "Neighborhood type.", - percentile: f64, 50.0, "Neighborhood color percentile.", - radius: f64, 3.0, "Neighborhood radius, a negative value will calculate with inverted percentiles.", + /// How image edges are handled. + abyss_policy: MedianBlurAbyssPolicy, MedianBlurAbyssPolicy::Clamp, + /// Neighborhood alpha percentile. + alpha_percentile: f64, 50.0, + /// Avoid clipping and quantization + high_precision: bool, false, + /// Neighborhood type. + neighborhood: MedianBlurNeighborhood, MedianBlurNeighborhood::Circle, + /// Neighborhood color percentile. + percentile: f64, 50.0, + /// Neighborhood radius, a negative value will calculate with inverted + /// percentiles. + radius: f64, 3.0, ), ); @@ -135,19 +195,32 @@ gegl_operation!( gegl_name: "mirrors", append_crop: false, values: ( - clip: bool, true, "Clip result to input size.", - c_x: f64, 0.5, "X coordinate of symmetry center in output.", - c_y: f64, 0.5, "Y coordinate of symmetry center in output.", - input_scale: f64, 100.0, "Scale factor to make rendering size bigger.", - m_angle: f64, 0.0, "Rotation applied to the mirrors.", - n_segs: i64, 6, "Number of mirrors to use.", - output_scale: f64, 1.0, "Scale factor to make rendering size bigger.", - o_x: f64, 0.0, "X axis ratio for the center of mirroring", - o_y: f64, 0.0, "Y axis ratio for the center of mirroring", - r_angle: f64, 0.0, "Rotation applied to the result.", - trim_x: f64, 0.0, "X axis ratio for trimming mirror expanse", - trim_y: f64, 0.0, "Y axis ratio for trimming mirror expanse", - warp: bool, true, "Fill full output area.", + /// Clip result to input size. + clip: bool, true, + /// X coordinate of symmetry center in output. + c_x: f64, 0.5, + /// Y coordinate of symmetry center in output. + c_y: f64, 0.5, + /// Scale factor to make rendering size bigger. + input_scale: f64, 100.0, + /// Rotation applied to the mirrors. + m_angle: f64, 0.0, + /// Number of mirrors to use. + n_segs: i64, 6, + /// Scale factor to make rendering size bigger. + output_scale: f64, 1.0, + /// X axis ratio for the center of mirroring + o_x: f64, 0.0, + /// Y axis ratio for the center of mirroring + o_y: f64, 0.0, + /// Rotation applied to the result. + r_angle: f64, 0.0, + /// X axis ratio for trimming mirror expanse + trim_x: f64, 0.0, + /// Y axis ratio for trimming mirror expanse + trim_y: f64, 0.0, + /// Fill full output area. + warp: bool, true, ), ); @@ -156,20 +229,34 @@ gegl_operation!( gegl_name: "mosaic", append_crop: false, values: ( - antialiasing: bool, true, "Enables smoother tile output.", - color_averaging: bool, true, "Tile color based on average of subsumed pixels.", - color_variation: f64, 0.2, "Magnitude of random color variations.", - joints_color: String, "#000".to_string(), "Joints color.", - light_color: String, "#fff".to_string(), "Light color.", - light_dir: f64, 135.0, "Direction of light-source (in degrees).", - seed: f64, 0.0, "Random seed.", - tile_allow_split: bool, true, "Allows splitting tiles at hard edges.", - tile_height: f64, 4.0, "Apparent height of each tile (in pixels).", - tile_neatness: f64, 0.65, "Deviation from perfectly formed tiles.", - tile_size: f64, 15.0, "Average diameter of each tile (in pixels).", - tile_spacing: f64, 1.0, "Inter-tile spacing (in pixels).", - tile_surface: bool, false, "Surface characteristics.", - tile_type: MosaicTileType, MosaicTileType::Hexagons, "What shape to use for tiles.", + /// Enables smoother tile output. + antialiasing: bool, true, + /// Tile color based on average of subsumed pixels. + color_averaging: bool, true, + /// Magnitude of random color variations. + color_variation: f64, 0.2, + /// Joints color. + joints_color: String, "#000".to_string(), + /// Light color. + light_color: String, "#fff".to_string(), + /// Direction of light-source (in degrees). + light_dir: f64, 135.0, + /// Random seed. + seed: f64, 0.0, + /// Allows splitting tiles at hard edges. + tile_allow_split: bool, true, + /// Apparent height of each tile (in pixels). + tile_height: f64, 4.0, + /// Deviation from perfectly formed tiles. + tile_neatness: f64, 0.65, + /// Average diameter of each tile (in pixels). + tile_size: f64, 15.0, + /// Inter-tile spacing (in pixels). + tile_spacing: f64, 1.0, + /// Surface characteristics. + tile_surface: bool, false, + /// What shape to use for tiles. + tile_type: MosaicTileType, MosaicTileType::Hexagons, ), ); @@ -178,24 +265,49 @@ gegl_operation!( gegl_name: "newsprint", append_crop: false, values: ( - aa_samples: i64, 16, "Number of samples that are averaged for antialiasing the result.", - angle: f64, 75.0, "Black angle.", - angle2: f64, 15.0, "Red and cyan angle.", - angle3: f64, 45.0, "Green and magenta angle.", - angle4: f64, 0.0, "Blue and yellow angle.", - angleboost: f64, 0.0, "Multiplication factor for desired rotation of the local space for texture, the way this is computed makes it weak for desaturated colors and possibly stronger where there is color.", - black_pullout: f64, 1.0, "How much of common gray to pull out of CMY.", - blocksize: f64, -1.0, "Number of periods per tile, this tiling avoids high frequency anomaly that angle boost causes.", - color_model: NewsprintColorModel, NewsprintColorModel::BlackOnWhite, "How many inks to use.", - pattern: NewsprintPattern, NewsprintPattern::Line, "Black halftoning/dot pattern to use.", - pattern2: NewsprintPattern, NewsprintPattern::Line, "Red and cyan halftoning/dot pattern to use.", - pattern3: NewsprintPattern, NewsprintPattern::Line, "Green and magenta halftoning/dot pattern to use.", - pattern4: NewsprintPattern, NewsprintPattern::Line, "Blue and yellow halftoning/dot pattern to use.", - period: f64, 12.0, "Black number of pixels across one repetition of a base pattern at base resolution.", - period2: f64, 12.0, "Red and cyan number of pixels across one repetition of a base pattern at base resolution.", - period3: f64, 12.0, "Green and magenta number of pixels across one repetition of a base pattern at base resolution.", - period4: f64, 12.0, "Blue and yellow number of pixels across one repetition of a base pattern at base resolution.", - turbulence: f64, 0.0, "Color saturation dependent compression of period.", + /// Number of samples that are averaged for antialiasing the result. + aa_samples: i64, 16, + /// Black angle. + angle: f64, 75.0, + /// Red and cyan angle. + angle2: f64, 15.0, + /// Green and magenta angle. + angle3: f64, 45.0, + /// Blue and yellow angle. + angle4: f64, 0.0, + /// Multiplication factor for desired rotation of the local space for + /// texture, the way this is computed makes it weak for desaturated colors + /// and possibly stronger where there is color. + angleboost: f64, 0.0, + /// How much of common gray to pull out of CMY. + black_pullout: f64, 1.0, + /// Number of periods per tile, this tiling avoids high frequency anomaly + /// that angle boost causes. + blocksize: f64, -1.0, + /// How many inks to use. + color_model: NewsprintColorModel, NewsprintColorModel::BlackOnWhite, + /// Black halftoning/dot pattern to use. + pattern: NewsprintPattern, NewsprintPattern::Line, + /// Red and cyan halftoning/dot pattern to use. + pattern2: NewsprintPattern, NewsprintPattern::Line, + /// Green and magenta halftoning/dot pattern to use. + pattern3: NewsprintPattern, NewsprintPattern::Line, + /// Blue and yellow halftoning/dot pattern to use. + pattern4: NewsprintPattern, NewsprintPattern::Line, + /// Black number of pixels across one repetition of a base pattern at base + /// resolution. + period: f64, 12.0, + /// Red and cyan number of pixels across one repetition of a base pattern at + /// base resolution. + period2: f64, 12.0, + /// Green and magenta number of pixels across one repetition of a base pattern + /// at base resolution. + period3: f64, 12.0, + /// Blue and yellow number of pixels across one repetition of a base pattern + /// at base resolution. + period4: f64, 12.0, + /// Color saturation dependent compression of period. + turbulence: f64, 0.0, ), ); @@ -204,9 +316,12 @@ gegl_operation!( gegl_name: "noise-pick", append_crop: true, values: ( - pct_random: f64, 50.0, "Randomization percentage.", - repeat: i64, 1, "Amount of repetitions to make.", - seed: f64, 0.0, "Random seed.", + /// Randomization percentage. + pct_random: f64, 50.0, + /// Amount of repetitions to make. + repeat: i64, 1, + /// Random seed. + seed: f64, 0.0, ), ); @@ -215,10 +330,14 @@ gegl_operation!( gegl_name: "oilify", append_crop: false, values: ( - exponent: i64, 8, "Exponent for processing, controls smoothness.", - intensities: i64, 128, "Histogram size.", - mask_radius: i64, 4, "Radius of circle around pixel.", - use_inten: bool, true, "Use pixel luminance values.", + /// Exponent for processing, controls smoothness. + exponent: i64, 8, + /// Histogram size. + intensities: i64, 128, + /// Radius of circle around pixel. + mask_radius: i64, 4, + /// Use pixel luminance values. + use_inten: bool, true, ), ); @@ -227,12 +346,18 @@ gegl_operation!( gegl_name: "plasma", append_crop: false, values: ( - height: i64, 768, "Height of the generated buffer", - seed: f64, 0.0, "Random seed.", - turbulence: f64, 1.0, "High values give more variation in details.", - width: i64, 1024, "Width of the generated buffer.", - x: i64, 0, "X coordinate start of the generated buffer.", - y: i64, 0, "Y coordinate start of the generated buffer.", + /// Height of the generated buffer. + height: i64, 768, + /// Random seed. + seed: f64, 0.0, + /// High values give more variation in details. + turbulence: f64, 1.0, + /// Width of the generated buffer. + width: i64, 1024, + /// X coordinate start of the generated buffer. + x: i64, 0, + /// Y coordinate start of the generated buffer. + y: i64, 0, ), ); @@ -241,9 +366,12 @@ gegl_operation!( gegl_name: "simplex-noise", append_crop: true, values: ( - iterations: i64, 1, "The number of noise octaves.", - scale: f64, 1.0, "The scale of the noise function.", - seed: f64, 1.0, "The random seed for the noise function.", + /// The number of noise octaves. + iterations: i64, 1, + /// The scale of the noise function. + scale: f64, 1.0, + /// The random seed for the noise function. + seed: f64, 1.0, ), ); @@ -252,9 +380,12 @@ gegl_operation!( gegl_name: "softglow", append_crop: false, values: ( - brightness: f64, 0.3, "Brightness intensity.", - glow_radius: f64, 10.0, "Glow radius.", - sharpness: f64, 0.85, "Sharpness of the highlights.", + /// Brightness intensity. + brightness: f64, 0.3, + /// Glow radius. + glow_radius: f64, 10.0, + /// Sharpness of the highlights. + sharpness: f64, 0.85, ), ); @@ -263,14 +394,22 @@ gegl_operation!( gegl_name: "stereographic-projection", append_crop: false, values: ( - height: i64, -1, "Output/rendering height in pixels, -1 for input height.", - inverse: bool, false, "Do the inverse mapping.", - pan: f64, 0.0, "Horizontal camera panning.", - sampler_type: StereographicProjectionSamplerType, StereographicProjectionSamplerType::Nearest, "Image resampling method to use.", - spin: f64, 0., "Spin angle around camera axis.", - tilt: f64, 90., "Vertical camera panning.", - width: i64, -1, "Output/rendering width in pixels, -1 for input width.", - zoom: f64, 100.0, "Zoom level.", + /// Output/rendering height in pixels, -1 for input height. + height: i64, -1, + /// Do the inverse mapping. + inverse: bool, false, + /// Horizontal camera panning. + pan: f64, 0.0, + /// Image resampling method to use. + sampler_type: StereographicProjectionSamplerType, StereographicProjectionSamplerType::Nearest, + /// Spin angle around camera axis. + spin: f64, 0., + /// Vertical camera panning. + tilt: f64, 90., + /// Output/rendering width in pixels, -1 for input width. + width: i64, -1, + /// Zoom level. + zoom: f64, 100.0, ), ); @@ -279,8 +418,10 @@ gegl_operation!( gegl_name: "tile-glass", append_crop: false, values: ( - tile_height: i64, 25, "Tile height.", - tile_width: i64, 25, "Tile width.", + /// Tile height. + tile_height: i64, 25, + /// Tile width. + tile_width: i64, 25, ), ); @@ -296,10 +437,15 @@ gegl_operation!( gegl_name: "waterpixels", append_crop: false, values: ( - fill: WaterpixelsFill, WaterpixelsFill::Average, "How to fill superpixels.", - regularization: i64, 0, "Spatial regularization, trade-off between superpixel regularity and adherence to object boundaries.", - size: i64, 32, "Superpixels size.", - smoothness: f64, 1.0, "Gradient smoothness.", + /// How to fill superpixels. + fill: WaterpixelsFill, WaterpixelsFill::Average, + /// Spatial regularization, trade-off between superpixel regularity and + /// adherence to object boundaries. + regularization: i64, 0, + /// Superpixels size. + size: i64, 32, + /// Gradient smoothness. + smoothness: f64, 1.0, ), ); @@ -308,13 +454,21 @@ gegl_operation!( gegl_name: "waves", append_crop: true, values: ( - amplitude: f64, 25.0, "Amplitude of the wave ripples.", - aspect: f64, 1.0, "Aspect ratio.", - clamp: bool, false, "Limit deformation in the image area.", - period: f64, 100.0, "Period/wavelength of the ripples.", - phi: f64, 0.0, "Phase shift of the waves.", - sampler_type: WavesSamplerType, WavesSamplerType::Cubic, "Mathematical method for reconstructing pixel values.", - x: f64, 0.5, "Center X coordinate to start the waves from.", - y: f64, 0.5, "Center Y coordinate to start the waves from.", + /// Amplitude of the wave ripples. + amplitude: f64, 25.0, + /// Aspect ratio. + aspect: f64, 1.0, + /// Limit deformation in the image area. + clamp: bool, false, + /// Period/wavelength of the ripples. + period: f64, 100.0, + /// Phase shift of the waves. + phi: f64, 0.0, + /// Mathematical method for reconstructing pixel values. + sampler_type: WavesSamplerType, WavesSamplerType::Cubic, + /// Center X coordinate to start the waves from. + x: f64, 0.5, + /// Center Y coordinate to start the waves from. + y: f64, 0.5, ), );