Implement the Brush tool (#1099)

* Implement Brush Node

* Add color Input

* Add VectorPointsNode

* Add Erase Node

* Adapt compilation infrastructure to allow non Image Frame inputs

* Remove debug output from TransformNode

* Fix transform calculation

* Fix Blending by making the brush texture use associated alpha

* Code improvements and UX polish

* Rename Opacity to Flow

* Add erase option to brush node + fix freehand tool

* Fix crash

* Revert erase implementation

* Fix flattening id calculation

* Fix some transformation issues

* Fix changing the pivot location

* Fix vector data modify bounds

* Minor fn name cleanup

* Fix some tests

* Fix tests

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: hypercube <0hypercube@gmail.com>
This commit is contained in:
Dennis Kobert
2023-04-11 10:35:21 +02:00
committed by Keavon Chambers
parent 758f757775
commit 589ff9a2d3
36 changed files with 1527 additions and 406 deletions

View File

@@ -47,6 +47,7 @@ pub enum TaggedValue {
Quantization(graphene_core::quantization::QuantizationChannels),
OptionalColor(Option<graphene_core::raster::color::Color>),
ManipulatorGroupIds(Vec<graphene_core::uuid::ManipulatorGroupId>),
VecDVec2(Vec<DVec2>),
}
#[allow(clippy::derived_hash_with_manual_eq)]
@@ -104,6 +105,12 @@ impl Hash for TaggedValue {
Self::Quantization(quantized_image) => quantized_image.hash(state),
Self::OptionalColor(color) => color.hash(state),
Self::ManipulatorGroupIds(mirror) => mirror.hash(state),
Self::VecDVec2(vec_dvec2) => {
vec_dvec2.len().hash(state);
for dvec2 in vec_dvec2 {
dvec2.to_array().iter().for_each(|x| x.to_bits().hash(state));
}
}
}
}
}
@@ -145,6 +152,7 @@ impl<'a> TaggedValue {
TaggedValue::Quantization(x) => Box::new(x),
TaggedValue::OptionalColor(x) => Box::new(x),
TaggedValue::ManipulatorGroupIds(x) => Box::new(x),
TaggedValue::VecDVec2(x) => Box::new(x),
}
}
@@ -185,6 +193,7 @@ impl<'a> TaggedValue {
TaggedValue::Quantization(_) => concrete!(graphene_core::quantization::QuantizationChannels),
TaggedValue::OptionalColor(_) => concrete!(Option<graphene_core::Color>),
TaggedValue::ManipulatorGroupIds(_) => concrete!(Vec<graphene_core::uuid::ManipulatorGroupId>),
TaggedValue::VecDVec2(_) => concrete!(Vec<DVec2>),
}
}
}