Continuation of gamut masking effort.
ClosedPublic

Authored by amedonosova on Jul 20 2018, 3:09 PM.

Details

Summary

I have fixed issues from D13525

  • Krita does not crash, if the user tries to save an invalid mask template. Instead, the user is notified and returned to editing, to either fix the error, or cancel the edit.
  • The editing controls are disabled if the user switches to another document.
  • When the artistic color selector loads for the first time, it has correct default values
  • Smaller tweaks and fixes of the code proposed by @dkazakov

There are also new things:

  • There are real gamut masks ready to be used by artists.
  • Gamut masks can be imported and exported in bundles.
  • The UI is simplified, more condensed to save screen space, and hopefully nicer to look at. The mask template and preview icons were updated to better show the mask.
  • The selector can now show numbered gray scale next to the value scale.

Apart from that there are some bugs fixed and better implementations of older features.

I have removed the option to set relative light for the value scale in the selector - it's results seem weird and
unintuitive - and introduced gamma correction for HSY value scale.

I'm also linking to documents where I prepare user documentation. It is really basic and unrefined for now, but it may be handy while testing.

Test Plan

Set the artistic selector to your liking (please share your configuration or a screenshot) and create some art using gamut masking (for more information on the subject: Color Wheel Masking and Shapes of Color Schemes by James Gurney). You can either use a default mask or create a new one. Then please share your experience in the following short questionnaire.

  1. Do you use gamut masking often or uncommonly? Does the implementation support your workflow?
  2. Do the default masks provide a good starting point? Is there some fundamental mask missing? If yes, please provide more details on the missing masks.
  3. Are the dockers easy or difficult to use?
  4. Is the UI clear or did you have trouble finding the right controls? Do the dockers have useful defaults?
  5. What do you like and what could be done better?
  6. Did you encounter any bugs? If so, please describe them.

Diff Detail

Repository
R37 Krita
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
amedonosova created this revision.Jul 20 2018, 3:09 PM
Restricted Application added a reviewer: Krita. · View Herald TranscriptJul 20 2018, 3:09 PM
Restricted Application added a project: Krita. · View Herald Transcript
amedonosova requested review of this revision.Jul 20 2018, 3:09 PM
amedonosova edited the test plan for this revision. (Show Details)Jul 20 2018, 3:14 PM
rempt added a subscriber: rempt.Jul 20 2018, 3:55 PM

Does this need to be applied on top of the other patch, or can it be applied directly?

Does this need to be applied on top of the other patch, or can it be applied directly?

It needs to be applied on top of branch amedonosova/gamut-masking (https://commits.kde.org/krita/dbe05327705fde0b0d6b56451322e4deddc6fc24).

amedonosova edited the summary of this revision. (Show Details)Jul 21 2018, 5:10 AM
amedonosova edited the summary of this revision. (Show Details)
  • ArtColorSel: flips the wheel to match advanced color selector, drops alignment change for swatches
  • code cleanup
rempt added a comment.Jul 25 2018, 6:52 AM

This is looking good! I feel it's getting close to be ready to merge to master.

This is looking good! I feel it's getting close to be ready to merge to master.

Thanks.

I have found two things while painting today:

  • First is a bug: select a color on the wheel -> pick a color from canvas -> select other value on scale => the selector reverts to previously selected color. It should be trivial to fix.
  • Second, I think artists would benefit from having the option to set gamma for the value scale. That should also be easy to add.

I also have a basic prototype of masking for the advanced color selector (in a separate branch), which I created to see whether the implementation really can handle multiple selectors simultaneously. I have found no problems so far. I'm not adding that to this differential, as I would prefer to work on the advanced selector later after my currently submitted work is more stable/thoroughly tested.

  • ArtColorSel: fixes regressions in color selection
  • ArtColorSel: user-defined gamma correction for HSY model

I have fixed the issues with color selection.

I have also added the option to set gamma correction for the value scale (in HSY mode). I'm not entirely sure that the implementation is mathematically correct, although it seems to get it's job done well.

Is there anything else to be done?

rempt added a comment.Jul 30 2018, 3:21 PM

I don't think there's much more left to do! I'm quite impressed. I do want Dmitry to take a look as well, since he's more thorough when it comes to code review than me.

Dmitry is visiting relatives this week, though, so he might not have time immediately.

  • adds missing gpl preambles to new files
amedonosova updated this revision to Diff 39014.EditedAug 3 2018, 2:12 PM

gamutmask: fixes two bugs on cancel

  • template document has a proper autogenerated filename, to avoid collision with other documents, otherwise bugs happen when slotDocumentRemoved is called (e.g. user closes another view, the template stays open, but the edit operation is canceled)
  • properly unsets everything on cancel from both codepaths
amedonosova edited the summary of this revision. (Show Details)Aug 6 2018, 2:01 PM
rempt added a comment.Aug 17 2018, 8:57 AM

I'm wondering -- what's the current status? Should we merge this work to master so people start playing with it?

Good evening,

I have not found any major bugs since my last update, I focused on content for user documentation, which is now complete.

If there are no other problems to fix, I will rebase my code on top of master; the gamut-masking branch is now fairly behind.

As for the merging itself, is there some process or best practice I should follow (including submitting documentation, notifying artists,...)?

dkazakov requested changes to this revision.Aug 20 2018, 11:09 AM

Hi, @amedonosova!

I have tested your patch and it looks (and works) extremely good! :) I have only two small bugs and one wish :)

  1. BUG: Closing the gamut document (with saving) doesn't save the changes to the mask itself
    1. Start editing some mask
    2. Modify something
    3. Press Ctrl+S, Ctrl+W
    4. The mask document is closed, but the gamut mask is not updated/created.
    5. Proposed solution: I guess we should just ask the user if he wants to save the closed document into the mask or not.
  1. BUG: Entering gamut mask editing mode twice discards the changes in the first mask.
    1. Start editing some mask, say, "mask1"
    2. Go to another document, the mask editing GUI gets disabled (which is correct)
    3. Start editing another mask, say, "mask2"
    4. Another mask editing document opens, now you have no way to save your modifications of "mask1" into a real mask. After closing "mask2" document, no editing will be in progress.
    5. Proposed solutions:
      1. Solution1: just disable edit/create mask buttons when the user already edits something.
      2. Solution2: when entering edit mode for the second time, close the previously opened document (asking the user if he would like to save or not)
  1. WISH: It would be really nice to be able to rotate the gamut mask around the center point. Then the user can use the predefined masks (like Complementary or Atmospheric_Triag) without any changes. Just rotate them to cover the needed colors and start painting :)

