Luminosity to Alpha patch
Needs RevisionPublic

Authored by Reptorian on Apr 15 2019, 3:46 AM.

Details

Reviewers
dkazakov
Group Reviewers
Krita
Summary

Another one of my series of non-working patches which is basically WIP. Right now, I'm at the part of non-existent file.

The problem is that this is based off Desaturate patch, and this is a proof of concept that Luminosity can be transposed into the Alpha Channel. I need to know what this is about in Desaturate h file . The actual end goal is to transpose the LAB L* channel into alpha, and based on the mathematics found in GIMP Luminosity Mask. I should really pick Luminosity Mask as part of the name, but I'll worry about the functionality of the filter first, and then I'll change the name to something like Luminosity Mask into Alpha.

  • #include "ui_wdg_desaturate.h"

That file does not exist at all, so I don't know what to do here.

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
Reptorian created this revision.Apr 15 2019, 3:46 AM
Restricted Application added a reviewer: Krita. · View Herald TranscriptApr 15 2019, 3:46 AM
Restricted Application added a project: Krita. · View Herald Transcript
Reptorian requested review of this revision.Apr 15 2019, 3:46 AM
Reptorian edited the summary of this revision. (Show Details)
Reptorian edited the summary of this revision. (Show Details)Apr 15 2019, 4:03 AM

Hi, @Reptorian!

As far as I can see, this patch just hardcodes functionality of Color to Alpha filter with white color selected as a reference. Why do we need this as a separate filter?

The thing is that Color to Alpha result doesn't match the expected result, and it doesn't actually offer a quick way to generate alpha based on luminosity of images. And if you want to apply effect on different luminosity, then you need to use clone layer, group layer, desaturate, and color to alpha at once. With this patch (when I get to fixing the error as I know how to fix it or I think I know how to fix it), it would offer a much easier way to edit images based on luminosity, and enable a workaround to the absence of luminosity to alpha blend mode I been wanting to see. All you would need to create a filter layer with this filter, and set to normal instead of going all the trouble of cloning a layer twice, grouping the clone, do the desaturate filter mask, and color to alpha mask just to do something like this.

Here's the test I made to verify with XOR blending mode (XOR tells us more info than difference).

dkazakov requested changes to this revision.Apr 16 2019, 2:23 PM

The patch doesn't build here. But I have a feeling that changing key colro in color-to-alpha from white to grey will do what you want.

(I also added wdg_luminositytoalpha.ui to CMakeLists.txt, because it was not added)

make[2]: *** [plugins/filters/colors/CMakeFiles/kritaextensioncolorsfilters.dir/colors.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 87%] Built target kritadeformpaintop
[ 87%] Built target kritahairypaintop
[ 88%] Built target kritacurvepaintop
[ 89%] Built target kritafilterop
[ 89%] Built target kritaspraypaintop
[ 89%] Built target kritadefaultpaintops
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp: In constructor ‘KisLuminosityToAlphaConfigWidget::KisLuminosityToAlphaConfigWidget(QWidget*, Qt::WindowFlags)’:
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:96:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘LLL’
     m_group->addButton(m_page->LLL, 0);
                                ^
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:97:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘LL’
     m_group->addButton(m_page->LL, 1);
                                ^
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:98:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘L’
     m_group->addButton(m_page->L, 2);
                                ^
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:99:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘M’
     m_group->addButton(m_page->M, 3);
                                ^
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:100:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘MM’
     m_group->addButton(m_page->MM, 4);
                                ^
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:101:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘MMM’
     m_group->addButton(m_page->MMM, 5);
                                ^
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:102:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘D’
     m_group->addButton(m_page->D, 6);
                                ^
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:103:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘DD’
     m_group->addButton(m_page->DD, 7);
                                ^
/home/appimage/persistent/krita/plugins/filters/colors/kis_luminositytoalpha_filter.cpp:104:32: error: ‘class Ui_WdgLuminosityToAlpha’ has no member named ‘DDD’
     m_group->addButton(m_page->DDD, 8);
                                ^
[ 90%] Built target kritaexperimentpaintop
[ 91%] Built target kritaparticlepaintop
[ 91%] Built target kritagridpaintop
make[2]: *** [plugins/filters/colors/CMakeFiles/kritaextensioncolorsfilters.dir/kis_luminositytoalpha_filter.cpp.o] Error 1
make[1]: *** [plugins/filters/colors/CMakeFiles/kritaextensioncolorsfilters.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
This revision now requires changes to proceed.Apr 16 2019, 2:23 PM