The initial implementation of the Colorize Mask functionality
ClosedPublic

Authored by dkazakov on Aug 11 2016, 7:53 AM.

Details

Reviewers
scottpetrovic
rempt
Group Reviewers
Krita
Maniphest Tasks
Restricted Maniphest Task
Summary

At the moment you can paint on it with a usual brush, then click
on the "Update" property and see the filling result. A lot of things are
still to be done:

  1. There should be a switch between "b/w mode" and "alpha mode"
  2. The eraser button doesn't work when the mask is active (though you can paint with the Erase composite op and remove the keystrokes this way)
  3. The user should be able to activate/configure prefiltering of the image
  4. The filtered image should be cached using some solution with timestamps
  5. There should be automatic mode: the mask updates automatically every time you change the original layer (the same timestamps)
  6. New icons needed:
    • Update (needs rename?)
    • Show Coloring
    • Show Key Strokes
    • Icon for the mask itself (and its action)
  7. The filling is extremely slow. Right now the multicut algorithm doesn't have the fast paths for recognizing disjoint areas without doing min-cut.
  8. At the moment you cannot color-pick from the mask. To implement that you should write the merged keystrokes projection into fakePaintDevice. (btw, it will simplify decorateRect() significantly!)

Ref T372

Test Plan

Here is a small video showing how to work with the new unfinished functionality. Please tell your comments if you think I'm doing something really wrong :)

Diff Detail

Repository
R37 Krita
Branch
krita-lazybrush-kazakov
Lint
No Linters Available
Unit
No Unit Test Coverage
dkazakov updated this revision to Diff 5820.Aug 11 2016, 7:53 AM
dkazakov retitled this revision from to The initial implementation of the Colorize Mask functionality.
dkazakov updated this object.
dkazakov added a task: Restricted Maniphest Task.
dkazakov edited the test plan for this revision. (Show Details)Aug 11 2016, 7:56 AM
dkazakov added reviewers: Krita, scottpetrovic, rempt.
dkazakov added a project: Krita.
dkazakov edited the test plan for this revision. (Show Details)

A few comments:

-rename "show coloring" to "update result"

-mask-editing (painting color marks) should be locked when color marks are not visible

-it's a bit weird that the lock-alpha button is enabled by default, and kinda disables the mask when un-checked.
would it make sense to not show it at all?

Really too slow:
-while it computes the result, krita doesn't respond/redraw anymore until it's ready. would be better if we had a notification or something like that.
-I see it uses only one thread, multi-thread is really not possible?

also: icons are coming ;)

sorry I got confused in my last comment, because icons order is not the same as in the tooltip...
so:
(-rename "show coloring" to "update result")
-rename "update" to "update result"

(-it's a bit weird that the lock-alpha button is enabled by default, and kinda disables the mask when un-checked.
would it make sense to not show it at all?)
-That is the show coloring icon, of course.. (I got confused as with marks hidden too, nothing is visible..)

There is some fancy code in here, so my feedback only relates to using it.

I tested out the branch and it seems to work pretty well as-is. It took me a bit of time to realize you can use the tool without even opening the tool options. You can do everything with only the layer properties. Pretty nice. A couple things that might make it work a little better.

  1. If you have the lazy brush tool selected and start painting on the canvas, create a colorize mask layer and start using that if it doesn't exist.
  2. The processing seems to take a bit of time. There probably needs to be a progress indicator/busy icon that Krita is working on it.

Looks great though. Good job Dmitry!

dkazakov updated this revision to Diff 6554.Sep 8 2016, 2:55 PM
dkazakov edited edge metadata.