I thing the two bugs can be considered as blockers. As soon as they are finished, I think we can merge the patch/branch into master. The wish part is optional of course :)

This revision now requires changes to proceed.Aug 20 2018, 11:09 AM
  • remove 'Traditional RYB' gamut mask - incompatible with advanced selector
  • ArtColorSel: adds missing nullptr check
  • gamutmask: UX bugfixes

Good afternoon,

  1. BUG: Closing the gamut document (with saving) doesn't save the changes to the mask itself
    1. Proposed solution: I guess we should just ask the user if he wants to save the closed document into the mask or not.

I have implemented it as you proposed. In addition, the docker is tracking saving of the template document. If the user saves the document and makes no further changes, the docker does not ask again and saves the mask. This avoids a situation with two identical subsequent save dialogs, when you modify the template and then close the view without saving first.

  1. BUG: Entering gamut mask editing mode twice discards the changes in the first mask.
    1. Proposed solutions:
      1. Solution1: just disable edit/create mask buttons when the user already edits something.
      2. Solution2: when entering edit mode for the second time, close the previously opened document (asking the user if he would like to save or not)

Here I have done two things.
1, When a template document is opened, the mask management toolbar is hidden (as proposed in solution 1).
2, When you have a template open and select another mask, the user is asked whether he wants the mask to be saved (if it was previously saved or modified) and then the template is closed and the new mask is selected.

  1. WISH: It would be really nice to be able to rotate the gamut mask around the center point. Then the user can use the predefined masks (like Complementary or Atmospheric_Triag) without any changes. Just rotate them to cover the needed colors and start painting :)

That would be really nice to have, thank you for the feature, I have added it to my list of enhancements. If you don't mind, I would prefer to do it separately in a later revision.

While fixing the above bugs, I have seen a crash in saving the template document which might indicate that I am doing something wrong in my code. It happened three times, not in sequence, possibly due to some race condition. I have since then made some changes to the code and now I am unable to reproduce it. Steps to reproduce:
1, select a mask, click edit
2, modify the template, do not save
3, close the view
4, in the save/cancel dialog choose 'save'
5, krita crashes

I am attaching a backtrace from this crash:

Could you please help me confirm the crash is gone, and if not, find why it happens and how to fix that?

dkazakov accepted this revision.Aug 28 2018, 12:44 PM

Hi, @amedonosova!

The patch looks and works perfectly fine now! Let's merge it into master and let people test! :)

libs/flake/resources/KoGamutMask.cpp
196–197

Looks like a forgotten comment :)

plugins/dockers/artisticcolorselector/kis_arcs_constants.h
38

We should check if this static initialization will compile on Windows. At least older MSVC didn't like to see initializers for non-trivial types in header files. Though we don't use MSVC anymore, so let's just merge it into master and check if CI builds it fine :)

plugins/dockers/gamutmask/gamutmask_dock.cpp
282

We still tend not to use 'nullptr' unless really needed. But it is not written in any guidelines, so cannot block the patch :)

This revision is now accepted and ready to land.Aug 28 2018, 12:44 PM
This revision was automatically updated to reflect the committed changes.