Basic restoration of magnetic lasso tool.
Changes PlannedPublic

Authored by abrahams on Aug 11 2015, 1:05 PM.

Details

Reviewers
dkazakov
rempt
Maniphest Tasks
T556: Magnetic lasso tool
Summary

This is ripe ground for some fun algorithm design. The current lasso tool uses a basic edge detection algorithm which is fairly easy to understand, but the results are poor.

The tool needs a new icon, a new GUI, and many other additions.

Diff Detail

Repository
R8 Calligra
Branch
magnetic
Lint
No Linters Available
Unit
No Unit Test Coverage
abrahams updated this revision to Diff 542.Aug 11 2015, 1:05 PM
abrahams retitled this revision from to Basic restoration of magnetic lasso tool..
abrahams updated this object.
abrahams edited the test plan for this revision. (Show Details)
abrahams added reviewers: dkazakov, rempt.
abrahams updated this object.Aug 11 2015, 1:05 PM
abrahams updated this object.
abrahams added a project: Krita: Stable.
abrahams updated this object.Aug 11 2015, 1:48 PM
rempt edited edge metadata.EditedAug 11 2015, 1:55 PM

Cool! Did you take a look at the old, 1.6 era algorithm? I'm not sure how good that was, though! I'm sure there are way better algorithms now :-) (Ah, I see it is :-))

rempt added a comment.Aug 11 2015, 1:57 PM

This is against 2.9, right?

abrahams updated this revision to Diff 545.Aug 12 2015, 12:35 PM
abrahams edited edge metadata.

Switch to GSL

abrahams updated this revision to Diff 546.Aug 12 2015, 12:37 PM

Rebase against 2.9

Hi Boudewijn: I didn't look at any previous algorithm. My starting point was reverting a patch from early 2014 or so, but didn't dig deeper.

This is against Calligra 2.9 and it should be good to go out of the box! The algorithm itself still needs a lot of work on many dimensions, but you can lasso things reasonably with a little patience.

Nice work :-)

Thank you! And for your nice comment in the build on windows task.

dkazakov edited edge metadata.Aug 21 2015, 12:20 PM

Hi, Michael!

I added a comment about icons. The rest looks fine to commit. But I guess we should wait until 2.9.7 release is branched on 29th of August

krita/plugins/tools/selectiontools/kis_tool_select_magnetic.h
166

Here instead of koIconNameCStr("tool_magnetic_selection"), please use KisIconUtils::loadIcon("<icon_name>"). See [0] for more info.

If will also allow you to avoid duplicating icons in the selectiontools/ directly and int pics/tools/16. I guess only one copy of the icons should be kept :)

[0] - https://community.kde.org/Krita/docs/Icons_API_Roadmap

abrahams added a comment.EditedAug 21 2015, 12:58 PM

Thanks for looking it over! I'll make the change. Do you think the alterations you linked to should be done in a script?

Right now I think the tool needs a lot more work before it's ready to expose to users so I might be holding off for more than another 8 days. One of the things on the to-do list I could use some advice.

The tool uses an edge-detection filter to determine where the lasso should be attracted by calling a function in real time. Since we look at the same points over and over again, it seems more efficient if we pre-cache the edge when the tool is activated, save it in a new buffer, then access the new buffer when we're using the tool. (Factoring out a black box giving the tool edge data also makes for a cleaner interface if we want to swap in a more advanced algorithm.) What classes would I want to look into for doing that? Or can you point me to an example of something similar elsewhere in the codebase?

Hi, Michael!

We have an KisOutlineGenerator class that performs all the outline generation for brushes and selections. You can see an example of usage in KisPixelSelection::outline().

If you like to do the calculation of the outline in a stroke you can use the stroke strategy. An example is in KisToolTransform::startStroke()->TransformStrokeStrategy::previewDevice(). I'm not sure if you really need this.

And I don't know if the icons change can be performed with a script :) If someone writes it, then, probably, yes. Right now it is a policy for a new code.

abrahams updated this revision to Diff 691.Sep 2 2015, 1:15 AM
abrahams edited edge metadata.

Rebase against master

Maybe it would be handy to push this to master so it gets updated whenever something else needs updating?

I think I mentioned this a few times on IRC but forgot to write it down here: I am holding off on this until the Lazy Brush is finished, since the methods used in that tool will be very useful for implementing a new magnetic lasso.

abrahams planned changes to this revision.Feb 11 2016, 7:38 AM