summaryrefslogtreecommitdiffstats
path: root/kdecore/kiconeffect.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-13 08:32:36 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-13 08:32:36 +0000
commitf7e71d47719ab6094cf4a9fafffa5ea351973522 (patch)
tree30834aa632d442019e14f88685001d94657d060b /kdecore/kiconeffect.cpp
parentb31cfd9a1ee986fe2ae9a693f3afd7f171dd897c (diff)
downloadtdelibs-f7e71d47719ab6094cf4a9fafffa5ea351973522.tar.gz
tdelibs-f7e71d47719ab6094cf4a9fafffa5ea351973522.zip
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
Diffstat (limited to 'kdecore/kiconeffect.cpp')
-rw-r--r--kdecore/kiconeffect.cpp106
1 files changed, 53 insertions, 53 deletions
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<pixels; i++)
{
- val = qGray(data[i]);
- alpha = qAlpha(data[i]);
+ val = tqGray(data[i]);
+ alpha = tqAlpha(data[i]);
if (value < 1.0)
{
- rval = static_cast<int>(value*val+(1.0-value)*qRed(data[i]));
- gval = static_cast<int>(value*val+(1.0-value)*qGreen(data[i]));
- bval = static_cast<int>(value*val+(1.0-value)*qBlue(data[i]));
- data[i] = qRgba(rval, gval, bval, alpha);
+ rval = static_cast<int>(value*val+(1.0-value)*tqRed(data[i]));
+ gval = static_cast<int>(value*val+(1.0-value)*tqGreen(data[i]));
+ bval = static_cast<int>(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<pixels; i++)
{
- val = qGray(data[i]);
+ val = tqGray(data[i]);
if (val < 128)
{
rval = static_cast<int>(rcol/128*val);
@@ -335,20 +335,20 @@ void KIconEffect::colorize(TQImage &img, const TQColor &col, float value)
}
if (value < 1.0)
{
- rval = static_cast<int>(value*rval+(1.0 - value)*qRed(data[i]));
- gval = static_cast<int>(value*gval+(1.0 - value)*qGreen(data[i]));
- bval = static_cast<int>(value*bval+(1.0 - value)*qBlue(data[i]));
+ rval = static_cast<int>(value*rval+(1.0 - value)*tqRed(data[i]));
+ gval = static_cast<int>(value*gval+(1.0 - value)*tqGreen(data[i]));
+ bval = static_cast<int>(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<pixels; i++) {
- sum += qGray(data[i])*qAlpha(data[i]) + 255*(255-qAlpha(data[i]));
+ sum += tqGray(data[i])*tqAlpha(data[i]) + 255*(255-tqAlpha(data[i]));
values += 255;
- if ((qRed(data[i]) != qGreen(data[i]) ) || (qGreen(data[i]) != qBlue(data[i]) ))
+ if ((tqRed(data[i]) != tqGreen(data[i]) ) || (tqGreen(data[i]) != tqBlue(data[i]) ))
grayscale = false;
}
double medium = sum/values;
@@ -367,30 +367,30 @@ void KIconEffect::toMonochrome(TQImage &img, const TQColor &black, const TQColor
// Step 2: Modify the image
if (grayscale) {
for (i=0; i<pixels; i++) {
- int v = qRed(data[i]);
- rval = static_cast<int>( ((255-v)*rb + v*rw)*value/255 + (1.0-value)*qRed(data[i]));
- gval = static_cast<int>( ((255-v)*gb + v*gw)*value/255 + (1.0-value)*qGreen(data[i]));
- bval = static_cast<int>( ((255-v)*bb + v*bw)*value/255 + (1.0-value)*qBlue(data[i]));
+ int v = tqRed(data[i]);
+ rval = static_cast<int>( ((255-v)*rb + v*rw)*value/255 + (1.0-value)*tqRed(data[i]));
+ gval = static_cast<int>( ((255-v)*gb + v*gw)*value/255 + (1.0-value)*tqGreen(data[i]));
+ bval = static_cast<int>( ((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<pixels; i++) {
- if (qGray(data[i]) <= medium) {
- rval = static_cast<int>(value*rb+(1.0-value)*qRed(data[i]));
- gval = static_cast<int>(value*gb+(1.0-value)*qGreen(data[i]));
- bval = static_cast<int>(value*bb+(1.0-value)*qBlue(data[i]));
+ if (tqGray(data[i]) <= medium) {
+ rval = static_cast<int>(value*rb+(1.0-value)*tqRed(data[i]));
+ gval = static_cast<int>(value*gb+(1.0-value)*tqGreen(data[i]));
+ bval = static_cast<int>(value*bb+(1.0-value)*tqBlue(data[i]));
}
else {
- rval = static_cast<int>(value*rw+(1.0-value)*qRed(data[i]));
- gval = static_cast<int>(value*gw+(1.0-value)*qGreen(data[i]));
- bval = static_cast<int>(value*bw+(1.0-value)*qBlue(data[i]));
+ rval = static_cast<int>(value*rw+(1.0-value)*tqRed(data[i]));
+ gval = static_cast<int>(value*gw+(1.0-value)*tqGreen(data[i]));
+ bval = static_cast<int>(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<pixels; i++)
@@ -408,8 +408,8 @@ void KIconEffect::deSaturate(TQImage &img, float value)
color.setRgb(data[i]);
color.hsv(&h, &s, &v);
color.setHsv(h, (int) (s * (1.0 - value) + 0.5), v);
- data[i] = qRgba(color.red(), color.green(), color.blue(),
- qAlpha(data[i]));
+ data[i] = tqRgba(color.red(), color.green(), color.blue(),
+ tqAlpha(data[i]));
}
}
@@ -418,7 +418,7 @@ void KIconEffect::toGamma(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 i, rval, gval, bval;
float gamma;
@@ -431,7 +431,7 @@ void KIconEffect::toGamma(TQImage &img, float value)
rval = static_cast<int>(pow(static_cast<float>(rval)/255 , gamma)*255);
gval = static_cast<int>(pow(static_cast<float>(gval)/255 , gamma)*255);
bval = static_cast<int>(pow(static_cast<float>(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<img.numColors(); x++)
{
// try to find already transparent pixel
- if (qAlpha(img.color(x)) < 127)
+ if (tqAlpha(img.color(x)) < 127)
{
transColor = x;
break;
@@ -631,7 +631,7 @@ void KIconEffect::overlay(TQImage &src, TQImage &overlay)
int trans;
for (trans=0; trans<overlay.numColors(); trans++)
{
- if (qAlpha(overlay.color(trans)) == 0)
+ if (tqAlpha(overlay.color(trans)) == 0)
{
kdDebug(265) << "transparent pixel found at " << trans << "\n";
break;
@@ -680,22 +680,22 @@ void KIconEffect::overlay(TQImage &src, TQImage &overlay)
for (j=0; j<src.width(); j++)
{
- r1 = qRed(oline[j]);
- g1 = qGreen(oline[j]);
- b1 = qBlue(oline[j]);
- a1 = qAlpha(oline[j]);
+ r1 = tqRed(oline[j]);
+ g1 = tqGreen(oline[j]);
+ b1 = tqBlue(oline[j]);
+ a1 = tqAlpha(oline[j]);
- r2 = qRed(sline[j]);
- g2 = qGreen(sline[j]);
- b2 = qBlue(sline[j]);
- a2 = qAlpha(sline[j]);
+ r2 = tqRed(sline[j]);
+ g2 = tqGreen(sline[j]);
+ b2 = tqBlue(sline[j]);
+ a2 = tqAlpha(sline[j]);
r2 = (a1 * r1 + (0xff - a1) * r2) >> 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