Bug 137708 - Should be the way to paint on adjustment laeyrs
Summary: Should be the way to paint on adjustment laeyrs
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Unclassified
Component: Filter Layers (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-21 23:29 UTC by Vsevolod Krishchenko
Modified: 2007-12-06 14:42 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vsevolod Krishchenko 2006-11-21 23:29:39 UTC
Version:           1.6.1 (using KDE 3.5.5, Kubuntu (edgy) 4:3.5.5-0ubuntu3)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.17-10-386

Currently any draw tool makes pixels of adj. layer completly opaque and any clear/erase tool makes them completely transparent. Still, as I see AA pixels when using freehand, it is possible to use semi-transparent pixels on adjustmnent layer.

So, I need a way to make pixels of adjustment layers not only 0% and 100% opaque, but any in between. For example, painting gradients on brightness layers is vital when processing photos. Layer masks cannot help me because I cannot use mask with adj. layers.

Please, make it possible to just draw on adj. layers, when using black makes them transparent while using white make them opaque and it is possible to use any gray too.
Comment 1 Halla Rempt 2006-12-07 10:41:09 UTC
This already works, but not in the same way as with the layer masks: with masks you draw in a tint of gray to vary transparency, with adjustment layers you must set the opacity in the tool option docker to draw with less than 100% opaque. And this only works when there's a selection active on the adjustment layer...

What a mess: I'm upgrading this wishlist item to a bug because it's a feature that's already implemented, it's just not working correctly.
Comment 2 Bart Coppens 2006-12-30 12:34:54 UTC
SVN commit 617779 by coppens:

When deselecting the adjustment layer, don't do weird stuff, but something reasonable. (But should it make everything adjusted, or nothing at all? Currently it does the 'everything adjusted' thing...)
CCBUG:137708

 M  +11 -0     core/kis_adjustment_layer.cc  
 M  +3 -0      core/kis_adjustment_layer.h  
 M  +3 -2      ui/kis_selection_manager.cc  


--- branches/koffice/1.6/koffice/krita/core/kis_adjustment_layer.cc #617778:617779
@@ -118,7 +118,18 @@
         m_selection->setSelection(m_selection);
 }
 
+void KisAdjustmentLayer::clearSelection()
+{
+    KisFillPainter gc(m_selection.data());
+    KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8();
 
+    QRect bounds = extent();
+    bounds |= image()->bounds();
+    gc.fillRect(bounds, KisColor(Qt::white, cs), MAX_SELECTED);
+    gc.end();
+}
+
+
 Q_INT32 KisAdjustmentLayer::x() const
 {
     if (m_selection)
--- branches/koffice/1.6/koffice/krita/core/kis_adjustment_layer.h #617778:617779
@@ -61,6 +61,9 @@
     /// Set the selction of this adjustment layer to a copy of selection.
     void setSelection(KisSelectionSP selection);
 
+    /// Clears the selection (doesn't call any of the update or dirty methods)
+    void clearSelection();
+
     virtual void paintSelection(QImage &img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h);
     virtual void paintSelection(QImage &img, const QRect& scaledImageRect, const QSize& scaledImageSize, const QSize& imageSize);
 public:
--- branches/koffice/1.6/koffice/krita/ui/kis_selection_manager.cc #617778:617779
@@ -529,8 +529,9 @@
     Q_CHECK_PTR(t);
 
     // Make adjustment layers behave almost the same (except no reselect)
-    if (dynamic_cast<KisAdjustmentLayer*>(img->activeLayer().data())) {
-        dev->clear();
+    KisAdjustmentLayer* adj = dynamic_cast<KisAdjustmentLayer*>(img->activeLayer().data());
+    if (adj) {
+        adj->clearSelection();
     } else {
         dev->deselect();
     }
Comment 3 Bart Coppens 2006-12-30 16:28:04 UTC
SVN commit 617918 by coppens:

Strange that this didn't work, but the new way is more consistent and actually works. Also changed the previously mentioned clearSelection on the adjustment layers to something sensible: Select All -> apply adjustment everywhere, Deselect -> apply nowhere.
BUG:137638
CCBUG:137708

 M  +1 -1      core/kis_adjustment_layer.cc  
 M  +9 -2      ui/kis_selection_manager.cc  


--- branches/koffice/1.6/koffice/krita/core/kis_adjustment_layer.cc #617917:617918
@@ -125,7 +125,7 @@
 
     QRect bounds = extent();
     bounds |= image()->bounds();
-    gc.fillRect(bounds, KisColor(Qt::white, cs), MAX_SELECTED);
+    gc.fillRect(bounds, KisColor(Qt::white, cs), MIN_SELECTED);
     gc.end();
 }
 
--- branches/koffice/1.6/koffice/krita/ui/kis_selection_manager.cc #617917:617918
@@ -508,8 +508,15 @@
     if (img->undo()) t = new KisSelectedTransaction(i18n("Select All"), dev);
     Q_CHECK_PTR(t);
 
-    dev->selection()->clear();
-    dev->selection()->invert();
+    // Make adjustment layers behave better
+    KisAdjustmentLayer* adj = dynamic_cast<KisAdjustmentLayer*>(img->activeLayer().data());
+    if (adj) {
+        adj->clearSelection();
+        adj->selection()->invert();
+    } else {
+        dev->selection()->clear();
+        dev->selection()->invert();
+    }
     dev->setDirty();
     dev->emitSelectionChanged();
 
Comment 4 Halla Rempt 2007-12-06 14:42:31 UTC
Fixed for 1.6, replaced with different code for trunk.