-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Introduce distort-aware pickers #16534
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
Introduce distort-aware pickers #16534
Conversation
For a box on a color square it's not perfect when doing rotation, for example: This: Becomes (with 8° of rotation in But we cannot do better as the picker area is defined with just 4 points, that's not comparable with the mask's forms which are made of lot of points to allow for full distortion. |
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.
I'll test again tomorrow but this looks good to me.
We could do a full transformation of the bounding rectangle - right now we use only two points, upper left and lower right - using four points for the box and modify dt_color_picker_helper(). A lot of work if we would want to optimize and certainly some (hefty ?) performance penalty. |
With 45 degree rotation you end up with a line (rectangle with zero area) in this example. Transforming four points would help with that. |
Yes - we could stay with the rectangle for dt_color_picker_helper() box but transform all 4 points and thus use the larger box. @TurboGit you want me to do that in this pr? |
Yes please! Thanks. |
The pickers box and point positions are now relative to image input. This allows the pickers to follow all distorting modules like crop, ashift and lens.
1. Getting the picker box is now dt_color_picker_box() in common/colorpicker. 2. dt_color_picker_helper() includes initializing of picker stats.
darkroom static _transform_box() and _backtransform_box might be useful elsewhere so moved to common/color_picker as dt_color_picker_transform_box() and dt_color_picker_backtransform_box()
Instead of transforming only upper-left and lower-right points of the picker coordinates we transform all corner points, sort the coordinates and use average of 2 highest and 2 lowest for the resulting rectangle.
549197a
to
9c761ab
Compare
Done and working much better :-) |
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.
Works for me, thanks!
…ted 45° - grab any corner - change only cursor corner - right+click in live sample to select
…ted 45° - grab any corner - change only cursor corner - right+click in live sample to select
…ted 45° - grab any corner - change only cursor corner - right+click in live sample to select
…ted 45° - grab any corner - change only cursor corner - right+click in live sample to select
Inspired by #14598
Currently all picker coordinates are based on the pixelpipe output.
This pr introduces picker based on input of image data, this allows the picker to follow are distorting modules like crop, ashift or lens.