Bug 473559

Summary: Create from Clipboard clashes w. with fill layer background
Product: [Applications] krita Reporter: askkegra
Component: File formatsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73
Priority: NOR Keywords: regression, release_blocker
Version: 5.2.0-beta2   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Creating a new image from the clipboard with a fill layer as a background creates undesired results

Description askkegra 2023-08-20 12:51:57 UTC
Created attachment 161071 [details]
Creating a new image from the clipboard with a fill layer as a background creates undesired results

Normally when I create a new document for drawing I like to have the background as a fill layer. So I have the Content of new documents set to 2 layers (an empty layer to draw on and a locked fill layer for the background). Krita remembers these settings and it works really well for me usually. 

But whenever I need to create an image from clipboard contents to do a quick paintover or image edit job this creates an annoyance. The creation process automatically pastes the clipboard contents onto the locked fill layer so it becomes a transparency mask for the fill layer, as opposed to sitting on a layer above the background layer.

To reproduce:
1. Have an image in your clipboard
2. Open Krita and press 'New Image'
3. Select 'Create from Clipboard' and go to the 'Content' tab
4. Set 'Background' to 'As fill layer'
5. Press 'Create' and you're met with a masked fill layer

Expected results:
I would like for the clipboard contents to be added as normal paint layer above the the fill layer. The clipboard contents shouldn't be the background, they should sit on top of the background.

I think when setting the background to a fill layer it shouldn't be counted towards the initial number of layers. There's very few cases where someone would want to start with a single locked layer that you can't really draw on. So rather than the fill layer being "Layer 0", create the initial number of layers and separately add a fill layer to the bottom of the layer stack. This should work for whenever you're creating a new image, regardless of starting from a blank or from the clipboard.
Comment 1 Dmitry Kazakov 2023-08-21 15:26:06 UTC
Git commit 75ca223142dd8e299eaf5021010190dc98b9c1f5 by Dmitry Kazakov.
Committed on 21/08/2023 at 17:25.
Pushed by dkazakov into branch 'krita/5.2'.

Fix creation of a new image from clipboard

When there is only one layer available and it is a fill layer we
should create a new paint layer for the paste.

M  +25   -9    libs/libqml/plugins/kritasketchplugin/ImageBuilder.cpp
M  +2    -1    libs/ui/kis_import_catcher.h
M  +17   -3    libs/ui/widgets/kis_image_from_clipboard_widget.cpp

https://invent.kde.org/graphics/krita/-/commit/75ca223142dd8e299eaf5021010190dc98b9c1f5
Comment 2 Dmitry Kazakov 2023-08-21 15:26:29 UTC
Git commit 274502bf4cf1e6f822a4b6c29c1b8bf4b9ef7c64 by Dmitry Kazakov.
Committed on 21/08/2023 at 17:26.
Pushed by dkazakov into branch 'master'.

Fix creation of a new image from clipboard

When there is only one layer available and it is a fill layer we
should create a new paint layer for the paste.

M  +25   -9    libs/libqml/plugins/kritasketchplugin/ImageBuilder.cpp
M  +2    -1    libs/ui/kis_import_catcher.h
M  +17   -3    libs/ui/widgets/kis_image_from_clipboard_widget.cpp

https://invent.kde.org/graphics/krita/-/commit/274502bf4cf1e6f822a4b6c29c1b8bf4b9ef7c64