summaryrefslogtreecommitdiffstats
path: root/domino/misc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'domino/misc.cpp')
-rw-r--r--domino/misc.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/domino/misc.cpp b/domino/misc.cpp
index b5b337f..f94f414 100644
--- a/domino/misc.cpp
+++ b/domino/misc.cpp
@@ -18,10 +18,10 @@
* Boston, MA 02111-1307, USA.
*/
-#include <qcolor.h>
+#include <tqcolor.h>
#include "misc.h"
-#include <qimage.h>
-#include <qpixmap.h>
+#include <tqimage.h>
+#include <tqpixmap.h>
#include <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -36,33 +36,33 @@
-QColor alphaBlendColors(const QColor &bgColor, const QColor &fgColor, const int a)
+TQColor alphaBlendColors(const TQColor &bgColor, const TQColor &fgColor, const int a)
{
- QRgb rgb = bgColor.rgb();
- QRgb rgb_b = fgColor.rgb();
+ TQRgb rgb = bgColor.rgb();
+ TQRgb rgb_b = fgColor.rgb();
uint alpha;
if(a > 255) alpha = 255;
else if(a < 0) alpha = 0;
else alpha = a;
uint inv_alpha = 255 - alpha;
- return QColor((qRed(rgb_b)*inv_alpha + qRed(rgb)*alpha)>>8,
- (qGreen(rgb_b)*inv_alpha + qGreen(rgb)*alpha)>>8,
- (qBlue(rgb_b)*inv_alpha + qBlue(rgb)*alpha)>>8 );
+ return TQColor((tqRed(rgb_b)*inv_alpha + tqRed(rgb)*alpha)>>8,
+ (tqGreen(rgb_b)*inv_alpha + tqGreen(rgb)*alpha)>>8,
+ (tqBlue(rgb_b)*inv_alpha + tqBlue(rgb)*alpha)>>8 );
}
-QColor blendColors(const QColor &bgColor, const QColor &fgColor)
+TQColor blendColors(const TQColor &bgColor, const TQColor &fgColor)
{
uint fg_r = fgColor.red();
uint fg_g = fgColor.green();
uint fg_b = fgColor.blue();
- uint fg_a = qAlpha(fgColor.rgb());
+ uint fg_a = tqAlpha(fgColor.rgb());
uint bg_r = bgColor.red();
uint bg_g = bgColor.green();
uint bg_b = bgColor.blue();
- uint bg_a = qAlpha(bgColor.rgb());
+ uint bg_a = tqAlpha(bgColor.rgb());
uint ac = 65025 - (255 - fg_a) * (255 - bg_a);
uint res_r = ((255 - fg_a) * bg_r * bg_a + fg_a * fg_r * 255 + 127) / ac;
@@ -70,37 +70,37 @@ QColor blendColors(const QColor &bgColor, const QColor &fgColor)
uint res_b = ((255 - fg_a) * bg_b * bg_a + fg_a * fg_b * 255 + 127) / ac;
uint res_a = (ac+127)/255;
- return QColor(qRgba(res_r,res_g, res_b, res_a ));
+ return TQColor(tqRgba(res_r,res_g, res_b, res_a ));
}
-QImage tintImage(const QImage &img, const QColor &tintColor) {
+TQImage tintImage(const TQImage &img, const TQColor &tintColor) {
- QImage *result = new QImage(img.width(), img.height(), 32, 0, QImage::IgnoreEndian);
+ TQImage *result = new TQImage(img.width(), img.height(), 32, 0, TQImage::IgnoreEndian);
result->setAlphaBuffer( true );
register uint *data = (unsigned int*) img.bits();
register uint *resultData = (unsigned int*) result->bits();
register uint total = img.width()*img.height();
for ( uint current = 0 ; current < total ; ++current ) {
- resultData[ current ] = qRgba( tintColor.red(), tintColor.green(), tintColor.blue(), qAlpha( data[ current ] ));
+ resultData[ current ] = tqRgba( tintColor.red(), tintColor.green(), tintColor.blue(), tqAlpha( data[ current ] ));
}
return *result;
}
-QImage setImageOpacity(const QImage &img, const uint &p) {
- QImage *result = new QImage(img.width(), img.height(), 32, 0, QImage::IgnoreEndian);
+TQImage setImageOpacity(const TQImage &img, const uint &p) {
+ TQImage *result = new TQImage(img.width(), img.height(), 32, 0, TQImage::IgnoreEndian);
result->setAlphaBuffer( true );
register uint *data = (unsigned int*) img.bits();
register uint *resultData = (unsigned int*) result->bits();
register uint alpha;
register uint total = img.width()*img.height();
for ( uint current = 0 ; current < total ; ++current ) {
- alpha = qAlpha( data[ current ] ) * p / 100;
- resultData[ current ] = qRgba( qRed( data[ current ] ), qGreen( data[ current ] ), qBlue( data[ current ] ), alpha );
+ alpha = tqAlpha( data[ current ] ) * p / 100;
+ resultData[ current ] = tqRgba( tqRed( data[ current ] ), tqGreen( data[ current ] ), tqBlue( data[ current ] ), alpha );
}
return *result;
}
-bool blend( const QImage & upper, const QImage & lower, QImage & output)
+bool blend( const TQImage & upper, const TQImage & lower, TQImage & output)
// adopted from kimageeffect::blend - that is not endian safe and cannot handle complex alpha combinations...
{
if