mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Image adjustment nodes restructure (#1013)
* Add macro for creation of Map image nodes * Move nodes to adjustments module * Add Saturation and Lightness to hue shift node * Fix raster node macro * Add Threshold Node * Convert all adjustment nodes to new format * Start implementing vibrance node * Remove package-lock.json * Code review --------- Co-authored-by: isiko404 <isihd.ko@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
parent
202b0ee6ed
commit
8e3480e952
@@ -162,7 +162,7 @@ static STATIC_NODES: &[DocumentNodeType] = &[
|
||||
DocumentNodeType {
|
||||
name: "Grayscale",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_std::raster::GrayscaleNode", &[concrete!("Image")]),
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::GrayscaleNode", &[concrete!("Image")]),
|
||||
inputs: &[DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true)],
|
||||
outputs: &[FrontendGraphDataType::Raster],
|
||||
properties: node_properties::no_properties,
|
||||
@@ -219,7 +219,7 @@ static STATIC_NODES: &[DocumentNodeType] = &[
|
||||
DocumentNodeType {
|
||||
name: "Invert RGB",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_std::raster::InvertRGBNode", &[concrete!("Image")]),
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::InvertRGBNode", &[concrete!("Image")]),
|
||||
inputs: &[DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true)],
|
||||
outputs: &[FrontendGraphDataType::Raster],
|
||||
properties: node_properties::no_properties,
|
||||
@@ -228,7 +228,7 @@ static STATIC_NODES: &[DocumentNodeType] = &[
|
||||
name: "Hue/Saturation",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto(
|
||||
"graphene_std::raster::HueSaturationNode<_, _, _>",
|
||||
"graphene_core::raster::HueSaturationNode<_, _, _>",
|
||||
&[concrete!("Image"), concrete!("f64"), concrete!("f64"), concrete!("f64")],
|
||||
),
|
||||
inputs: &[
|
||||
@@ -243,7 +243,7 @@ static STATIC_NODES: &[DocumentNodeType] = &[
|
||||
DocumentNodeType {
|
||||
name: "Brightness/Contrast",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_std::raster::BrightnessContrastNode<_, _>", &[concrete!("Image"), concrete!("f64"), concrete!("f64")]),
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::BrightnessContrastNode<_, _>", &[concrete!("Image"), concrete!("f64"), concrete!("f64")]),
|
||||
inputs: &[
|
||||
DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true),
|
||||
DocumentInputType::new("Brightness", TaggedValue::F64(0.), false),
|
||||
@@ -255,7 +255,7 @@ static STATIC_NODES: &[DocumentNodeType] = &[
|
||||
DocumentNodeType {
|
||||
name: "Gamma",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_std::raster::GammaNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::GammaNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
inputs: &[
|
||||
DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true),
|
||||
DocumentInputType::new("Gamma", TaggedValue::F64(1.), false),
|
||||
@@ -263,10 +263,32 @@ static STATIC_NODES: &[DocumentNodeType] = &[
|
||||
outputs: &[FrontendGraphDataType::Raster],
|
||||
properties: node_properties::adjust_gamma_properties,
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Threshold",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::ThresholdNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
inputs: &[
|
||||
DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true),
|
||||
DocumentInputType::new("Threshold", TaggedValue::F64(1.), false),
|
||||
],
|
||||
outputs: &[FrontendGraphDataType::Raster],
|
||||
properties: node_properties::adjust_threshold_properties,
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Vibrance",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::VibranceNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
inputs: &[
|
||||
DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true),
|
||||
DocumentInputType::new("Vibrance", TaggedValue::F64(1.), false),
|
||||
],
|
||||
outputs: &[FrontendGraphDataType::Raster],
|
||||
properties: node_properties::adjust_vibrance_properties,
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Opacity",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_std::raster::OpacityNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::OpacityNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
inputs: &[
|
||||
DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true),
|
||||
DocumentInputType::new("Factor", TaggedValue::F64(1.), false),
|
||||
@@ -277,7 +299,7 @@ static STATIC_NODES: &[DocumentNodeType] = &[
|
||||
DocumentNodeType {
|
||||
name: "Posterize",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_std::raster::PosterizeNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::PosterizeNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
inputs: &[
|
||||
DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true),
|
||||
DocumentInputType::new("Value", TaggedValue::F64(5.), false),
|
||||
@@ -288,7 +310,7 @@ static STATIC_NODES: &[DocumentNodeType] = &[
|
||||
DocumentNodeType {
|
||||
name: "Exposure",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_std::raster::ExposureNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::ExposureNode<_>", &[concrete!("Image"), concrete!("f64")]),
|
||||
inputs: &[
|
||||
DocumentInputType::new("Image", TaggedValue::Image(Image::empty()), true),
|
||||
DocumentInputType::new("Value", TaggedValue::F64(0.), false),
|
||||
|
||||
@@ -189,6 +189,18 @@ pub fn adjust_gamma_properties(document_node: &DocumentNode, node_id: NodeId, _c
|
||||
vec![LayoutGroup::Row { widgets: gamma }]
|
||||
}
|
||||
|
||||
pub fn adjust_threshold_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let thereshold = number_widget(document_node, node_id, 1, "Threshold", NumberInput::default().min(0.).max(1.), true);
|
||||
|
||||
vec![LayoutGroup::Row { widgets: thereshold }]
|
||||
}
|
||||
|
||||
pub fn adjust_vibrance_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let vibrance = number_widget(document_node, node_id, 1, "Vibrance", NumberInput::default().min(-100.).max(100.).unit("%"), true);
|
||||
|
||||
vec![LayoutGroup::Row { widgets: vibrance }]
|
||||
}
|
||||
|
||||
#[cfg(feature = "gpu")]
|
||||
pub fn gpu_map_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let map = text_widget(document_node, node_id, 1, "Map", true);
|
||||
|
||||
Reference in New Issue
Block a user