PerChannel Color filter histogram white spike patch
William Steidtmann
billstei at hbci.com
Thu Dec 2 18:25:55 CET 2010
The patch below fixes the "white spike" problem in the histogram for the
PerChannel Color filter. See also Commits 1200357 and 1202552 for
comparison.
To recreate the (pre-patch) bug:
1) Create a 10x10 image, 8 bit sRGB.
2) Set the color to a dark gray 92,92,92.
3) Use a pixel brush to paint all (most) of the image this dark gray.
4) Use menu Filter->Adjust->Color Adjustment curves...
5) Note that the graph has little or no indication (count) in the second
quadrant where this dark gray should be.
After the patch, the second quadrant in step 5) will have an appropriate
pixel count.
Also note: the line "#define bounds(x,a,b) (x<a ? a : (x>b ? b :x))" was
removed because of a name conflict with image->bounds(), and because the
code was not being used.
William Steidtmann
--------------------
Index: krita/plugins/filters/colorsfilters/kis_perchannel_filter.h
===================================================================
--- krita/plugins/filters/colorsfilters/kis_perchannel_filter.h
(revision 1202887)
+++ krita/plugins/filters/colorsfilters/kis_perchannel_filter.h
(working copy)
@@ -92,7 +92,7 @@
Q_OBJECT
public:
- KisPerChannelConfigWidget(QWidget * parent, KisPaintDeviceSP dev,
Qt::WFlags f = 0);
+ KisPerChannelConfigWidget(QWidget * parent, KisPaintDeviceSP dev,
const QRect &bounds, Qt::WFlags f = 0);
virtual ~KisPerChannelConfigWidget() {}
virtual void setConfiguration(const KisPropertiesConfiguration*
config);
Index: krita/plugins/filters/colorsfilters/kis_perchannel_filter.cpp
===================================================================
--- krita/plugins/filters/colorsfilters/kis_perchannel_filter.cpp
(revision 1202887)
+++ krita/plugins/filters/colorsfilters/kis_perchannel_filter.cpp
(working copy)
@@ -50,9 +50,8 @@
#include "widgets/kis_curve_widget.h"
-#define bounds(x,a,b) (x<a ? a : (x>b ? b :x))
-KisPerChannelConfigWidget::KisPerChannelConfigWidget(QWidget * parent,
KisPaintDeviceSP dev, Qt::WFlags f)
+KisPerChannelConfigWidget::KisPerChannelConfigWidget(QWidget * parent,
KisPaintDeviceSP dev, const QRect &bounds, Qt::WFlags f)
: KisConfigWidget(parent, f), m_histogram(0)
{
Q_ASSERT(dev);
@@ -87,7 +86,7 @@
{
KoHistogramProducerFactory *hpf;
hpf =
KoHistogramProducerFactoryRegistry::instance()->get(keys.at(0));
- m_histogram = new KisHistogram(m_dev, m_dev->exactBounds(),
hpf->generate(), LINEAR);
+ m_histogram = new KisHistogram(m_dev, bounds, hpf->generate(), LINEAR);
}
connect(m_page->curveWidget, SIGNAL(modified()), this,
SIGNAL(sigConfigurationItemChanged()));
@@ -387,8 +386,7 @@
KisConfigWidget *
KisPerChannelFilter::createConfigurationWidget(QWidget *parent, const
KisPaintDeviceSP dev, const KisImageWSP image) const
{
- Q_UNUSED(image);
- return new KisPerChannelConfigWidget(parent, dev);
+ return new KisPerChannelConfigWidget(parent, dev, image->bounds());
}
KisFilterConfiguration *
KisPerChannelFilter::factoryConfiguration(const KisPaintDeviceSP) const
More information about the kimageshop
mailing list