-
-
Notifications
You must be signed in to change notification settings - Fork 576
Allow the Fill tool to flood fill raster images #2519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
aa7ff13
to
e11b57a
Compare
Please fix the CI failure on the test |
*self = Self { fills, start_pos, tolerance }; | ||
} | ||
|
||
// TODO: Why do we overwrite the tolerance that we just set a couple lines above? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fills: Vec<F>, | ||
/// The starting positions of the flood fill points in the layer's local coordinates. | ||
positions: Vec<DVec2>, | ||
// TODO: What is the range? I'd expect 0-255, but we should also rescale that to 0-1. But this crashes at larger values approaching 100. And tolerance should be per-position not global to the node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tolerance is calculated by the euclidean distance in the CIELAB colorspace, which is a perspecively correct way of measuring color difference. Although value of A and B is autually boundaryless, softwares usually use -128 to 128, and the L has a range of 0 to 100. I will look into it and fix the bugs that cause the crash.
@@ -71,37 +76,111 @@ enum FillToolFsmState { | |||
Filling, | |||
} | |||
|
|||
#[derive(Clone, Debug, Default)] | |||
struct FillToolData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to set the tolerance in the tool's control bar. It should range from 0 (only the identically colored pixels) to 1 (all pixels regardless of color). We should also have a checkbox for contiguous.
struct FillToolData { | ||
fills: Vec<Fill>, | ||
start_pos: Vec<DVec2>, | ||
tolerance: f64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tolerance: f64, | |
tolerance: Vec<f64>, |
Checking in @EllenGYY. |
@Keavon As the semester is approaching its final weeks and I have several project / research deadlines, I’ll revisit and improve this function’s behavior after my finals on May 1st. |
Sounds good, thank you for the update. |
• Adds a “Raster Fill” node when the fill bucket tool is used on a raster layer.
• Non-destructive: deleting the node restores the image to its original state.
• Users can adjust the “tolerance” of color similarity, based on Euclidean distance in LAB color space (currently per-layer only).
Possible improvements:
• Allow users to adjust and delete individual fill operations on the same layer, including their respective tolerance settings.
• Add support for gradient fills.