New Layer from visible
ClosedPublic

Authored by miroslavtalasek on Aug 12 2016, 7:22 PM.

Details

Summary

its a common function under Layer->New menu which is in gimp and ps.
It create /insert layer on top from visible pixels

Test Plan

u can create several layers with some painting and then test this function which create new layer with all paintings together

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.
miroslavtalasek retitled this revision from to New Layer from visible.
miroslavtalasek updated this object.
miroslavtalasek edited the test plan for this revision. (Show Details)
miroslavtalasek set the repository for this revision to R37 Krita.
dkazakov requested changes to this revision.Aug 14 2016, 10:21 AM
dkazakov edited edge metadata.

Hi, @miroslavtalasek!

We used to merge the image this way, but it will not work with animated images (the frames will be lost), so we changed the strategy. Now you should use KisLayerUtils for that. Please check KisLayerUtils::flattenImage() and KisLayerUtils::flattenLayer() for the example.

As far as I can tell, you should just call mergeMultipleLayersImpl() with specific arguments.

This revision now requires changes to proceed.Aug 14 2016, 10:21 AM

And also take care that this patch should go into a separate branch, because master is in freeze now

Ok i will fix if with reuse code to maximum ;)

i try to reuse mergeMultipleLayersImpl to merge layers but this also remove other layer and i trying discover what must be changed to keep other layers alive but i didnt understand what

miroslavtalasek edited edge metadata.

I reuse merge layers from layerutil so its merge layer with possible frames - new way

Hi, @miroslavtalasek!

Codewise the patch looks fine, except of a minor text glitch. I'll compile it a bit later today.

Are you going to push it yourself or I should push it for you?

libs/image/kis_layer_utils.cpp
1043

I guess we use all capitals wording here, that is, the action name should be "New From Visible". I can fix it while pushing the code into a branch.

dkazakov accepted this revision.Aug 18 2016, 6:32 AM
dkazakov edited edge metadata.

I tested the patch, it works perfectly fine. Including animations and undo.

The only trouble is the two strings I mentioned that should be changed into "title-capitalization", which look inconsistent with the rest of the GUI.

Please check this document for more info about capitalization:
https://community.kde.org/KDE_Visual_Design_Group/HIG/Capitalization

As far as I remember you were going to get a developers account. So when you get one, please fix these two strings and push the changes into a separate branch. And we will merge this branch into master when merge window opens in the beginning of September.

krita/krita.action
2272

This menu item should be in title-case as well:

"New Layer From Visible"

Otherwise it looks inconsistent

This revision is now accepted and ready to land.Aug 18 2016, 6:32 AM

Can u push it for me (i have big free time troubles) ? and how i obtain developer account for future ?

Hi, @miroslavtalasek!

Here is the guide on how to get it:
https://community.kde.org/Infrastructure/Get_a_Developer_Account

In the "person who recommends you" field write me or Boud.

And ok, I'll push your patch now!

Btw, can you write me your email? I need it to wirte your name as the author of the commit.

i will through irc as private message

This revision was automatically updated to reflect the committed changes.

Is this feature merged in the master. I saw two commits about it in master so i think it is. but for some reason I couldn't get this menu in the layer menu. there is no new layer from visible menu in the new section of layer menu. Do i need to do something to get it?