~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/plugins/filters/colors/kis_color_to_alpha.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
    QVariant value;
79
79
    QColor cTA = (config->getProperty("targetcolor", value)) ? value.value<QColor>() : QColor(255, 255, 255);
80
80
    int threshold = (config->getProperty("threshold", value)) ? value.toInt() : 0;
 
81
    qreal thresholdF = threshold;
81
82
 
82
83
    KisRectIteratorPixel dstIt = dst->createRectIterator(dstTopLeft.x(), dstTopLeft.y(), size.width(), size.height(), dstInfo.selection());
83
84
    KisRectConstIteratorPixel srcIt = src->createRectConstIterator(srcTopLeft.x(), srcTopLeft.y(), size.width(), size.height(), srcInfo.selection());
96
97
        if (srcIt.isSelected()) {
97
98
            quint8 d = cs->difference(color, srcIt.oldRawData());
98
99
            if (d >= threshold) {
99
 
                cs->setAlpha(dstIt.rawData(), 255, 1);
 
100
                cs->setOpacity(dstIt.rawData(), (qreal) 1.0, 1);
100
101
            } else {
101
 
                cs->setAlpha(dstIt.rawData(), (255 * d) / threshold, 1);
 
102
                cs->setOpacity(dstIt.rawData(), d / thresholdF, 1);
102
103
            }
103
104
        }
104
105
        if (progressUpdater) progressUpdater->setProgress((++currentProgress) / totalCost);