From f7e71d47719ab6094cf4a9fafffa5ea351973522 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 13 Jan 2011 08:32:36 +0000 Subject: Initial conversion for TQt for Qt4 3.4.0 TP2 This will also compile with TQt for Qt3, and should not cause any problems with dependent modules such as kdebase. If it does then it needs to be fixed! git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1214149 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdecore/kiconeffect.cpp | 106 ++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 53 deletions(-) (limited to 'kdecore/kiconeffect.cpp') diff --git a/kdecore/kiconeffect.cpp b/kdecore/kiconeffect.cpp index 8315eab6b..3d5833578 100644 --- a/kdecore/kiconeffect.cpp +++ b/kdecore/kiconeffect.cpp @@ -153,8 +153,8 @@ TQString KIconEffect::fingerprint(int group, int state) const cached += ':'; cached += tmp.setNum(mValue[group][state]); cached += ':'; - cached += mTrans[group][state] ? TQString::fromLatin1("trans") - : TQString::fromLatin1("notrans"); + cached += mTrans[group][state] ? TQString::tqfromLatin1("trans") + : TQString::tqfromLatin1("notrans"); if (mEffect[group][state] == Colorize || mEffect[group][state] == ToMonochrome) { cached += ':'; @@ -287,20 +287,20 @@ void KIconEffect::toGray(TQImage &img, float value) int pixels = (img.depth() > 8) ? img.width()*img.height() : img.numColors(); unsigned int *data = img.depth() > 8 ? (unsigned int *) img.bits() - : (unsigned int *) img.colorTable(); + : (unsigned int *) img.tqcolorTable(); int rval, gval, bval, val, alpha, i; for (i=0; i(value*val+(1.0-value)*qRed(data[i])); - gval = static_cast(value*val+(1.0-value)*qGreen(data[i])); - bval = static_cast(value*val+(1.0-value)*qBlue(data[i])); - data[i] = qRgba(rval, gval, bval, alpha); + rval = static_cast(value*val+(1.0-value)*tqRed(data[i])); + gval = static_cast(value*val+(1.0-value)*tqGreen(data[i])); + bval = static_cast(value*val+(1.0-value)*tqBlue(data[i])); + data[i] = tqRgba(rval, gval, bval, alpha); } else - data[i] = qRgba(val, val, val, alpha); + data[i] = tqRgba(val, val, val, alpha); } } @@ -309,12 +309,12 @@ void KIconEffect::colorize(TQImage &img, const TQColor &col, float value) int pixels = (img.depth() > 8) ? img.width()*img.height() : img.numColors(); unsigned int *data = img.depth() > 8 ? (unsigned int *) img.bits() - : (unsigned int *) img.colorTable(); + : (unsigned int *) img.tqcolorTable(); int rval, gval, bval, val, alpha, i; float rcol = col.red(), gcol = col.green(), bcol = col.blue(); for (i=0; i(rcol/128*val); @@ -335,20 +335,20 @@ void KIconEffect::colorize(TQImage &img, const TQColor &col, float value) } if (value < 1.0) { - rval = static_cast(value*rval+(1.0 - value)*qRed(data[i])); - gval = static_cast(value*gval+(1.0 - value)*qGreen(data[i])); - bval = static_cast(value*bval+(1.0 - value)*qBlue(data[i])); + rval = static_cast(value*rval+(1.0 - value)*tqRed(data[i])); + gval = static_cast(value*gval+(1.0 - value)*tqGreen(data[i])); + bval = static_cast(value*bval+(1.0 - value)*tqBlue(data[i])); } - alpha = qAlpha(data[i]); - data[i] = qRgba(rval, gval, bval, alpha); + alpha = tqAlpha(data[i]); + data[i] = tqRgba(rval, gval, bval, alpha); } } void KIconEffect::toMonochrome(TQImage &img, const TQColor &black, const TQColor &white, float value) { int pixels = (img.depth() > 8) ? img.width()*img.height() : img.numColors(); unsigned int *data = img.depth() > 8 ? (unsigned int *) img.bits() - : (unsigned int *) img.colorTable(); + : (unsigned int *) img.tqcolorTable(); int rval, gval, bval, alpha, i; int rw = white.red(), gw = white.green(), bw = white.blue(); int rb = black.red(), gb = black.green(), bb = black.blue(); @@ -357,9 +357,9 @@ void KIconEffect::toMonochrome(TQImage &img, const TQColor &black, const TQColor bool grayscale = true; // Step 1: determine the average brightness for (i=0; i( ((255-v)*rb + v*rw)*value/255 + (1.0-value)*qRed(data[i])); - gval = static_cast( ((255-v)*gb + v*gw)*value/255 + (1.0-value)*qGreen(data[i])); - bval = static_cast( ((255-v)*bb + v*bw)*value/255 + (1.0-value)*qBlue(data[i])); + int v = tqRed(data[i]); + rval = static_cast( ((255-v)*rb + v*rw)*value/255 + (1.0-value)*tqRed(data[i])); + gval = static_cast( ((255-v)*gb + v*gw)*value/255 + (1.0-value)*tqGreen(data[i])); + bval = static_cast( ((255-v)*bb + v*bw)*value/255 + (1.0-value)*tqBlue(data[i])); - alpha = qAlpha(data[i]); - data[i] = qRgba(rval, gval, bval, alpha); + alpha = tqAlpha(data[i]); + data[i] = tqRgba(rval, gval, bval, alpha); } } else { for (i=0; i(value*rb+(1.0-value)*qRed(data[i])); - gval = static_cast(value*gb+(1.0-value)*qGreen(data[i])); - bval = static_cast(value*bb+(1.0-value)*qBlue(data[i])); + if (tqGray(data[i]) <= medium) { + rval = static_cast(value*rb+(1.0-value)*tqRed(data[i])); + gval = static_cast(value*gb+(1.0-value)*tqGreen(data[i])); + bval = static_cast(value*bb+(1.0-value)*tqBlue(data[i])); } else { - rval = static_cast(value*rw+(1.0-value)*qRed(data[i])); - gval = static_cast(value*gw+(1.0-value)*qGreen(data[i])); - bval = static_cast(value*bw+(1.0-value)*qBlue(data[i])); + rval = static_cast(value*rw+(1.0-value)*tqRed(data[i])); + gval = static_cast(value*gw+(1.0-value)*tqGreen(data[i])); + bval = static_cast(value*bw+(1.0-value)*tqBlue(data[i])); } - alpha = qAlpha(data[i]); - data[i] = qRgba(rval, gval, bval, alpha); + alpha = tqAlpha(data[i]); + data[i] = tqRgba(rval, gval, bval, alpha); } } } @@ -400,7 +400,7 @@ void KIconEffect::deSaturate(TQImage &img, float value) int pixels = (img.depth() > 8) ? img.width()*img.height() : img.numColors(); unsigned int *data = (img.depth() > 8) ? (unsigned int *) img.bits() - : (unsigned int *) img.colorTable(); + : (unsigned int *) img.tqcolorTable(); TQColor color; int h, s, v, i; for (i=0; i 8) ? img.width()*img.height() : img.numColors(); unsigned int *data = (img.depth() > 8) ? (unsigned int *) img.bits() - : (unsigned int *) img.colorTable(); + : (unsigned int *) img.tqcolorTable(); TQColor color; int i, rval, gval, bval; float gamma; @@ -431,7 +431,7 @@ void KIconEffect::toGamma(TQImage &img, float value) rval = static_cast(pow(static_cast(rval)/255 , gamma)*255); gval = static_cast(pow(static_cast(gval)/255 , gamma)*255); bval = static_cast(pow(static_cast(bval)/255 , gamma)*255); - data[i] = qRgba(rval, gval, bval, qAlpha(data[i])); + data[i] = tqRgba(rval, gval, bval, tqAlpha(data[i])); } } @@ -476,7 +476,7 @@ void KIconEffect::semiTransparent(TQImage &img) for (x=0; x> 8; g2 = (a1 * g1 + (0xff - a1) * g2) >> 8; b2 = (a1 * b1 + (0xff - a1) * b2) >> 8; a2 = QMAX(a1, a2); - sline[j] = qRgba(r2, g2, b2, a2); + sline[j] = tqRgba(r2, g2, b2, a2); } } } @@ -742,9 +742,9 @@ KIconEffect::visualActivate(TQWidget * widget, TQRect rect) TQPainter p(widget); - // Use NotROP to avoid having to repaint the pixmap each time. + // Use NotROP to avoid having to tqrepaint the pixmap each time. p.setPen(TQPen(Qt::black, 2, Qt::DotLine)); - p.setRasterOp(Qt::NotROP); + p.setRasterOp(TQt::NotROP); // The spacing between the rects we draw. // Use the minimum of width and height to avoid painting outside the -- cgit v1.2.1