Implement the Gaussian Blur node (#933)

This commit is contained in:
Dennis Kobert
2022-12-31 21:12:02 +01:00
committed by Keavon Chambers
parent 74bfd630a9
commit a9601ab164
11 changed files with 578 additions and 51 deletions

View File

@@ -136,6 +136,26 @@ static DOCUMENT_NODE_TYPES: &[DocumentNodeType] = &[
outputs: &[FrontendGraphDataType::Raster],
properties: node_properties::quantize_properties,
},
DocumentNodeType {
name: "Gaussian Blur",
category: "Image Filters",
identifier: NodeIdentifier::new("graphene_core::raster::BlurNode", &[]),
inputs: &[
DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true),
DocumentInputType::new("Radius", TaggedValue::U32(3), false),
DocumentInputType::new("Sigma", TaggedValue::F64(1.), false),
],
outputs: &[FrontendGraphDataType::Raster],
properties: node_properties::blur_image_properties,
},
DocumentNodeType {
name: "Cache",
category: "Structural",
identifier: NodeIdentifier::new("graphene_std::memo::CacheNode", &[concrete!("Image")]),
inputs: &[DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true)],
outputs: &[FrontendGraphDataType::Raster],
properties: node_properties::no_properties,
},
DocumentNodeType {
name: "Invert RGB",
category: "Image Adjustments",

View File

@@ -189,6 +189,13 @@ pub fn brighten_image_properties(document_node: &DocumentNode, node_id: NodeId,
vec![LayoutGroup::Row { widgets: brightness }, LayoutGroup::Row { widgets: contrast }]
}
pub fn blur_image_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
let radius = number_widget(document_node, node_id, 1, "Radius", NumberInput::new().min(0.).max(20.).int(), true);
let sigma = number_widget(document_node, node_id, 2, "Sigma", NumberInput::new().min(0.).max(10000.), true);
vec![LayoutGroup::Row { widgets: radius }, LayoutGroup::Row { widgets: sigma }]
}
pub fn adjust_gamma_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
let gamma = number_widget(document_node, node_id, 1, "Gamma", NumberInput::new().min(0.01), true);