mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-06 18:58:12 +08:00
Make hue saturation node work on the gpu + make f32 default for user inputs
This commit is contained in:
committed by
Keavon Chambers
parent
fea9f8ea24
commit
4abad688a2
+3
-3
@@ -111,12 +111,12 @@ impl<'a> ModifyInputsContext<'a> {
|
|||||||
fn stroke_set(&mut self, stroke: Stroke) {
|
fn stroke_set(&mut self, stroke: Stroke) {
|
||||||
self.modify_inputs("Stroke", false, |inputs| {
|
self.modify_inputs("Stroke", false, |inputs| {
|
||||||
inputs[1] = NodeInput::value(TaggedValue::OptionalColor(stroke.color), false);
|
inputs[1] = NodeInput::value(TaggedValue::OptionalColor(stroke.color), false);
|
||||||
inputs[2] = NodeInput::value(TaggedValue::F64(stroke.weight), false);
|
inputs[2] = NodeInput::value(TaggedValue::F32(stroke.weight as f32), false);
|
||||||
inputs[3] = NodeInput::value(TaggedValue::VecF32(stroke.dash_lengths), false);
|
inputs[3] = NodeInput::value(TaggedValue::VecF32(stroke.dash_lengths), false);
|
||||||
inputs[4] = NodeInput::value(TaggedValue::F64(stroke.dash_offset), false);
|
inputs[4] = NodeInput::value(TaggedValue::F32(stroke.dash_offset as f32), false);
|
||||||
inputs[5] = NodeInput::value(TaggedValue::LineCap(stroke.line_cap), false);
|
inputs[5] = NodeInput::value(TaggedValue::LineCap(stroke.line_cap), false);
|
||||||
inputs[6] = NodeInput::value(TaggedValue::LineJoin(stroke.line_join), false);
|
inputs[6] = NodeInput::value(TaggedValue::LineJoin(stroke.line_join), false);
|
||||||
inputs[7] = NodeInput::value(TaggedValue::F64(stroke.line_join_miter_limit), false);
|
inputs[7] = NodeInput::value(TaggedValue::F32(stroke.line_join_miter_limit as f32), false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -36,7 +36,7 @@ pub fn update_transform(inputs: &mut [NodeInput], transform: DAffine2) {
|
|||||||
let (scale, angle, translation, shear) = compute_scale_angle_translation_shear(transform);
|
let (scale, angle, translation, shear) = compute_scale_angle_translation_shear(transform);
|
||||||
|
|
||||||
inputs[1] = NodeInput::value(TaggedValue::DVec2(translation), false);
|
inputs[1] = NodeInput::value(TaggedValue::DVec2(translation), false);
|
||||||
inputs[2] = NodeInput::value(TaggedValue::F64(angle), false);
|
inputs[2] = NodeInput::value(TaggedValue::F32(angle as f32), false);
|
||||||
inputs[3] = NodeInput::value(TaggedValue::DVec2(scale), false);
|
inputs[3] = NodeInput::value(TaggedValue::DVec2(scale), false);
|
||||||
inputs[4] = NodeInput::value(TaggedValue::DVec2(shear), false);
|
inputs[4] = NodeInput::value(TaggedValue::DVec2(shear), false);
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ pub fn get_current_transform(inputs: &[NodeInput]) -> DAffine2 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let angle = if let NodeInput::Value {
|
let angle = if let NodeInput::Value {
|
||||||
tagged_value: TaggedValue::F64(angle),
|
tagged_value: TaggedValue::F32(angle),
|
||||||
..
|
..
|
||||||
} = inputs[2]
|
} = inputs[2]
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ pub fn get_current_transform(inputs: &[NodeInput]) -> DAffine2 {
|
|||||||
DVec2::ZERO
|
DVec2::ZERO
|
||||||
};
|
};
|
||||||
|
|
||||||
DAffine2::from_scale_angle_translation(scale, angle, translation) * DAffine2::from_cols_array(&[1., shear.y, shear.x, 1., 0., 0.])
|
DAffine2::from_scale_angle_translation(scale, angle as f64, translation) * DAffine2::from_cols_array(&[1., shear.y, shear.x, 1., 0., 0.])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract the current normalized pivot from the layer
|
/// Extract the current normalized pivot from the layer
|
||||||
|
|||||||
+90
-92
@@ -490,7 +490,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("Second", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Second", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("BlendMode", TaggedValue::BlendMode(BlendMode::Normal), false),
|
DocumentInputType::value("BlendMode", TaggedValue::BlendMode(BlendMode::Normal), false),
|
||||||
DocumentInputType::value("Opacity", TaggedValue::F64(100.), false),
|
DocumentInputType::value("Opacity", TaggedValue::F32(100.), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
properties: node_properties::blend_properties,
|
properties: node_properties::blend_properties,
|
||||||
@@ -508,27 +508,27 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Shadows",
|
name: "Shadows",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(0.), false),
|
default: NodeInput::value(TaggedValue::F32(0.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Midtones",
|
name: "Midtones",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(50.), false),
|
default: NodeInput::value(TaggedValue::F32(50.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Highlights",
|
name: "Highlights",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(100.), false),
|
default: NodeInput::value(TaggedValue::F32(100.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Output Minimums",
|
name: "Output Minimums",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(0.), false),
|
default: NodeInput::value(TaggedValue::F32(0.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Output Maximums",
|
name: "Output Maximums",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(100.), false),
|
default: NodeInput::value(TaggedValue::F32(100.), false),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
@@ -552,32 +552,32 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Reds",
|
name: "Reds",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(40.), false),
|
default: NodeInput::value(TaggedValue::F32(40.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Yellows",
|
name: "Yellows",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(60.), false),
|
default: NodeInput::value(TaggedValue::F32(60.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Greens",
|
name: "Greens",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(40.), false),
|
default: NodeInput::value(TaggedValue::F32(40.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Cyans",
|
name: "Cyans",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(60.), false),
|
default: NodeInput::value(TaggedValue::F32(60.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Blues",
|
name: "Blues",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(20.), false),
|
default: NodeInput::value(TaggedValue::F32(20.), false),
|
||||||
},
|
},
|
||||||
DocumentInputType {
|
DocumentInputType {
|
||||||
name: "Magentas",
|
name: "Magentas",
|
||||||
data_type: FrontendGraphDataType::Number,
|
data_type: FrontendGraphDataType::Number,
|
||||||
default: NodeInput::value(TaggedValue::F64(80.), false),
|
default: NodeInput::value(TaggedValue::F32(80.), false),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
@@ -1361,9 +1361,9 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
identifier: NodeImplementation::proto("graphene_core::raster::HueSaturationNode<_, _, _>"),
|
identifier: NodeImplementation::proto("graphene_core::raster::HueSaturationNode<_, _, _>"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("Hue Shift", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Hue Shift", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Saturation Shift", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Saturation Shift", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Lightness Shift", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Lightness Shift", TaggedValue::F32(0.), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
properties: node_properties::adjust_hsl_properties,
|
properties: node_properties::adjust_hsl_properties,
|
||||||
@@ -1374,8 +1374,8 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
identifier: NodeImplementation::proto("graphene_core::raster::BrightnessContrastNode<_, _, _>"),
|
identifier: NodeImplementation::proto("graphene_core::raster::BrightnessContrastNode<_, _, _>"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("Brightness", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Brightness", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Contrast", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Contrast", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Use Legacy", TaggedValue::Bool(false), false),
|
DocumentInputType::value("Use Legacy", TaggedValue::Bool(false), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
@@ -1387,8 +1387,8 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
identifier: NodeImplementation::proto("graphene_core::raster::ThresholdNode<_, _, _>"),
|
identifier: NodeImplementation::proto("graphene_core::raster::ThresholdNode<_, _, _>"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("Min Luminance", TaggedValue::F64(50.), false),
|
DocumentInputType::value("Min Luminance", TaggedValue::F32(50.), false),
|
||||||
DocumentInputType::value("Max Luminance", TaggedValue::F64(100.), false),
|
DocumentInputType::value("Max Luminance", TaggedValue::F32(100.), false),
|
||||||
DocumentInputType::value("Luminance Calc", TaggedValue::LuminanceCalculation(LuminanceCalculation::SRGB), false),
|
DocumentInputType::value("Luminance Calc", TaggedValue::LuminanceCalculation(LuminanceCalculation::SRGB), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
@@ -1400,7 +1400,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
identifier: NodeImplementation::proto("graphene_core::raster::VibranceNode<_>"),
|
identifier: NodeImplementation::proto("graphene_core::raster::VibranceNode<_>"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("Vibrance", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Vibrance", TaggedValue::F32(0.), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
properties: node_properties::adjust_vibrance_properties,
|
properties: node_properties::adjust_vibrance_properties,
|
||||||
@@ -1414,25 +1414,25 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
// Monochrome toggle
|
// Monochrome toggle
|
||||||
DocumentInputType::value("Monochrome", TaggedValue::Bool(false), false),
|
DocumentInputType::value("Monochrome", TaggedValue::Bool(false), false),
|
||||||
// Monochrome
|
// Monochrome
|
||||||
DocumentInputType::value("Red", TaggedValue::F64(40.), false),
|
DocumentInputType::value("Red", TaggedValue::F32(40.), false),
|
||||||
DocumentInputType::value("Green", TaggedValue::F64(40.), false),
|
DocumentInputType::value("Green", TaggedValue::F32(40.), false),
|
||||||
DocumentInputType::value("Blue", TaggedValue::F64(20.), false),
|
DocumentInputType::value("Blue", TaggedValue::F32(20.), false),
|
||||||
DocumentInputType::value("Constant", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Constant", TaggedValue::F32(0.), false),
|
||||||
// Red output channel
|
// Red output channel
|
||||||
DocumentInputType::value("(Red) Red", TaggedValue::F64(100.), false),
|
DocumentInputType::value("(Red) Red", TaggedValue::F32(100.), false),
|
||||||
DocumentInputType::value("(Red) Green", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Red) Green", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Red) Blue", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Red) Blue", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Red) Constant", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Red) Constant", TaggedValue::F32(0.), false),
|
||||||
// Green output channel
|
// Green output channel
|
||||||
DocumentInputType::value("(Green) Red", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Green) Red", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Green) Green", TaggedValue::F64(100.), false),
|
DocumentInputType::value("(Green) Green", TaggedValue::F32(100.), false),
|
||||||
DocumentInputType::value("(Green) Blue", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Green) Blue", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Green) Constant", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Green) Constant", TaggedValue::F32(0.), false),
|
||||||
// Blue output channel
|
// Blue output channel
|
||||||
DocumentInputType::value("(Blue) Red", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blue) Red", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Blue) Green", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blue) Green", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Blue) Blue", TaggedValue::F64(100.), false),
|
DocumentInputType::value("(Blue) Blue", TaggedValue::F32(100.), false),
|
||||||
DocumentInputType::value("(Blue) Constant", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blue) Constant", TaggedValue::F32(0.), false),
|
||||||
// Display-only properties (not used within the node)
|
// Display-only properties (not used within the node)
|
||||||
DocumentInputType::value("Output Channel", TaggedValue::RedGreenBlue(RedGreenBlue::Red), false),
|
DocumentInputType::value("Output Channel", TaggedValue::RedGreenBlue(RedGreenBlue::Red), false),
|
||||||
],
|
],
|
||||||
@@ -1450,50 +1450,50 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
// Mode
|
// Mode
|
||||||
DocumentInputType::value("Mode", TaggedValue::RelativeAbsolute(RelativeAbsolute::Relative), false),
|
DocumentInputType::value("Mode", TaggedValue::RelativeAbsolute(RelativeAbsolute::Relative), false),
|
||||||
// Reds
|
// Reds
|
||||||
DocumentInputType::value("(Reds) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Reds) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Reds) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Reds) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Reds) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Reds) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Reds) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Reds) Black", TaggedValue::F32(0.), false),
|
||||||
// Yellows
|
// Yellows
|
||||||
DocumentInputType::value("(Yellows) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Yellows) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Yellows) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Yellows) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Yellows) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Yellows) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Yellows) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Yellows) Black", TaggedValue::F32(0.), false),
|
||||||
// Greens
|
// Greens
|
||||||
DocumentInputType::value("(Greens) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Greens) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Greens) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Greens) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Greens) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Greens) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Greens) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Greens) Black", TaggedValue::F32(0.), false),
|
||||||
// Cyans
|
// Cyans
|
||||||
DocumentInputType::value("(Cyans) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Cyans) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Cyans) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Cyans) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Cyans) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Cyans) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Cyans) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Cyans) Black", TaggedValue::F32(0.), false),
|
||||||
// Blues
|
// Blues
|
||||||
DocumentInputType::value("(Blues) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blues) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Blues) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blues) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Blues) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blues) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Blues) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blues) Black", TaggedValue::F32(0.), false),
|
||||||
// Magentas
|
// Magentas
|
||||||
DocumentInputType::value("(Magentas) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Magentas) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Magentas) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Magentas) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Magentas) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Magentas) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Magentas) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Magentas) Black", TaggedValue::F32(0.), false),
|
||||||
// Whites
|
// Whites
|
||||||
DocumentInputType::value("(Whites) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Whites) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Whites) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Whites) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Whites) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Whites) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Whites) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Whites) Black", TaggedValue::F32(0.), false),
|
||||||
// Neutrals
|
// Neutrals
|
||||||
DocumentInputType::value("(Neutrals) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Neutrals) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Neutrals) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Neutrals) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Neutrals) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Neutrals) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Neutrals) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Neutrals) Black", TaggedValue::F32(0.), false),
|
||||||
// Blacks
|
// Blacks
|
||||||
DocumentInputType::value("(Blacks) Cyan", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blacks) Cyan", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Blacks) Magenta", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blacks) Magenta", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Blacks) Yellow", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blacks) Yellow", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("(Blacks) Black", TaggedValue::F64(0.), false),
|
DocumentInputType::value("(Blacks) Black", TaggedValue::F32(0.), false),
|
||||||
// Display-only properties (not used within the node)
|
// Display-only properties (not used within the node)
|
||||||
DocumentInputType::value("Colors", TaggedValue::SelectiveColorChoice(SelectiveColorChoice::Reds), false),
|
DocumentInputType::value("Colors", TaggedValue::SelectiveColorChoice(SelectiveColorChoice::Reds), false),
|
||||||
],
|
],
|
||||||
@@ -1506,7 +1506,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
identifier: NodeImplementation::proto("graphene_core::raster::OpacityNode<_>"),
|
identifier: NodeImplementation::proto("graphene_core::raster::OpacityNode<_>"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("Factor", TaggedValue::F64(100.), false),
|
DocumentInputType::value("Factor", TaggedValue::F32(100.), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
properties: node_properties::multiply_opacity,
|
properties: node_properties::multiply_opacity,
|
||||||
@@ -1517,7 +1517,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
identifier: NodeImplementation::proto("graphene_core::raster::PosterizeNode<_>"),
|
identifier: NodeImplementation::proto("graphene_core::raster::PosterizeNode<_>"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("Value", TaggedValue::F64(4.), false),
|
DocumentInputType::value("Value", TaggedValue::F32(4.), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
properties: node_properties::posterize_properties,
|
properties: node_properties::posterize_properties,
|
||||||
@@ -1528,9 +1528,9 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
identifier: NodeImplementation::proto("graphene_core::raster::ExposureNode<_, _, _>"),
|
identifier: NodeImplementation::proto("graphene_core::raster::ExposureNode<_, _, _>"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||||
DocumentInputType::value("Exposure", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Exposure", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Offset", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Offset", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Gamma Correction", TaggedValue::F64(1.), false),
|
DocumentInputType::value("Gamma Correction", TaggedValue::F32(1.), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
properties: node_properties::exposure_properties,
|
properties: node_properties::exposure_properties,
|
||||||
@@ -1540,8 +1540,8 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
category: "Math",
|
category: "Math",
|
||||||
identifier: NodeImplementation::proto("graphene_core::ops::AddParameterNode<_>"),
|
identifier: NodeImplementation::proto("graphene_core::ops::AddParameterNode<_>"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Input", TaggedValue::F64(0.), true),
|
DocumentInputType::value("Input", TaggedValue::F32(0.), true),
|
||||||
DocumentInputType::value("Addend", TaggedValue::F64(0.), true),
|
DocumentInputType::value("Addend", TaggedValue::F32(0.), true),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)],
|
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)],
|
||||||
properties: node_properties::add_properties,
|
properties: node_properties::add_properties,
|
||||||
@@ -1574,7 +1574,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
DocumentInputType::none(),
|
DocumentInputType::none(),
|
||||||
DocumentInputType::value("Text", TaggedValue::String("hello world".to_string()), false),
|
DocumentInputType::value("Text", TaggedValue::String("hello world".to_string()), false),
|
||||||
DocumentInputType::value("Font", TaggedValue::Font(Font::new(DEFAULT_FONT_FAMILY.into(), DEFAULT_FONT_STYLE.into())), false),
|
DocumentInputType::value("Font", TaggedValue::Font(Font::new(DEFAULT_FONT_FAMILY.into(), DEFAULT_FONT_STYLE.into())), false),
|
||||||
DocumentInputType::value("Size", TaggedValue::F64(24.), false),
|
DocumentInputType::value("Size", TaggedValue::F32(24.), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Vector", FrontendGraphDataType::Subpath)],
|
outputs: vec![DocumentOutputType::new("Vector", FrontendGraphDataType::Subpath)],
|
||||||
properties: node_properties::node_section_font,
|
properties: node_properties::node_section_font,
|
||||||
@@ -1586,7 +1586,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Data", TaggedValue::VectorData(graphene_core::vector::VectorData::empty()), true),
|
DocumentInputType::value("Data", TaggedValue::VectorData(graphene_core::vector::VectorData::empty()), true),
|
||||||
DocumentInputType::value("Translation", TaggedValue::DVec2(DVec2::ZERO), false),
|
DocumentInputType::value("Translation", TaggedValue::DVec2(DVec2::ZERO), false),
|
||||||
DocumentInputType::value("Rotation", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Rotation", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Scale", TaggedValue::DVec2(DVec2::ONE), false),
|
DocumentInputType::value("Scale", TaggedValue::DVec2(DVec2::ONE), false),
|
||||||
DocumentInputType::value("Skew", TaggedValue::DVec2(DVec2::ZERO), false),
|
DocumentInputType::value("Skew", TaggedValue::DVec2(DVec2::ZERO), false),
|
||||||
DocumentInputType::value("Pivot", TaggedValue::DVec2(DVec2::splat(0.5)), false),
|
DocumentInputType::value("Pivot", TaggedValue::DVec2(DVec2::splat(0.5)), false),
|
||||||
@@ -1629,12 +1629,12 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
inputs: vec![
|
inputs: vec![
|
||||||
DocumentInputType::value("Vector Data", TaggedValue::VectorData(graphene_core::vector::VectorData::empty()), true),
|
DocumentInputType::value("Vector Data", TaggedValue::VectorData(graphene_core::vector::VectorData::empty()), true),
|
||||||
DocumentInputType::value("Color", TaggedValue::OptionalColor(Some(Color::BLACK)), false),
|
DocumentInputType::value("Color", TaggedValue::OptionalColor(Some(Color::BLACK)), false),
|
||||||
DocumentInputType::value("Weight", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Weight", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Dash Lengths", TaggedValue::VecF32(Vec::new()), false),
|
DocumentInputType::value("Dash Lengths", TaggedValue::VecF32(Vec::new()), false),
|
||||||
DocumentInputType::value("Dash Offset", TaggedValue::F64(0.), false),
|
DocumentInputType::value("Dash Offset", TaggedValue::F32(0.), false),
|
||||||
DocumentInputType::value("Line Cap", TaggedValue::LineCap(graphene_core::vector::style::LineCap::Butt), false),
|
DocumentInputType::value("Line Cap", TaggedValue::LineCap(graphene_core::vector::style::LineCap::Butt), false),
|
||||||
DocumentInputType::value("Line Join", TaggedValue::LineJoin(graphene_core::vector::style::LineJoin::Miter), false),
|
DocumentInputType::value("Line Join", TaggedValue::LineJoin(graphene_core::vector::style::LineJoin::Miter), false),
|
||||||
DocumentInputType::value("Miter Limit", TaggedValue::F64(4.), false),
|
DocumentInputType::value("Miter Limit", TaggedValue::F32(4.), false),
|
||||||
],
|
],
|
||||||
outputs: vec![DocumentOutputType::new("Vector", FrontendGraphDataType::Subpath)],
|
outputs: vec![DocumentOutputType::new("Vector", FrontendGraphDataType::Subpath)],
|
||||||
properties: node_properties::stroke_properties,
|
properties: node_properties::stroke_properties,
|
||||||
@@ -1721,18 +1721,18 @@ pub static IMAGINATE_NODE: Lazy<DocumentNodeType> = Lazy::new(|| DocumentNodeTyp
|
|||||||
default: NodeInput::Network(concrete!(WasmEditorApi)),
|
default: NodeInput::Network(concrete!(WasmEditorApi)),
|
||||||
},
|
},
|
||||||
DocumentInputType::value("Controller", TaggedValue::ImaginateController(Default::default()), false),
|
DocumentInputType::value("Controller", TaggedValue::ImaginateController(Default::default()), false),
|
||||||
DocumentInputType::value("Seed", TaggedValue::F64(0.), false), // Remember to keep index used in `ImaginateRandom` updated with this entry's index
|
DocumentInputType::value("Seed", TaggedValue::F32(0.), false), // Remember to keep index used in `ImaginateRandom` updated with this entry's index
|
||||||
DocumentInputType::value("Resolution", TaggedValue::OptionalDVec2(None), false),
|
DocumentInputType::value("Resolution", TaggedValue::OptionalDVec2(None), false),
|
||||||
DocumentInputType::value("Samples", TaggedValue::U32(30), false),
|
DocumentInputType::value("Samples", TaggedValue::U32(30), false),
|
||||||
DocumentInputType::value("Sampling Method", TaggedValue::ImaginateSamplingMethod(ImaginateSamplingMethod::EulerA), false),
|
DocumentInputType::value("Sampling Method", TaggedValue::ImaginateSamplingMethod(ImaginateSamplingMethod::EulerA), false),
|
||||||
DocumentInputType::value("Prompt Guidance", TaggedValue::F64(7.5), false),
|
DocumentInputType::value("Prompt Guidance", TaggedValue::F32(7.5), false),
|
||||||
DocumentInputType::value("Prompt", TaggedValue::String(String::new()), false),
|
DocumentInputType::value("Prompt", TaggedValue::String(String::new()), false),
|
||||||
DocumentInputType::value("Negative Prompt", TaggedValue::String(String::new()), false),
|
DocumentInputType::value("Negative Prompt", TaggedValue::String(String::new()), false),
|
||||||
DocumentInputType::value("Adapt Input Image", TaggedValue::Bool(false), false),
|
DocumentInputType::value("Adapt Input Image", TaggedValue::Bool(false), false),
|
||||||
DocumentInputType::value("Image Creativity", TaggedValue::F64(66.), false),
|
DocumentInputType::value("Image Creativity", TaggedValue::F32(66.), false),
|
||||||
DocumentInputType::value("Masking Layer", TaggedValue::LayerPath(None), false),
|
DocumentInputType::value("Masking Layer", TaggedValue::LayerPath(None), false),
|
||||||
DocumentInputType::value("Inpaint", TaggedValue::Bool(true), false),
|
DocumentInputType::value("Inpaint", TaggedValue::Bool(true), false),
|
||||||
DocumentInputType::value("Mask Blur", TaggedValue::F64(4.), false),
|
DocumentInputType::value("Mask Blur", TaggedValue::F32(4.), false),
|
||||||
DocumentInputType::value("Mask Starting Fill", TaggedValue::ImaginateMaskStartingFill(ImaginateMaskStartingFill::Fill), false),
|
DocumentInputType::value("Mask Starting Fill", TaggedValue::ImaginateMaskStartingFill(ImaginateMaskStartingFill::Fill), false),
|
||||||
DocumentInputType::value("Improve Faces", TaggedValue::Bool(false), false),
|
DocumentInputType::value("Improve Faces", TaggedValue::Bool(false), false),
|
||||||
DocumentInputType::value("Tiling", TaggedValue::Bool(false), false),
|
DocumentInputType::value("Tiling", TaggedValue::Bool(false), false),
|
||||||
@@ -1813,9 +1813,7 @@ impl DocumentNodeType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn wrap_network_in_scope(mut network: NodeNetwork) -> NodeNetwork {
|
pub fn wrap_network_in_scope(mut network: NodeNetwork) -> NodeNetwork {
|
||||||
|
|
||||||
network.generate_node_paths(&[]);
|
network.generate_node_paths(&[]);
|
||||||
network.resolve_extract_nodes();
|
|
||||||
|
|
||||||
let node_ids = network.nodes.keys().copied().collect::<Vec<_>>();
|
let node_ids = network.nodes.keys().copied().collect::<Vec<_>>();
|
||||||
for id in node_ids {
|
for id in node_ids {
|
||||||
@@ -1912,7 +1910,7 @@ pub fn new_vector_network(subpaths: Vec<bezier_rs::Subpath<uuid::ManipulatorGrou
|
|||||||
network
|
network
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_text_network(text: String, font: Font, size: f64) -> NodeNetwork {
|
pub fn new_text_network(text: String, font: Font, size: f32) -> NodeNetwork {
|
||||||
let text_generator = resolve_document_node_type("Text").expect("Text node does not exist");
|
let text_generator = resolve_document_node_type("Text").expect("Text node does not exist");
|
||||||
let transform = resolve_document_node_type("Transform").expect("Transform node does not exist");
|
let transform = resolve_document_node_type("Transform").expect("Transform node does not exist");
|
||||||
let fill = resolve_document_node_type("Fill").expect("Fill node does not exist");
|
let fill = resolve_document_node_type("Fill").expect("Fill node does not exist");
|
||||||
@@ -1929,7 +1927,7 @@ pub fn new_text_network(text: String, font: Font, size: f64) -> NodeNetwork {
|
|||||||
NodeInput::Network(concrete!(WasmEditorApi)),
|
NodeInput::Network(concrete!(WasmEditorApi)),
|
||||||
NodeInput::value(TaggedValue::String(text), false),
|
NodeInput::value(TaggedValue::String(text), false),
|
||||||
NodeInput::value(TaggedValue::Font(font), false),
|
NodeInput::value(TaggedValue::Font(font), false),
|
||||||
NodeInput::value(TaggedValue::F64(size), false),
|
NodeInput::value(TaggedValue::F32(size), false),
|
||||||
],
|
],
|
||||||
DocumentNodeMetadata::position((0, 4)),
|
DocumentNodeMetadata::position((0, 4)),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ impl TextToolData {
|
|||||||
else if let Some(editing_text) = self.editing_text.as_ref().filter(|_| state == TextToolFsmState::Ready) {
|
else if let Some(editing_text) = self.editing_text.as_ref().filter(|_| state == TextToolFsmState::Ready) {
|
||||||
responses.add(DocumentMessage::StartTransaction);
|
responses.add(DocumentMessage::StartTransaction);
|
||||||
|
|
||||||
let network = new_text_network(String::new(), editing_text.font.clone(), editing_text.font_size);
|
let network = new_text_network(String::new(), editing_text.font.clone(), editing_text.font_size as f32);
|
||||||
|
|
||||||
responses.add(Operation::AddFrame {
|
responses.add(Operation::AddFrame {
|
||||||
path: self.layer_path.clone(),
|
path: self.layer_path.clone(),
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn post_compile_spirv(State(state): State<Arc<AppState>>, Json(compile_request): Json<CompileRequest>) -> Result<Vec<u8>, StatusCode> {
|
async fn post_compile_spirv(State(state): State<Arc<AppState>>, Json(compile_request): Json<CompileRequest>) -> Result<Vec<u8>, StatusCode> {
|
||||||
|
println!("compile request: {:?}", compile_request);
|
||||||
if let Some(result) = state.cache.read().unwrap().get(&compile_request) {
|
if let Some(result) = state.cache.read().unwrap().get(&compile_request) {
|
||||||
return result.clone();
|
return result.clone();
|
||||||
}
|
}
|
||||||
@@ -44,6 +45,9 @@ async fn post_compile_spirv(State(state): State<Arc<AppState>>, Json(compile_req
|
|||||||
eprintln!("compilation failed: {}", e);
|
eprintln!("compilation failed: {}", e);
|
||||||
StatusCode::INTERNAL_SERVER_ERROR
|
StatusCode::INTERNAL_SERVER_ERROR
|
||||||
});
|
});
|
||||||
|
if result.is_err() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
state.cache.write().unwrap().insert(compile_request, result.clone());
|
state.cache.write().unwrap().insert(compile_request, result.clone());
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ pub struct LevelsNode<InputStart, InputMid, InputEnd, OutputStart, OutputEnd> {
|
|||||||
|
|
||||||
// From https://stackoverflow.com/questions/39510072/algorithm-for-adjustment-of-image-levels
|
// From https://stackoverflow.com/questions/39510072/algorithm-for-adjustment-of-image-levels
|
||||||
#[node_macro::node_fn(LevelsNode)]
|
#[node_macro::node_fn(LevelsNode)]
|
||||||
fn levels_node(color: Color, input_start: f64, input_mid: f64, input_end: f64, output_start: f64, output_end: f64) -> Color {
|
fn levels_node(color: Color, input_start: f32, input_mid: f32, input_end: f32, output_start: f32, output_end: f32) -> Color {
|
||||||
let color = color.to_gamma_srgb();
|
let color = color.to_gamma_srgb();
|
||||||
|
|
||||||
// Input Range (Range: 0-1)
|
// Input Range (Range: 0-1)
|
||||||
@@ -286,7 +286,7 @@ pub struct GrayscaleNode<Tint, Reds, Yellows, Greens, Cyans, Blues, Magentas> {
|
|||||||
// From <https://stackoverflow.com/a/55233732/775283>
|
// From <https://stackoverflow.com/a/55233732/775283>
|
||||||
// Works the same for gamma and linear color
|
// Works the same for gamma and linear color
|
||||||
#[node_macro::node_fn(GrayscaleNode)]
|
#[node_macro::node_fn(GrayscaleNode)]
|
||||||
fn grayscale_color_node(color: Color, tint: Color, reds: f64, yellows: f64, greens: f64, cyans: f64, blues: f64, magentas: f64) -> Color {
|
fn grayscale_color_node(color: Color, tint: Color, reds: f32, yellows: f32, greens: f32, cyans: f32, blues: f32, magentas: f32) -> Color {
|
||||||
let color = color.to_gamma_srgb();
|
let color = color.to_gamma_srgb();
|
||||||
|
|
||||||
let reds = reds as f32 / 100.;
|
let reds = reds as f32 / 100.;
|
||||||
@@ -329,7 +329,7 @@ pub struct HueSaturationNode<Hue, Saturation, Lightness> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[node_macro::node_fn(HueSaturationNode)]
|
#[node_macro::node_fn(HueSaturationNode)]
|
||||||
fn hue_shift_color_node(color: Color, hue_shift: f64, saturation_shift: f64, lightness_shift: f64) -> Color {
|
fn hue_shift_color_node(color: Color, hue_shift: f32, saturation_shift: f32, lightness_shift: f32) -> Color {
|
||||||
let color = color.to_gamma_srgb();
|
let color = color.to_gamma_srgb();
|
||||||
|
|
||||||
let [hue, saturation, lightness, alpha] = color.to_hsla();
|
let [hue, saturation, lightness, alpha] = color.to_hsla();
|
||||||
@@ -379,7 +379,7 @@ pub struct ThresholdNode<MinLuminance, MaxLuminance, LuminanceCalc> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[node_macro::node_fn(ThresholdNode)]
|
#[node_macro::node_fn(ThresholdNode)]
|
||||||
fn threshold_node(color: Color, min_luminance: f64, max_luminance: f64, luminance_calc: LuminanceCalculation) -> Color {
|
fn threshold_node(color: Color, min_luminance: f32, max_luminance: f32, luminance_calc: LuminanceCalculation) -> Color {
|
||||||
let min_luminance = Color::srgb_to_linear(min_luminance as f32 / 100.);
|
let min_luminance = Color::srgb_to_linear(min_luminance as f32 / 100.);
|
||||||
let max_luminance = Color::srgb_to_linear(max_luminance as f32 / 100.);
|
let max_luminance = Color::srgb_to_linear(max_luminance as f32 / 100.);
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ pub struct BlendNode<BlendMode, Opacity> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[node_macro::node_fn(BlendNode)]
|
#[node_macro::node_fn(BlendNode)]
|
||||||
fn blend_node(input: (Color, Color), blend_mode: BlendMode, opacity: f64) -> Color {
|
fn blend_node(input: (Color, Color), blend_mode: BlendMode, opacity: f32) -> Color {
|
||||||
blend_colors(input.0, input.1, blend_mode, opacity as f32 / 100.)
|
blend_colors(input.0, input.1, blend_mode, opacity as f32 / 100.)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ pub struct VibranceNode<Vibrance> {
|
|||||||
// Modified from https://stackoverflow.com/questions/33966121/what-is-the-algorithm-for-vibrance-filters
|
// Modified from https://stackoverflow.com/questions/33966121/what-is-the-algorithm-for-vibrance-filters
|
||||||
// The results of this implementation are very close to correct, but not quite perfect
|
// The results of this implementation are very close to correct, but not quite perfect
|
||||||
#[node_macro::node_fn(VibranceNode)]
|
#[node_macro::node_fn(VibranceNode)]
|
||||||
fn vibrance_node(color: Color, vibrance: f64) -> Color {
|
fn vibrance_node(color: Color, vibrance: f32) -> Color {
|
||||||
let vibrance = vibrance as f32 / 100.;
|
let vibrance = vibrance as f32 / 100.;
|
||||||
// Slow the effect down by half when it's negative, since artifacts begin appearing past -50%.
|
// Slow the effect down by half when it's negative, since artifacts begin appearing past -50%.
|
||||||
// So this scales the 0% to -50% range to 0% to -100%.
|
// So this scales the 0% to -50% range to 0% to -100%.
|
||||||
@@ -553,22 +553,22 @@ pub struct ChannelMixerNode<Monochrome, MonochromeR, MonochromeG, MonochromeB, M
|
|||||||
fn channel_mixer_node(
|
fn channel_mixer_node(
|
||||||
color: Color,
|
color: Color,
|
||||||
monochrome: bool,
|
monochrome: bool,
|
||||||
monochrome_r: f64,
|
monochrome_r: f32,
|
||||||
monochrome_g: f64,
|
monochrome_g: f32,
|
||||||
monochrome_b: f64,
|
monochrome_b: f32,
|
||||||
monochrome_c: f64,
|
monochrome_c: f32,
|
||||||
red_r: f64,
|
red_r: f32,
|
||||||
red_g: f64,
|
red_g: f32,
|
||||||
red_b: f64,
|
red_b: f32,
|
||||||
red_c: f64,
|
red_c: f32,
|
||||||
green_r: f64,
|
green_r: f32,
|
||||||
green_g: f64,
|
green_g: f32,
|
||||||
green_b: f64,
|
green_b: f32,
|
||||||
green_c: f64,
|
green_c: f32,
|
||||||
blue_r: f64,
|
blue_r: f32,
|
||||||
blue_g: f64,
|
blue_g: f32,
|
||||||
blue_b: f64,
|
blue_b: f32,
|
||||||
blue_c: f64,
|
blue_c: f32,
|
||||||
) -> Color {
|
) -> Color {
|
||||||
let color = color.to_gamma_srgb();
|
let color = color.to_gamma_srgb();
|
||||||
|
|
||||||
@@ -690,42 +690,42 @@ pub struct SelectiveColorNode<Absolute, RC, RM, RY, RK, YC, YM, YY, YK, GC, GM,
|
|||||||
fn selective_color_node(
|
fn selective_color_node(
|
||||||
color: Color,
|
color: Color,
|
||||||
mode: RelativeAbsolute,
|
mode: RelativeAbsolute,
|
||||||
r_c: f64,
|
r_c: f32,
|
||||||
r_m: f64,
|
r_m: f32,
|
||||||
r_y: f64,
|
r_y: f32,
|
||||||
r_k: f64,
|
r_k: f32,
|
||||||
y_c: f64,
|
y_c: f32,
|
||||||
y_m: f64,
|
y_m: f32,
|
||||||
y_y: f64,
|
y_y: f32,
|
||||||
y_k: f64,
|
y_k: f32,
|
||||||
g_c: f64,
|
g_c: f32,
|
||||||
g_m: f64,
|
g_m: f32,
|
||||||
g_y: f64,
|
g_y: f32,
|
||||||
g_k: f64,
|
g_k: f32,
|
||||||
c_c: f64,
|
c_c: f32,
|
||||||
c_m: f64,
|
c_m: f32,
|
||||||
c_y: f64,
|
c_y: f32,
|
||||||
c_k: f64,
|
c_k: f32,
|
||||||
b_c: f64,
|
b_c: f32,
|
||||||
b_m: f64,
|
b_m: f32,
|
||||||
b_y: f64,
|
b_y: f32,
|
||||||
b_k: f64,
|
b_k: f32,
|
||||||
m_c: f64,
|
m_c: f32,
|
||||||
m_m: f64,
|
m_m: f32,
|
||||||
m_y: f64,
|
m_y: f32,
|
||||||
m_k: f64,
|
m_k: f32,
|
||||||
w_c: f64,
|
w_c: f32,
|
||||||
w_m: f64,
|
w_m: f32,
|
||||||
w_y: f64,
|
w_y: f32,
|
||||||
w_k: f64,
|
w_k: f32,
|
||||||
n_c: f64,
|
n_c: f32,
|
||||||
n_m: f64,
|
n_m: f32,
|
||||||
n_y: f64,
|
n_y: f32,
|
||||||
n_k: f64,
|
n_k: f32,
|
||||||
k_c: f64,
|
k_c: f32,
|
||||||
k_m: f64,
|
k_m: f32,
|
||||||
k_y: f64,
|
k_y: f32,
|
||||||
k_k: f64,
|
k_k: f32,
|
||||||
) -> Color {
|
) -> Color {
|
||||||
let color = color.to_gamma_srgb();
|
let color = color.to_gamma_srgb();
|
||||||
|
|
||||||
@@ -775,7 +775,7 @@ fn selective_color_node(
|
|||||||
// Skip this color parameter group...
|
// Skip this color parameter group...
|
||||||
// ...if it's unchanged from the default of zero offset on all CMYK paramters, or...
|
// ...if it's unchanged from the default of zero offset on all CMYK paramters, or...
|
||||||
// ...if this pixel's color isn't in the range affected by this color parameter group
|
// ...if this pixel's color isn't in the range affected by this color parameter group
|
||||||
if (c < f64::EPSILON && m < f64::EPSILON && y < f64::EPSILON && k < f64::EPSILON) || (!pixel_color_range(color_parameter_group)) {
|
if (c < f32::EPSILON && m < f32::EPSILON && y < f32::EPSILON && k < f32::EPSILON) || (!pixel_color_range(color_parameter_group)) {
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,7 +807,7 @@ pub struct OpacityNode<O> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[node_macro::node_fn(OpacityNode)]
|
#[node_macro::node_fn(OpacityNode)]
|
||||||
fn image_opacity(color: Color, opacity_multiplier: f64) -> Color {
|
fn image_opacity(color: Color, opacity_multiplier: f32) -> Color {
|
||||||
let opacity_multiplier = opacity_multiplier as f32 / 100.;
|
let opacity_multiplier = opacity_multiplier as f32 / 100.;
|
||||||
Color::from_rgbaf32_unchecked(color.r(), color.g(), color.b(), color.a() * opacity_multiplier)
|
Color::from_rgbaf32_unchecked(color.r(), color.g(), color.b(), color.a() * opacity_multiplier)
|
||||||
}
|
}
|
||||||
@@ -820,7 +820,7 @@ pub struct PosterizeNode<P> {
|
|||||||
// Based on http://www.axiomx.com/posterize.htm
|
// Based on http://www.axiomx.com/posterize.htm
|
||||||
// This algorithm is perfectly accurate.
|
// This algorithm is perfectly accurate.
|
||||||
#[node_macro::node_fn(PosterizeNode)]
|
#[node_macro::node_fn(PosterizeNode)]
|
||||||
fn posterize(color: Color, posterize_value: f64) -> Color {
|
fn posterize(color: Color, posterize_value: f32) -> Color {
|
||||||
let color = color.to_gamma_srgb();
|
let color = color.to_gamma_srgb();
|
||||||
|
|
||||||
let posterize_value = posterize_value as f32;
|
let posterize_value = posterize_value as f32;
|
||||||
@@ -841,7 +841,7 @@ pub struct ExposureNode<Exposure, Offset, GammaCorrection> {
|
|||||||
|
|
||||||
// Based on https://geraldbakker.nl/psnumbers/exposure.html
|
// Based on https://geraldbakker.nl/psnumbers/exposure.html
|
||||||
#[node_macro::node_fn(ExposureNode)]
|
#[node_macro::node_fn(ExposureNode)]
|
||||||
fn exposure(color: Color, exposure: f64, offset: f64, gamma_correction: f64) -> Color {
|
fn exposure(color: Color, exposure: f32, offset: f32, gamma_correction: f32) -> Color {
|
||||||
let adjusted = color
|
let adjusted = color
|
||||||
// Exposure
|
// Exposure
|
||||||
.map_rgb(|c: f32| c * 2_f32.powf(exposure as f32))
|
.map_rgb(|c: f32| c * 2_f32.powf(exposure as f32))
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ pub struct TextGenerator<Text, FontName, Size> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[node_fn(TextGenerator)]
|
#[node_fn(TextGenerator)]
|
||||||
fn generate_text<'a: 'input, T>(editor: EditorApi<'a, T>, text: String, font_name: Font, font_size: f64) -> crate::vector::VectorData {
|
fn generate_text<'a: 'input, T>(editor: EditorApi<'a, T>, text: String, font_name: Font, font_size: f32) -> crate::vector::VectorData {
|
||||||
let buzz_face = editor.font_cache.get(&font_name).map(|data| load_face(data));
|
let buzz_face = editor.font_cache.get(&font_name).map(|data| load_face(data));
|
||||||
crate::vector::VectorData::from_subpaths(to_path(&text, buzz_face, font_size, None))
|
crate::vector::VectorData::from_subpaths(to_path(&text, buzz_face, font_size as f64, None))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,10 +78,10 @@ pub struct TransformNode<Translation, Rotation, Scale, Shear, Pivot> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[node_macro::node_fn(TransformNode)]
|
#[node_macro::node_fn(TransformNode)]
|
||||||
pub(crate) fn transform_vector_data<Data: TransformMut>(mut data: Data, translate: DVec2, rotate: f64, scale: DVec2, shear: DVec2, pivot: DVec2) -> Data {
|
pub(crate) fn transform_vector_data<Data: TransformMut>(mut data: Data, translate: DVec2, rotate: f32, scale: DVec2, shear: DVec2, pivot: DVec2) -> Data {
|
||||||
let pivot = DAffine2::from_translation(data.local_pivot(pivot));
|
let pivot = DAffine2::from_translation(data.local_pivot(pivot));
|
||||||
|
|
||||||
let modification = pivot * DAffine2::from_scale_angle_translation(scale, rotate, translate) * DAffine2::from_cols_array(&[1., shear.y, shear.x, 1., 0., 0.]) * pivot.inverse();
|
let modification = pivot * DAffine2::from_scale_angle_translation(scale, rotate as f64, translate) * DAffine2::from_cols_array(&[1., shear.y, shear.x, 1., 0., 0.]) * pivot.inverse();
|
||||||
let data_transform = data.transform_mut();
|
let data_transform = data.transform_mut();
|
||||||
*data_transform = modification * (*data_transform);
|
*data_transform = modification * (*data_transform);
|
||||||
|
|
||||||
|
|||||||
@@ -53,21 +53,21 @@ pub struct SetStrokeNode<Color, Weight, DashLengths, DashOffset, LineCap, LineJo
|
|||||||
fn set_vector_data_stroke(
|
fn set_vector_data_stroke(
|
||||||
mut vector_data: VectorData,
|
mut vector_data: VectorData,
|
||||||
color: Option<Color>,
|
color: Option<Color>,
|
||||||
weight: f64,
|
weight: f32,
|
||||||
dash_lengths: Vec<f32>,
|
dash_lengths: Vec<f32>,
|
||||||
dash_offset: f64,
|
dash_offset: f32,
|
||||||
line_cap: super::style::LineCap,
|
line_cap: super::style::LineCap,
|
||||||
line_join: super::style::LineJoin,
|
line_join: super::style::LineJoin,
|
||||||
miter_limit: f64,
|
miter_limit: f32,
|
||||||
) -> VectorData {
|
) -> VectorData {
|
||||||
vector_data.style.set_stroke(Stroke {
|
vector_data.style.set_stroke(Stroke {
|
||||||
color,
|
color,
|
||||||
weight,
|
weight: weight as f64,
|
||||||
dash_lengths,
|
dash_lengths,
|
||||||
dash_offset,
|
dash_offset: dash_offset as f64,
|
||||||
line_cap,
|
line_cap,
|
||||||
line_join,
|
line_join,
|
||||||
line_join_miter_limit: miter_limit,
|
line_join_miter_limit: miter_limit as f64,
|
||||||
});
|
});
|
||||||
vector_data
|
vector_data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ impl SpirVCompiler for GpuCompiler {
|
|||||||
|
|
||||||
pub fn serialize_gpu(networks: &[ProtoNetwork], io: &ShaderIO) -> anyhow::Result<String> {
|
pub fn serialize_gpu(networks: &[ProtoNetwork], io: &ShaderIO) -> anyhow::Result<String> {
|
||||||
fn nid(id: &u64) -> String {
|
fn nid(id: &u64) -> String {
|
||||||
format!("n{id}")
|
format!("n{id:0x}")
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg!(&io);
|
dbg!(&io);
|
||||||
@@ -216,9 +216,10 @@ pub fn compile(dir: &Path) -> Result<spirv_builder::CompileResult, spirv_builder
|
|||||||
.release(true)
|
.release(true)
|
||||||
.spirv_metadata(SpirvMetadata::Full)
|
.spirv_metadata(SpirvMetadata::Full)
|
||||||
.capability(spirv_builder::Capability::Float64)
|
.capability(spirv_builder::Capability::Float64)
|
||||||
.extra_arg("no-early-report-zombies")
|
//.extra_arg("no-early-report-zombies")
|
||||||
.extra_arg("no-infer-storage-classes")
|
//.extra_arg("no-infer-storage-classes")
|
||||||
.extra_arg("spirt-passes=qptr")
|
//.extra_arg("spirt-passes=qptr,reduce")
|
||||||
|
.extra_arg("spirt-passes=reduce")
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|||||||
@@ -654,10 +654,13 @@ impl NodeNetwork {
|
|||||||
|
|
||||||
/// Recursively dissolve non-primitive document nodes and return a single flattened network of nodes.
|
/// Recursively dissolve non-primitive document nodes and return a single flattened network of nodes.
|
||||||
pub fn flatten_with_fns(&mut self, node: NodeId, map_ids: impl Fn(NodeId, NodeId) -> NodeId + Copy, gen_id: impl Fn() -> NodeId + Copy) {
|
pub fn flatten_with_fns(&mut self, node: NodeId, map_ids: impl Fn(NodeId, NodeId) -> NodeId + Copy, gen_id: impl Fn() -> NodeId + Copy) {
|
||||||
let (id, mut node) = self
|
self.resolve_extract_nodes();
|
||||||
|
let Some((id, mut node)) = self
|
||||||
.nodes
|
.nodes
|
||||||
.remove_entry(&node)
|
.remove_entry(&node) else {
|
||||||
.unwrap_or_else(|| panic!("The node which was supposed to be flattened does not exist in the network, id {} network {:#?}", node, self));
|
warn!("The node which was supposed to be flattened does not exist in the network, id {} network {:#?}", node, self);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
if self.disabled.contains(&id) {
|
if self.disabled.contains(&id) {
|
||||||
node.implementation = DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into());
|
node.implementation = DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into());
|
||||||
@@ -665,7 +668,7 @@ impl NodeNetwork {
|
|||||||
self.nodes.insert(id, node);
|
self.nodes.insert(id, node);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log::debug!("Flattening node {:?}", &node);
|
log::debug!("Flattening node {:?}", &node.name);
|
||||||
|
|
||||||
// replace value inputs with value nodes
|
// replace value inputs with value nodes
|
||||||
for input in &mut node.inputs {
|
for input in &mut node.inputs {
|
||||||
@@ -846,7 +849,10 @@ impl NodeNetwork {
|
|||||||
let mut input_node = self.nodes.remove(&node_id).unwrap();
|
let mut input_node = self.nodes.remove(&node_id).unwrap();
|
||||||
node.implementation = DocumentNodeImplementation::Unresolved("graphene_core::value::ClonedNode".into());
|
node.implementation = DocumentNodeImplementation::Unresolved("graphene_core::value::ClonedNode".into());
|
||||||
if let Some(input) = input_node.inputs.get_mut(0) {
|
if let Some(input) = input_node.inputs.get_mut(0) {
|
||||||
*input = NodeInput::Network(input.ty());
|
*input = match &input {
|
||||||
|
NodeInput::Node { .. } => NodeInput::Network(generic!(T)),
|
||||||
|
ni => NodeInput::Network(ni.ty()),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
for input in input_node.inputs.iter_mut() {
|
for input in input_node.inputs.iter_mut() {
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ pub struct Compiler {}
|
|||||||
|
|
||||||
impl Compiler {
|
impl Compiler {
|
||||||
pub fn compile(&self, mut network: NodeNetwork, resolve_inputs: bool) -> impl Iterator<Item = ProtoNetwork> {
|
pub fn compile(&self, mut network: NodeNetwork, resolve_inputs: bool) -> impl Iterator<Item = ProtoNetwork> {
|
||||||
let node_ids = network.nodes.keys().copied().collect::<Vec<_>>();
|
|
||||||
println!("flattening");
|
println!("flattening");
|
||||||
network.resolve_extract_nodes();
|
let node_ids = network.nodes.keys().copied().collect::<Vec<_>>();
|
||||||
for id in node_ids {
|
for id in node_ids {
|
||||||
network.flatten(id);
|
network.flatten(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ impl Hash for ConstructionArgs {
|
|||||||
impl ConstructionArgs {
|
impl ConstructionArgs {
|
||||||
pub fn new_function_args(&self) -> Vec<String> {
|
pub fn new_function_args(&self) -> Vec<String> {
|
||||||
match self {
|
match self {
|
||||||
ConstructionArgs::Nodes(nodes) => nodes.iter().map(|n| format!("&n{}", n.0)).collect(),
|
ConstructionArgs::Nodes(nodes) => nodes.iter().map(|n| format!("n{:0x}", n.0)).collect(),
|
||||||
ConstructionArgs::Value(value) => vec![value.to_primitive_string()],
|
ConstructionArgs::Value(value) => vec![value.to_primitive_string()],
|
||||||
ConstructionArgs::Inline(inline) => vec![inline.expr.clone()],
|
ConstructionArgs::Inline(inline) => vec![inline.expr.clone()],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ default = ["wgpu"]
|
|||||||
wgpu = ["wgpu-executor", "gpu", "graphene-std/wgpu"]
|
wgpu = ["wgpu-executor", "gpu", "graphene-std/wgpu"]
|
||||||
wayland = ["graphene-std/wayland"]
|
wayland = ["graphene-std/wayland"]
|
||||||
profiling = ["wgpu-executor/profiling"]
|
profiling = ["wgpu-executor/profiling"]
|
||||||
|
passthrough = ["wgpu-executor/passthrough"]
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -601,7 +601,7 @@
|
|||||||
{
|
{
|
||||||
"Value": {
|
"Value": {
|
||||||
"tagged_value": {
|
"tagged_value": {
|
||||||
"F64": 0.0
|
"F32": 0.0
|
||||||
},
|
},
|
||||||
"exposed": false
|
"exposed": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,10 +191,10 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: &u32, params: [u32]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: &u32, params: [u32]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: u32, params: [&u32]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: u32, params: [&u32]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: &u32, params: [&u32]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: &u32, params: [&u32]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: f64, params: [f64]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: f32, params: [f32]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: &f64, params: [f64]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: &f32, params: [f32]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: f64, params: [&f64]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: f32, params: [&f32]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: &f64, params: [&f64]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: &f32, params: [&f32]),
|
||||||
register_node!(graphene_core::ops::SomeNode, input: WasmEditorApi, params: []),
|
register_node!(graphene_core::ops::SomeNode, input: WasmEditorApi, params: []),
|
||||||
async_node!(graphene_core::ops::IntoNode<_, ImageFrame<SRGBA8>>, input: ImageFrame<Color>, output: ImageFrame<SRGBA8>, params: []),
|
async_node!(graphene_core::ops::IntoNode<_, ImageFrame<SRGBA8>>, input: ImageFrame<Color>, output: ImageFrame<SRGBA8>, params: []),
|
||||||
async_node!(graphene_core::ops::IntoNode<_, ImageFrame<Color>>, input: ImageFrame<SRGBA8>, output: ImageFrame<Color>, params: []),
|
async_node!(graphene_core::ops::IntoNode<_, ImageFrame<Color>>, input: ImageFrame<SRGBA8>, output: ImageFrame<Color>, params: []),
|
||||||
@@ -355,7 +355,7 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
raster_node!(graphene_core::raster::ExtractChannelNode<_>, params: [RedGreenBlue]),
|
raster_node!(graphene_core::raster::ExtractChannelNode<_>, params: [RedGreenBlue]),
|
||||||
raster_node!(graphene_core::raster::ExtractAlphaNode<>, params: []),
|
raster_node!(graphene_core::raster::ExtractAlphaNode<>, params: []),
|
||||||
raster_node!(graphene_core::raster::ExtractOpaqueNode<>, params: []),
|
raster_node!(graphene_core::raster::ExtractOpaqueNode<>, params: []),
|
||||||
raster_node!(graphene_core::raster::LevelsNode<_, _, _, _, _>, params: [f64, f64, f64, f64, f64]),
|
raster_node!(graphene_core::raster::LevelsNode<_, _, _, _, _>, params: [f32, f32, f32, f32, f32]),
|
||||||
register_node!(graphene_std::image_segmentation::ImageSegmentationNode<_>, input: ImageFrame<Color>, params: [ImageFrame<Color>]),
|
register_node!(graphene_std::image_segmentation::ImageSegmentationNode<_>, input: ImageFrame<Color>, params: [ImageFrame<Color>]),
|
||||||
register_node!(graphene_core::raster::IndexNode<_>, input: Vec<ImageFrame<Color>>, params: [u32]),
|
register_node!(graphene_core::raster::IndexNode<_>, input: Vec<ImageFrame<Color>>, params: [u32]),
|
||||||
vec![(
|
vec![(
|
||||||
@@ -364,7 +364,7 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let image: DowncastBothNode<(), ImageFrame<Color>> = DowncastBothNode::new(args[0].clone());
|
let image: DowncastBothNode<(), ImageFrame<Color>> = DowncastBothNode::new(args[0].clone());
|
||||||
let blend_mode: DowncastBothNode<(), BlendMode> = DowncastBothNode::new(args[1].clone());
|
let blend_mode: DowncastBothNode<(), BlendMode> = DowncastBothNode::new(args[1].clone());
|
||||||
let opacity: DowncastBothNode<(), f64> = DowncastBothNode::new(args[2].clone());
|
let opacity: DowncastBothNode<(), f32> = DowncastBothNode::new(args[2].clone());
|
||||||
let blend_node = graphene_core::raster::BlendNode::new(CopiedNode::new(blend_mode.eval(()).await), CopiedNode::new(opacity.eval(()).await));
|
let blend_node = graphene_core::raster::BlendNode::new(CopiedNode::new(blend_mode.eval(()).await), CopiedNode::new(opacity.eval(()).await));
|
||||||
let node = graphene_std::raster::BlendImageNode::new(image, blend_node);
|
let node = graphene_std::raster::BlendImageNode::new(image, blend_node);
|
||||||
let any: DynAnyNode<ImageFrame<Color>, _, _> = graphene_std::any::DynAnyNode::new(node);
|
let any: DynAnyNode<ImageFrame<Color>, _, _> = graphene_std::any::DynAnyNode::new(node);
|
||||||
@@ -374,21 +374,21 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
NodeIOTypes::new(
|
NodeIOTypes::new(
|
||||||
concrete!(ImageFrame<Color>),
|
concrete!(ImageFrame<Color>),
|
||||||
concrete!(ImageFrame<Color>),
|
concrete!(ImageFrame<Color>),
|
||||||
vec![fn_type!(ImageFrame<Color>), fn_type!(BlendMode), fn_type!(f64)],
|
vec![fn_type!(ImageFrame<Color>), fn_type!(BlendMode), fn_type!(f32)],
|
||||||
),
|
),
|
||||||
)],
|
)],
|
||||||
raster_node!(graphene_core::raster::GrayscaleNode<_, _, _, _, _, _, _>, params: [Color, f64, f64, f64, f64, f64, f64]),
|
raster_node!(graphene_core::raster::GrayscaleNode<_, _, _, _, _, _, _>, params: [Color, f32, f32, f32, f32, f32, f32]),
|
||||||
raster_node!(graphene_core::raster::HueSaturationNode<_, _, _>, params: [f64, f64, f64]),
|
raster_node!(graphene_core::raster::HueSaturationNode<_, _, _>, params: [f32, f32, f32]),
|
||||||
raster_node!(graphene_core::raster::InvertRGBNode, params: []),
|
raster_node!(graphene_core::raster::InvertRGBNode, params: []),
|
||||||
raster_node!(graphene_core::raster::ThresholdNode<_, _, _>, params: [f64, f64, LuminanceCalculation]),
|
raster_node!(graphene_core::raster::ThresholdNode<_, _, _>, params: [f32, f32, LuminanceCalculation]),
|
||||||
raster_node!(graphene_core::raster::VibranceNode<_>, params: [f64]),
|
raster_node!(graphene_core::raster::VibranceNode<_>, params: [f32]),
|
||||||
raster_node!(
|
raster_node!(
|
||||||
graphene_core::raster::ChannelMixerNode<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _>,
|
graphene_core::raster::ChannelMixerNode<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _>,
|
||||||
params: [bool, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64]
|
params: [bool, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32]
|
||||||
),
|
),
|
||||||
raster_node!(
|
raster_node!(
|
||||||
graphene_core::raster::SelectiveColorNode<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _>,
|
graphene_core::raster::SelectiveColorNode<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _>,
|
||||||
params: [RelativeAbsolute, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64]
|
params: [RelativeAbsolute, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32]
|
||||||
),
|
),
|
||||||
vec![(
|
vec![(
|
||||||
NodeIdentifier::new("graphene_core::raster::BrightnessContrastNode<_, _, _>"),
|
NodeIdentifier::new("graphene_core::raster::BrightnessContrastNode<_, _, _>"),
|
||||||
@@ -396,9 +396,9 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
use graphene_core::raster::brightness_contrast::*;
|
use graphene_core::raster::brightness_contrast::*;
|
||||||
|
|
||||||
let brightness: DowncastBothNode<(), f64> = DowncastBothNode::new(args[0].clone());
|
let brightness: DowncastBothNode<(), f32> = DowncastBothNode::new(args[0].clone());
|
||||||
let brightness = ClonedNode::new(brightness.eval(()).await as f32);
|
let brightness = ClonedNode::new(brightness.eval(()).await as f32);
|
||||||
let contrast: DowncastBothNode<(), f64> = DowncastBothNode::new(args[1].clone());
|
let contrast: DowncastBothNode<(), f32> = DowncastBothNode::new(args[1].clone());
|
||||||
let contrast = ClonedNode::new(contrast.eval(()).await as f32);
|
let contrast = ClonedNode::new(contrast.eval(()).await as f32);
|
||||||
let use_legacy: DowncastBothNode<(), bool> = DowncastBothNode::new(args[2].clone());
|
let use_legacy: DowncastBothNode<(), bool> = DowncastBothNode::new(args[2].clone());
|
||||||
|
|
||||||
@@ -417,11 +417,11 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
NodeIOTypes::new(concrete!(ImageFrame<Color>), concrete!(ImageFrame<Color>), vec![fn_type!(f64), fn_type!(f64), fn_type!(bool)]),
|
NodeIOTypes::new(concrete!(ImageFrame<Color>), concrete!(ImageFrame<Color>), vec![fn_type!(f32), fn_type!(f32), fn_type!(bool)]),
|
||||||
)],
|
)],
|
||||||
raster_node!(graphene_core::raster::OpacityNode<_>, params: [f64]),
|
raster_node!(graphene_core::raster::OpacityNode<_>, params: [f32]),
|
||||||
raster_node!(graphene_core::raster::PosterizeNode<_>, params: [f64]),
|
raster_node!(graphene_core::raster::PosterizeNode<_>, params: [f32]),
|
||||||
raster_node!(graphene_core::raster::ExposureNode<_, _, _>, params: [f64, f64, f64]),
|
raster_node!(graphene_core::raster::ExposureNode<_, _, _>, params: [f32, f32, f32]),
|
||||||
register_node!(graphene_core::memo::LetNode<_>, input: Option<ImageFrame<Color>>, params: []),
|
register_node!(graphene_core::memo::LetNode<_>, input: Option<ImageFrame<Color>>, params: []),
|
||||||
register_node!(graphene_core::memo::LetNode<_>, input: Option<WasmEditorApi>, params: []),
|
register_node!(graphene_core::memo::LetNode<_>, input: Option<WasmEditorApi>, params: []),
|
||||||
async_node!(graphene_core::memo::EndLetNode<_>, input: WasmEditorApi, output: ImageFrame<Color>, params: [ImageFrame<Color>]),
|
async_node!(graphene_core::memo::EndLetNode<_>, input: WasmEditorApi, output: ImageFrame<Color>, params: [ImageFrame<Color>]),
|
||||||
@@ -479,18 +479,18 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
vec![
|
vec![
|
||||||
fn_type!(WasmEditorApi),
|
fn_type!(WasmEditorApi),
|
||||||
fn_type!(ImaginateController),
|
fn_type!(ImaginateController),
|
||||||
fn_type!(f64),
|
fn_type!(f32),
|
||||||
fn_type!(Option<DVec2>),
|
fn_type!(Option<DVec2>),
|
||||||
fn_type!(u32),
|
fn_type!(u32),
|
||||||
fn_type!(ImaginateSamplingMethod),
|
fn_type!(ImaginateSamplingMethod),
|
||||||
fn_type!(f64),
|
fn_type!(f32),
|
||||||
fn_type!(String),
|
fn_type!(String),
|
||||||
fn_type!(String),
|
fn_type!(String),
|
||||||
fn_type!(bool),
|
fn_type!(bool),
|
||||||
fn_type!(f64),
|
fn_type!(f32),
|
||||||
fn_type!(Option<Vec<u64>>),
|
fn_type!(Option<Vec<u64>>),
|
||||||
fn_type!(bool),
|
fn_type!(bool),
|
||||||
fn_type!(f64),
|
fn_type!(f32),
|
||||||
fn_type!(ImaginateMaskStartingFill),
|
fn_type!(ImaginateMaskStartingFill),
|
||||||
fn_type!(bool),
|
fn_type!(bool),
|
||||||
fn_type!(bool),
|
fn_type!(bool),
|
||||||
@@ -516,22 +516,22 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
raster_node!(graphene_core::quantization::QuantizeNode<_>, params: [QuantizationChannels]),
|
raster_node!(graphene_core::quantization::QuantizeNode<_>, params: [QuantizationChannels]),
|
||||||
raster_node!(graphene_core::quantization::DeQuantizeNode<_>, params: [QuantizationChannels]),
|
raster_node!(graphene_core::quantization::DeQuantizeNode<_>, params: [QuantizationChannels]),
|
||||||
register_node!(graphene_core::ops::CloneNode<_>, input: &QuantizationChannels, params: []),
|
register_node!(graphene_core::ops::CloneNode<_>, input: &QuantizationChannels, params: []),
|
||||||
register_node!(graphene_core::transform::TransformNode<_, _, _, _, _>, input: VectorData, params: [DVec2, f64, DVec2, DVec2, DVec2]),
|
register_node!(graphene_core::transform::TransformNode<_, _, _, _, _>, input: VectorData, params: [DVec2, f32, DVec2, DVec2, DVec2]),
|
||||||
register_node!(graphene_core::transform::TransformNode<_, _, _, _, _>, input: ImageFrame<Color>, params: [DVec2, f64, DVec2, DVec2, DVec2]),
|
register_node!(graphene_core::transform::TransformNode<_, _, _, _, _>, input: ImageFrame<Color>, params: [DVec2, f32, DVec2, DVec2, DVec2]),
|
||||||
register_node!(graphene_core::transform::TransformNode<_, _, _, _, _>, input: WasmSurfaceHandleFrame, params: [DVec2, f64, DVec2, DVec2, DVec2]),
|
register_node!(graphene_core::transform::TransformNode<_, _, _, _, _>, input: WasmSurfaceHandleFrame, params: [DVec2, f32, DVec2, DVec2, DVec2]),
|
||||||
register_node!(graphene_core::transform::SetTransformNode<_>, input: VectorData, params: [VectorData]),
|
register_node!(graphene_core::transform::SetTransformNode<_>, input: VectorData, params: [VectorData]),
|
||||||
register_node!(graphene_core::transform::SetTransformNode<_>, input: ImageFrame<Color>, params: [ImageFrame<Color>]),
|
register_node!(graphene_core::transform::SetTransformNode<_>, input: ImageFrame<Color>, params: [ImageFrame<Color>]),
|
||||||
register_node!(graphene_core::transform::SetTransformNode<_>, input: VectorData, params: [DAffine2]),
|
register_node!(graphene_core::transform::SetTransformNode<_>, input: VectorData, params: [DAffine2]),
|
||||||
register_node!(graphene_core::transform::SetTransformNode<_>, input: ImageFrame<Color>, params: [DAffine2]),
|
register_node!(graphene_core::transform::SetTransformNode<_>, input: ImageFrame<Color>, params: [DAffine2]),
|
||||||
register_node!(graphene_core::vector::SetFillNode<_, _, _, _, _, _, _>, input: VectorData, params: [graphene_core::vector::style::FillType, Option<graphene_core::Color>, graphene_core::vector::style::GradientType, DVec2, DVec2, DAffine2, Vec<(f64, Option<graphene_core::Color>)>]),
|
register_node!(graphene_core::vector::SetFillNode<_, _, _, _, _, _, _>, input: VectorData, params: [graphene_core::vector::style::FillType, Option<graphene_core::Color>, graphene_core::vector::style::GradientType, DVec2, DVec2, DAffine2, Vec<(f64, Option<graphene_core::Color>)>]),
|
||||||
register_node!(graphene_core::vector::SetStrokeNode<_, _, _, _, _, _, _>, input: VectorData, params: [Option<graphene_core::Color>, f64, Vec<f32>, f64, graphene_core::vector::style::LineCap, graphene_core::vector::style::LineJoin, f64]),
|
register_node!(graphene_core::vector::SetStrokeNode<_, _, _, _, _, _, _>, input: VectorData, params: [Option<graphene_core::Color>, f32, Vec<f32>, f32, graphene_core::vector::style::LineCap, graphene_core::vector::style::LineJoin, f32]),
|
||||||
register_node!(graphene_core::vector::generator_nodes::UnitCircleGenerator, input: (), params: []),
|
register_node!(graphene_core::vector::generator_nodes::UnitCircleGenerator, input: (), params: []),
|
||||||
register_node!(
|
register_node!(
|
||||||
graphene_core::vector::generator_nodes::PathGenerator<_>,
|
graphene_core::vector::generator_nodes::PathGenerator<_>,
|
||||||
input: Vec<graphene_core::vector::bezier_rs::Subpath<graphene_core::uuid::ManipulatorGroupId>>,
|
input: Vec<graphene_core::vector::bezier_rs::Subpath<graphene_core::uuid::ManipulatorGroupId>>,
|
||||||
params: [Vec<graphene_core::uuid::ManipulatorGroupId>]
|
params: [Vec<graphene_core::uuid::ManipulatorGroupId>]
|
||||||
),
|
),
|
||||||
register_node!(graphene_core::text::TextGenerator<_, _, _>, input: WasmEditorApi, params: [String, graphene_core::text::Font, f64]),
|
register_node!(graphene_core::text::TextGenerator<_, _, _>, input: WasmEditorApi, params: [String, graphene_core::text::Font, f32]),
|
||||||
register_node!(graphene_std::brush::VectorPointsNode, input: VectorData, params: []),
|
register_node!(graphene_std::brush::VectorPointsNode, input: VectorData, params: []),
|
||||||
register_node!(graphene_core::ExtractImageFrame, input: WasmEditorApi, params: []),
|
register_node!(graphene_core::ExtractImageFrame, input: WasmEditorApi, params: []),
|
||||||
register_node!(graphene_core::ConstructLayerNode<_, _, _, _, _, _, _>, input: graphene_core::vector::VectorData, params: [String, BlendMode, f32, bool, bool, bool, graphene_core::GraphicGroup]),
|
register_node!(graphene_core::ConstructLayerNode<_, _, _, _, _, _, _>, input: graphene_core::vector::VectorData, params: [String, BlendMode, f32, bool, bool, bool, graphene_core::GraphicGroup]),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ license = "MIT OR Apache-2.0"
|
|||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
profiling = ["nvtx"]
|
profiling = ["nvtx"]
|
||||||
|
passthrough = []
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|||||||
@@ -19,17 +19,16 @@ impl Context {
|
|||||||
// `request_adapter` instantiates the general connection to the GPU
|
// `request_adapter` instantiates the general connection to the GPU
|
||||||
let adapter = instance.request_adapter(&wgpu::RequestAdapterOptions::default()).await?;
|
let adapter = instance.request_adapter(&wgpu::RequestAdapterOptions::default()).await?;
|
||||||
|
|
||||||
//let limits = adapter.limits();
|
|
||||||
|
|
||||||
//log::trace!("Adapter limits: {:?}", limits);
|
|
||||||
|
|
||||||
// `request_device` instantiates the feature specific connection to the GPU, defining some parameters,
|
// `request_device` instantiates the feature specific connection to the GPU, defining some parameters,
|
||||||
// `features` being the available features.
|
// `features` being the available features.
|
||||||
let (device, queue) = adapter
|
let (device, queue) = adapter
|
||||||
.request_device(
|
.request_device(
|
||||||
&wgpu::DeviceDescriptor {
|
&wgpu::DeviceDescriptor {
|
||||||
label: None,
|
label: None,
|
||||||
|
#[cfg(not(feature = "passthrough"))]
|
||||||
features: wgpu::Features::empty(),
|
features: wgpu::Features::empty(),
|
||||||
|
#[cfg(feature = "passthrough")]
|
||||||
|
features: wgpu::Features::SPIRV_SHADER_PASSTHROUGH,
|
||||||
limits: Default::default(),
|
limits: Default::default(),
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
|
|||||||
@@ -118,10 +118,18 @@ impl gpu_executor::GpuExecutor for WgpuExecutor {
|
|||||||
type Window = Arc<winit::window::Window>;
|
type Window = Arc<winit::window::Window>;
|
||||||
|
|
||||||
fn load_shader(&self, shader: Shader) -> Result<Self::ShaderHandle> {
|
fn load_shader(&self, shader: Shader) -> Result<Self::ShaderHandle> {
|
||||||
|
#[cfg(not(feature = "passthrough"))]
|
||||||
let shader_module = self.context.device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
let shader_module = self.context.device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
||||||
label: Some(shader.name),
|
label: Some(shader.name),
|
||||||
source: wgpu::ShaderSource::SpirV(shader.source),
|
source: wgpu::ShaderSource::SpirV(shader.source),
|
||||||
});
|
});
|
||||||
|
#[cfg(feature = "passthrough")]
|
||||||
|
let shader_module = unsafe {
|
||||||
|
self.context.device.create_shader_module_spirv(&wgpu::ShaderModuleDescriptorSpirV {
|
||||||
|
label: Some(shader.name),
|
||||||
|
source: shader.source,
|
||||||
|
})
|
||||||
|
};
|
||||||
Ok(ShaderModuleWrapper(shader_module))
|
Ok(ShaderModuleWrapper(shader_module))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user