From 11f31c37e5fa4889d9989f10272f44845449cb7b Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 6 Sep 2010 20:59:29 +0000 Subject: Initial TQt conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1172292 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/gui/general/PixmapFunctions.cpp | 114 ++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'src/gui/general/PixmapFunctions.cpp') diff --git a/src/gui/general/PixmapFunctions.cpp b/src/gui/general/PixmapFunctions.cpp index d297dad..f61ff11 100644 --- a/src/gui/general/PixmapFunctions.cpp +++ b/src/gui/general/PixmapFunctions.cpp @@ -25,11 +25,11 @@ #include "PixmapFunctions.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include @@ -37,10 +37,10 @@ namespace Rosegarden { QBitmap -PixmapFunctions::generateMask(const QPixmap &map, const QRgb &px) +PixmapFunctions::generateMask(const TQPixmap &map, const QRgb &px) { - QImage i(map.convertToImage()); - QImage im(i.width(), i.height(), 1, 2, QImage::LittleEndian); + TQImage i(map.convertToImage()); + TQImage im(i.width(), i.height(), 1, 2, TQImage::LittleEndian); for (int y = 0; y < i.height(); ++y) { for (int x = 0; x < i.width(); ++x) { @@ -52,16 +52,16 @@ PixmapFunctions::generateMask(const QPixmap &map, const QRgb &px) } } - QBitmap m; + TQBitmap m; m.convertFromImage(im); return m; } QBitmap -PixmapFunctions::generateMask(const QPixmap &map) +PixmapFunctions::generateMask(const TQPixmap &map) { - QImage i(map.convertToImage()); - QImage im(i.width(), i.height(), 1, 2, QImage::LittleEndian); + TQImage i(map.convertToImage()); + TQImage im(i.width(), i.height(), 1, 2, TQImage::LittleEndian); QRgb px0(i.pixel(0, 0)); QRgb px1(i.pixel(i.width() - 1, 0)); @@ -82,18 +82,18 @@ PixmapFunctions::generateMask(const QPixmap &map) } } - QBitmap m; + TQBitmap m; m.convertFromImage(im); return m; } QPixmap -PixmapFunctions::colourPixmap(const QPixmap &map, int hue, int minValue) +PixmapFunctions::colourPixmap(const TQPixmap &map, int hue, int minValue) { // assumes pixmap is currently in shades of grey; maps black -> // solid colour and greys -> shades of colour - QImage image = map.convertToImage(); + TQImage image = map.convertToImage(); int s, v; @@ -102,7 +102,7 @@ PixmapFunctions::colourPixmap(const QPixmap &map, int hue, int minValue) for (int y = 0; y < image.height(); ++y) { for (int x = 0; x < image.width(); ++x) { - QColor pixel(image.pixel(x, y)); + TQColor pixel(image.pixel(x, y)); int oldHue; pixel.hsv(&oldHue, &s, &v); @@ -118,59 +118,59 @@ PixmapFunctions::colourPixmap(const QPixmap &map, int hue, int minValue) } image.setPixel - (x, y, QColor(hue, + (x, y, TQColor(hue, 255 - v, v > minValue ? v : minValue, - QColor::Hsv).rgb()); + TQColor::Hsv).rgb()); } } - QPixmap rmap; + TQPixmap rmap; rmap.convertFromImage(image); - if (map.mask()) - rmap.setMask(*map.mask()); + if (map.tqmask()) + rmap.setMask(*map.tqmask()); return rmap; } QPixmap -PixmapFunctions::shadePixmap(const QPixmap &map) +PixmapFunctions::shadePixmap(const TQPixmap &map) { - QImage image = map.convertToImage(); + TQImage image = map.convertToImage(); int h, s, v; for (int y = 0; y < image.height(); ++y) { for (int x = 0; x < image.width(); ++x) { - QColor pixel(image.pixel(x, y)); + TQColor pixel(image.pixel(x, y)); pixel.hsv(&h, &s, &v); image.setPixel - (x, y, QColor(h, + (x, y, TQColor(h, s, 255 - ((255 - v) / 2), - QColor::Hsv).rgb()); + TQColor::Hsv).rgb()); } } - QPixmap rmap; + TQPixmap rmap; rmap.convertFromImage(image); - if (map.mask()) - rmap.setMask(*map.mask()); + if (map.tqmask()) + rmap.setMask(*map.tqmask()); return rmap; } QPixmap -PixmapFunctions::flipVertical(const QPixmap &map) +PixmapFunctions::flipVertical(const TQPixmap &map) { - QPixmap rmap; - QImage i(map.convertToImage()); + TQPixmap rmap; + TQImage i(map.convertToImage()); rmap.convertFromImage(i.mirror(false, true)); - if (map.mask()) { - QImage im(map.mask()->convertToImage()); - QBitmap newMask; + if (map.tqmask()) { + TQImage im(map.tqmask()->convertToImage()); + TQBitmap newMask; newMask.convertFromImage(im.mirror(false, true)); rmap.setMask(newMask); } @@ -179,15 +179,15 @@ PixmapFunctions::flipVertical(const QPixmap &map) } QPixmap -PixmapFunctions::flipHorizontal(const QPixmap &map) +PixmapFunctions::flipHorizontal(const TQPixmap &map) { - QPixmap rmap; - QImage i(map.convertToImage()); + TQPixmap rmap; + TQImage i(map.convertToImage()); rmap.convertFromImage(i.mirror(true, false)); - if (map.mask()) { - QImage im(map.mask()->convertToImage()); - QBitmap newMask; + if (map.tqmask()) { + TQImage im(map.tqmask()->convertToImage()); + TQBitmap newMask; newMask.convertFromImage(im.mirror(true, false)); rmap.setMask(newMask); } @@ -195,23 +195,23 @@ PixmapFunctions::flipHorizontal(const QPixmap &map) return rmap; } -std::pair -PixmapFunctions::splitPixmap(const QPixmap &pixmap, int x) +std::pair +PixmapFunctions::splitPixmap(const TQPixmap &pixmap, int x) { - QPixmap left(x, pixmap.height(), pixmap.depth()); - QBitmap leftMask(left.width(), left.height()); + TQPixmap left(x, pixmap.height(), pixmap.depth()); + TQBitmap leftMask(left.width(), left.height()); - QPixmap right(pixmap.width() - x, pixmap.height(), pixmap.depth()); - QBitmap rightMask(right.width(), right.height()); + TQPixmap right(pixmap.width() - x, pixmap.height(), pixmap.depth()); + TQBitmap rightMask(right.width(), right.height()); - QPainter paint; + TQPainter paint; paint.begin(&left); paint.drawPixmap(0, 0, pixmap, 0, 0, left.width(), left.height()); paint.end(); paint.begin(&leftMask); - paint.drawPixmap(0, 0, *pixmap.mask(), 0, 0, left.width(), left.height()); + paint.drawPixmap(0, 0, *pixmap.tqmask(), 0, 0, left.width(), left.height()); paint.end(); left.setMask(leftMask); @@ -221,23 +221,23 @@ PixmapFunctions::splitPixmap(const QPixmap &pixmap, int x) paint.end(); paint.begin(&rightMask); - paint.drawPixmap(0, 0, *pixmap.mask(), left.width(), 0, right.width(), right.height()); + paint.drawPixmap(0, 0, *pixmap.tqmask(), left.width(), 0, right.width(), right.height()); paint.end(); right.setMask(rightMask); - return std::pair(left, right); + return std::pair(left, right); } void -PixmapFunctions::drawPixmapMasked(QPixmap &dest, QBitmap &destMask, +PixmapFunctions::drawPixmapMasked(TQPixmap &dest, TQBitmap &destMask, int x0, int y0, - const QPixmap &src) + const TQPixmap &src) { - QImage idp(dest.convertToImage()); - QImage idm(destMask.convertToImage()); - QImage isp(src.convertToImage()); - QImage ism(src.mask()->convertToImage()); + TQImage idp(dest.convertToImage()); + TQImage idm(destMask.convertToImage()); + TQImage isp(src.convertToImage()); + TQImage ism(src.tqmask()->convertToImage()); for (int y = 0; y < isp.height(); ++y) { for (int x = 0; x < isp.width(); ++x) { -- cgit v1.2.1