Final implementation of the Colorize Mask functionality

  • Make the filling opaque when the key strokes are hidden
  • new icons for colorize mask
  • Connect icons by Timethee Giet :)
  • Don't allow painting on a mask when keystrokes are not visible
  • Update the united area when toggling colorize mask properties
  • more icons for colorize mask
  • Let the user erase the Key Strokes on a Colorize Mask
  • Let the user Color Pick from a Colorize Mask using Ctrl+Alt+Click
  • Connect new icons by Timothee Giet :)
  • Implement a skeleton for the lazy brush tool
  • Implement the first kind of working version of Lazy Brush tool!
  • Fix crash due to colorspace conflict
  • Sequence numbers for paint devices and cache filtered source in Colorize Mask
  • Disable isolate mode for Colorize Masks
  • Implement automatic creation/selection of Colorize Mask
  • Move Colorize Mask regeneration into a stroke
  • Rename "Show key strokes" into "Edit key strokes"
  • Implement correct Flatten Layer for layers having colorize masks
  • Implement Convert->to Paint Layer for Colorize Mask
  • Implement colorSpace() and offset() properties of the Colorize Mask
  • Implement KisProcessingVisitor interface for colorize masks
  • Implement loading/saving of Colorize Masks
  • Remove code duplication in KisDomUtils
  • Merge remote-tracking branch 'origin/master' into krita-lazybrush-kazakov

Still not implemented:

  • The speed is still low, so test it on canvases < 1000px in size
  • Soft scribbles don't work yet. That is if your key stroke goes out of the object outline, it will not be inhibited by the other stroke.

Test plan:

Test everything that can get into your head. It shouldn't crash, it
should save into .kra, load from .kra and slowly, but work for filling
your line art :)

Restricted Application added a subscriber: woltherav. · View Herald TranscriptSep 8 2016, 2:55 PM
dkazakov updated this revision to Diff 6555.Sep 8 2016, 2:57 PM

Update relative to a correct branch

sketchstick added a subscriber: sketchstick.EditedSep 8 2016, 5:06 PM

Just tested the krita-lazybrush-kazakov branch:

  1. Key strokes are only visible in 8-bit. When switching to 16-bit or above, I can see the transparent preview of the result but not the stroke itself. http://i.imgur.com/jU1Fxrx.jpg
  2. As a user it took me a while to figure out that my usual smudge brush presets etc. weren't working. Shouldn't we automatically switch to a more appropriate preset when the colorize mask is selected?
  3. I want to use the colorize mask to produce alpha locked paint layers for each colour, what's the most convenient way to do that? Currently all I can find is converting to a paint layer and then using the split layer function, but that destroys the mask in the process.
  4. I tried to work around that but I'm getting rather consistent crashes when duplicating the mask or the parent layer.

I am getting a segfault whenever I try to create a new document. I don't even get to the new window. As soon as I select File > New, this comes up in gdb

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
0x00007ffff242dec3 in KoColor::colorSpace (this=this@entry=0x81730bc)

at /home/scott/kf5/src/krita/libs/pigment/KoColor.cpp:261

261 return d->colorSpace;

Going File > Open works, so there is something specific that the new dialog is requesting that is messing it up.

After working around that crash by opening an image I continued to test. What you have is quite nice. The convert to paint layer seems to be working well. It is really nice that it isn't tied to the linework layer any longer.

@sketchstick - Good points about 1 & 4. I am also getting crashes with duplicating. This feature in general was too big of a scope for a stretch goal, so points 3 & 4 probably won't get done unless they are easy for Dmitry. Doing this work is already weeks over budget. We are kind of concentrating right now on getting a specific workflow going. We really need some good documentation for this. Not following the happy path with this can easily lead to confusion.

dkazakov updated this revision to Diff 6595.Sep 9 2016, 12:53 PM

Fixed all the issues mentioned in the comments

  • Fix crash when trying to duplicate a colorize mask
  • Fix a crash in New Image dialog
  • More cleanups for the color .ui property
  • Fix fill painter to be able to fill a 8bit color on a 16-bit device
  • Correctly initialize color space of the colorize mask
  • Merge remote-tracking branch 'origin/master' into krita-lazybrush-kazakov
dkazakov updated this revision to Diff 6596.Sep 9 2016, 12:53 PM

A correct patch without junk files

The patch has been merged in 94dd517589492850f2c31c3aea8fef2d111ecf27

Please report bugs in T372

rempt accepted this revision.Sep 13 2016, 11:46 AM
rempt edited edge metadata.
This revision is now accepted and ready to land.Sep 13 2016, 11:46 AM
dkazakov closed this revision.Sep 13 2016, 11:46 AM

Can now be officially closed