summaryrefslogtreecommitdiffstats
path: root/krita/core/kis_brush.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /krita/core/kis_brush.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krita/core/kis_brush.cc')
-rw-r--r--krita/core/kis_brush.cc430
1 files changed, 215 insertions, 215 deletions
diff --git a/krita/core/kis_brush.cc b/krita/core/kis_brush.cc
index 57ee2584..a590248d 100644
--- a/krita/core/kis_brush.cc
+++ b/krita/core/kis_brush.cc
@@ -33,10 +33,10 @@
#include <stdlib.h>
#include <cfloat>
-#include <qfile.h>
-#include <qimage.h>
-#include <qpoint.h>
-#include <qvaluevector.h>
+#include <tqfile.h>
+#include <tqimage.h>
+#include <tqpoint.h>
+#include <tqvaluevector.h>
#include <kdebug.h>
#include <klocale.h>
@@ -45,7 +45,7 @@
#include "kis_paint_device.h"
#include "kis_global.h"
#include "kis_brush.h"
-#include "kis_alpha_mask.h"
+#include "kis_alpha_tqmask.h"
#include "kis_colorspace_factory_registry.h"
#include "kis_iterators_pixel.h"
#include "kis_image.h"
@@ -53,34 +53,34 @@
namespace {
struct GimpBrushV1Header {
- Q_UINT32 header_size; /* header_size = sizeof (BrushHeader) + brush name */
- Q_UINT32 version; /* brush file version # */
- Q_UINT32 width; /* width of brush */
- Q_UINT32 height; /* height of brush */
- Q_UINT32 bytes; /* depth of brush in bytes */
+ TQ_UINT32 header_size; /* header_size = sizeof (BrushHeader) + brush name */
+ TQ_UINT32 version; /* brush file version # */
+ TQ_UINT32 width; /* width of brush */
+ TQ_UINT32 height; /* height of brush */
+ TQ_UINT32 bytes; /* depth of brush in bytes */
};
/// All fields are in MSB on disk!
struct GimpBrushHeader {
- Q_UINT32 header_size; /* header_size = sizeof (BrushHeader) + brush name */
- Q_UINT32 version; /* brush file version # */
- Q_UINT32 width; /* width of brush */
- Q_UINT32 height; /* height of brush */
- Q_UINT32 bytes; /* depth of brush in bytes */
+ TQ_UINT32 header_size; /* header_size = sizeof (BrushHeader) + brush name */
+ TQ_UINT32 version; /* brush file version # */
+ TQ_UINT32 width; /* width of brush */
+ TQ_UINT32 height; /* height of brush */
+ TQ_UINT32 bytes; /* depth of brush in bytes */
/* The following are only defined in version 2 */
- Q_UINT32 magic_number; /* GIMP brush magic number */
- Q_UINT32 spacing; /* brush spacing as % of width & height, 0 - 1000 */
+ TQ_UINT32 magic_number; /* GIMP brush magic number */
+ TQ_UINT32 spacing; /* brush spacing as % of width & height, 0 - 1000 */
};
// Needed, or the GIMP won't open it!
- Q_UINT32 const GimpV2BrushMagic = ('G' << 24) + ('I' << 16) + ('M' << 8) + ('P' << 0);
+ TQ_UINT32 const GimpV2BrushMagic = ('G' << 24) + ('I' << 16) + ('M' << 8) + ('P' << 0);
}
#define DEFAULT_SPACING 0.25
#define MAXIMUM_SCALE 2
-KisBrush::KisBrush(const QString& filename) : super(filename)
+KisBrush::KisBrush(const TQString& filename) : super(filename)
{
m_brushType = INVALID;
m_ownData = true;
@@ -90,9 +90,9 @@ KisBrush::KisBrush(const QString& filename) : super(filename)
m_boundary = 0;
}
-KisBrush::KisBrush(const QString& filename,
- const QByteArray& data,
- Q_UINT32 & dataPos) : super(filename)
+KisBrush::KisBrush(const TQString& filename,
+ const TQByteArray& data,
+ TQ_UINT32 & dataPos) : super(filename)
{
m_brushType = INVALID;
m_ownData = false;
@@ -108,7 +108,7 @@ KisBrush::KisBrush(const QString& filename,
}
KisBrush::KisBrush(KisPaintDevice* image, int x, int y, int w, int h)
- : super(QString(""))
+ : super(TQString(""))
{
m_brushType = INVALID;
m_ownData = true;
@@ -120,8 +120,8 @@ KisBrush::KisBrush(KisPaintDevice* image, int x, int y, int w, int h)
initFromPaintDev(image, x, y, w, h);
}
-KisBrush::KisBrush(const QImage& image, const QString& name)
- : super(QString(""))
+KisBrush::KisBrush(const TQImage& image, const TQString& name)
+ : super(TQString(""))
{
m_ownData = false;
m_useColorAsMask = false;
@@ -144,7 +144,7 @@ KisBrush::~KisBrush()
bool KisBrush::load()
{
if (m_ownData) {
- QFile file(filename());
+ TQFile file(filename());
file.open(IO_ReadOnly);
m_data = file.readAll();
file.close();
@@ -194,17 +194,17 @@ bool KisBrush::init()
return false;
}
- QString name;
+ TQString name;
if (bh.version == 1) {
// Version 1 has no magic number or spacing, so the name
// is at a different offset. Character encoding is undefined.
const char *text = &m_data[sizeof(GimpBrushV1Header)];
- name = QString::fromAscii(text, bh.header_size - sizeof(GimpBrushV1Header));
+ name = TQString::fromAscii(text, bh.header_size - sizeof(GimpBrushV1Header));
} else {
// ### Version = 3->cinepaint; may be float16 data!
// Version >=2: UTF-8 encoding is used
- name = QString::fromUtf8(&m_data[sizeof(GimpBrushHeader)],
+ name = TQString::fromUtf8(&m_data[sizeof(GimpBrushHeader)],
bh.header_size - sizeof(GimpBrushHeader));
}
@@ -214,28 +214,28 @@ bool KisBrush::init()
return false;
}
- Q_INT32 k = bh.header_size;
+ TQ_INT32 k = bh.header_size;
if (bh.bytes == 1) {
// Grayscale
- if (static_cast<Q_UINT32>(k + bh.width * bh.height) > m_data.size()) {
+ if (static_cast<TQ_UINT32>(k + bh.width * bh.height) > m_data.size()) {
return false;
}
m_brushType = MASK;
m_hasColor = false;
- for (Q_UINT32 y = 0; y < bh.height; y++) {
- for (Q_UINT32 x = 0; x < bh.width; x++, k++) {
- Q_INT32 val = 255 - static_cast<uchar>(m_data[k]);
- m_img.setPixel(x, y, qRgb(val, val, val));
+ for (TQ_UINT32 y = 0; y < bh.height; y++) {
+ for (TQ_UINT32 x = 0; x < bh.width; x++, k++) {
+ TQ_INT32 val = 255 - static_cast<uchar>(m_data[k]);
+ m_img.setPixel(x, y, tqRgb(val, val, val));
}
}
} else if (bh.bytes == 4) {
// RGBA
- if (static_cast<Q_UINT32>(k + (bh.width * bh.height * 4)) > m_data.size()) {
+ if (static_cast<TQ_UINT32>(k + (bh.width * bh.height * 4)) > m_data.size()) {
return false;
}
@@ -243,9 +243,9 @@ bool KisBrush::init()
m_img.setAlphaBuffer(true);
m_hasColor = true;
- for (Q_UINT32 y = 0; y < bh.height; y++) {
- for (Q_UINT32 x = 0; x < bh.width; x++, k += 4) {
- m_img.setPixel(x, y, qRgba(m_data[k],
+ for (TQ_UINT32 y = 0; y < bh.height; y++) {
+ for (TQ_UINT32 x = 0; x < bh.width; x++, k += 4) {
+ m_img.setPixel(x, y, tqRgba(m_data[k],
m_data[k+1],
m_data[k+2],
m_data[k+3]));
@@ -274,7 +274,7 @@ bool KisBrush::init()
bool KisBrush::initFromPaintDev(KisPaintDevice* image, int x, int y, int w, int h) {
// Forcefully convert to RGBA8
// XXX profile and exposure?
- setImage(image->convertToQImage(0, x, y, w, h));
+ setImage(image->convertToTQImage(0, x, y, w, h));
setName(image->name());
m_brushType = IMAGE;
@@ -285,19 +285,19 @@ bool KisBrush::initFromPaintDev(KisPaintDevice* image, int x, int y, int w, int
bool KisBrush::save()
{
- QFile file(filename());
+ TQFile file(filename());
file.open(IO_WriteOnly | IO_Truncate);
bool ok = saveToDevice(&file);
file.close();
return ok;
}
-bool KisBrush::saveToDevice(QIODevice* dev) const
+bool KisBrush::saveToDevice(TQIODevice* dev) const
{
GimpBrushHeader bh;
- QCString utf8Name = name().utf8(); // Names in v2 brushes are in UTF-8
+ TQCString utf8Name = name().utf8(); // Names in v2 brushes are in UTF-8
char const* name = utf8Name.data();
- int nameLength = qstrlen(name);
+ int nameLength = tqstrlen(name);
int wrote;
bh.header_size = htonl(sizeof(GimpBrushHeader) + nameLength);
@@ -310,10 +310,10 @@ bool KisBrush::saveToDevice(QIODevice* dev) const
else
bh.bytes = htonl(4);
bh.magic_number = htonl(GimpV2BrushMagic);
- bh.spacing = htonl(static_cast<Q_UINT32>(spacing() * 100.0));
+ bh.spacing = htonl(static_cast<TQ_UINT32>(spacing() * 100.0));
// Write header: first bh, then the name
- QByteArray bytes;
+ TQByteArray bytes;
bytes.setRawData(reinterpret_cast<char*>(&bh), sizeof(GimpBrushHeader));
wrote = dev->writeBlock(bytes);
bytes.resetRawData(reinterpret_cast<char*>(&bh), sizeof(GimpBrushHeader));
@@ -329,22 +329,22 @@ bool KisBrush::saveToDevice(QIODevice* dev) const
if (!hasColor()) {
bytes.resize(width() * height());
- for (Q_INT32 y = 0; y < height(); y++) {
- for (Q_INT32 x = 0; x < width(); x++) {
- QRgb c = m_img.pixel(x, y);
- bytes[k++] = static_cast<char>(255 - qRed(c)); // red == blue == green
+ for (TQ_INT32 y = 0; y < height(); y++) {
+ for (TQ_INT32 x = 0; x < width(); x++) {
+ TQRgb c = m_img.pixel(x, y);
+ bytes[k++] = static_cast<char>(255 - tqRed(c)); // red == blue == green
}
}
} else {
bytes.resize(width() * height() * 4);
- for (Q_INT32 y = 0; y < height(); y++) {
- for (Q_INT32 x = 0; x < width(); x++) {
+ for (TQ_INT32 y = 0; y < height(); y++) {
+ for (TQ_INT32 x = 0; x < width(); x++) {
// order for gimp brushes, v2 is: RGBA
- QRgb pixel = m_img.pixel(x,y);
- bytes[k++] = static_cast<char>(qRed(pixel));
- bytes[k++] = static_cast<char>(qGreen(pixel));
- bytes[k++] = static_cast<char>(qBlue(pixel));
- bytes[k++] = static_cast<char>(qAlpha(pixel));
+ TQRgb pixel = m_img.pixel(x,y);
+ bytes[k++] = static_cast<char>(tqRed(pixel));
+ bytes[k++] = static_cast<char>(tqGreen(pixel));
+ bytes[k++] = static_cast<char>(tqBlue(pixel));
+ bytes[k++] = static_cast<char>(tqAlpha(pixel));
}
}
}
@@ -356,18 +356,18 @@ bool KisBrush::saveToDevice(QIODevice* dev) const
return true;
}
-QImage KisBrush::img()
+TQImage KisBrush::img()
{
- QImage image = m_img;
+ TQImage image = m_img;
if (hasColor() && useColorAsMask()) {
image.detach();
for (int x = 0; x < image.width(); x++) {
for (int y = 0; y < image.height(); y++) {
- QRgb c = image.pixel(x, y);
- int a = (qGray(c) * qAlpha(c)) / 255;
- image.setPixel(x, y, qRgba(a, 0, a, a));
+ TQRgb c = image.pixel(x, y);
+ int a = (tqGray(c) * tqAlpha(c)) / 255;
+ image.setPixel(x, y, tqRgba(a, 0, a, a));
}
}
}
@@ -375,7 +375,7 @@ QImage KisBrush::img()
return image;
}
-KisAlphaMaskSP KisBrush::mask(const KisPaintInformation& info, double subPixelX, double subPixelY) const
+KisAlphaMaskSP KisBrush::tqmask(const KisPaintInformation& info, double subPixelX, double subPixelY) const
{
if (m_scaledBrushes.isEmpty()) {
createScaledBrushes();
@@ -392,7 +392,7 @@ KisAlphaMaskSP KisBrush::mask(const KisPaintInformation& info, double subPixelX,
KisAlphaMaskSP outputMask = 0;
if (belowBrush != 0) {
- // We're in between two masks. Interpolate between them.
+ // We're in between two tqmasks. Interpolate between them.
KisAlphaMaskSP scaledAboveMask = scaleMask(aboveBrush, scale, subPixelX, subPixelY);
KisAlphaMaskSP scaledBelowMask = scaleMask(belowBrush, scale, subPixelX, subPixelY);
@@ -405,9 +405,9 @@ KisAlphaMaskSP KisBrush::mask(const KisPaintInformation& info, double subPixelX,
// Exact match.
outputMask = scaleMask(aboveBrush, scale, subPixelX, subPixelY);
} else {
- // We are smaller than the smallest mask, which is always 1x1.
+ // We are smaller than the smallest tqmask, which is always 1x1.
double s = scale / aboveBrush->scale();
- outputMask = scaleSinglePixelMask(s, aboveBrush->mask()->alphaAt(0, 0), subPixelX, subPixelY);
+ outputMask = scaleSinglePixelMask(s, aboveBrush->tqmask()->alphaAt(0, 0), subPixelX, subPixelY);
}
}
@@ -428,13 +428,13 @@ KisPaintDeviceSP KisBrush::image(KisColorSpace * /*colorSpace*/, const KisPaintI
findScaledBrushes(scale, &aboveBrush, &belowBrush);
Q_ASSERT(aboveBrush != 0);
- QImage outputImage;
+ TQImage outputImage;
if (belowBrush != 0) {
// We're in between two brushes. Interpolate between them.
- QImage scaledAboveImage = scaleImage(aboveBrush, scale, subPixelX, subPixelY);
- QImage scaledBelowImage = scaleImage(belowBrush, scale, subPixelX, subPixelY);
+ TQImage scaledAboveImage = scaleImage(aboveBrush, scale, subPixelX, subPixelY);
+ TQImage scaledBelowImage = scaleImage(belowBrush, scale, subPixelX, subPixelY);
double t = (scale - belowBrush->scale()) / (aboveBrush->scale() - belowBrush->scale());
@@ -460,13 +460,13 @@ KisPaintDeviceSP KisBrush::image(KisColorSpace * /*colorSpace*/, const KisPaintI
for (int y = 0; y < outputHeight; y++) {
KisHLineIterator iter = layer->createHLineIterator( 0, y, outputWidth, true);
for (int x = 0; x < outputWidth; x++) {
- Q_UINT8 * p = iter.rawData();
+ TQ_UINT8 * p = iter.rawData();
- QRgb pixel = outputImage.pixel(x, y);
- int red = qRed(pixel);
- int green = qGreen(pixel);
- int blue = qBlue(pixel);
- int alpha = qAlpha(pixel);
+ TQRgb pixel = outputImage.pixel(x, y);
+ int red = tqRed(pixel);
+ int green = tqGreen(pixel);
+ int blue = tqBlue(pixel);
+ int alpha = tqAlpha(pixel);
// Scaled images are in pre-multiplied alpha form so
// divide by alpha.
@@ -550,7 +550,7 @@ void KisBrush::createScaledBrushes() const
int width = m_img.width() * MAXIMUM_SCALE;
int height = m_img.height() * MAXIMUM_SCALE;
- QImage scaledImage;
+ TQImage scaledImage;
while (true) {
@@ -569,7 +569,7 @@ void KisBrush::createScaledBrushes() const
double yScale = static_cast<double>(height) / m_img.height();
double scale = xScale;
- m_scaledBrushes.append(ScaledBrush(scaledMask, hasColor() ? scaledImage : QImage(), scale, xScale, yScale));
+ m_scaledBrushes.append(ScaledBrush(scaledMask, hasColor() ? scaledImage : TQImage(), scale, xScale, yScale));
if (width == 1 && height == 1) {
break;
@@ -608,16 +608,16 @@ double KisBrush::scaleForPressure(double pressure)
return scale;
}
-Q_INT32 KisBrush::maskWidth(const KisPaintInformation& info) const
+TQ_INT32 KisBrush::tqmaskWidth(const KisPaintInformation& info) const
{
// Add one for sub-pixel shift
- return static_cast<Q_INT32>(ceil(width() * scaleForPressure(info.pressure)) + 1);
+ return static_cast<TQ_INT32>(ceil(width() * scaleForPressure(info.pressure)) + 1);
}
-Q_INT32 KisBrush::maskHeight(const KisPaintInformation& info) const
+TQ_INT32 KisBrush::tqmaskHeight(const KisPaintInformation& info) const
{
// Add one for sub-pixel shift
- return static_cast<Q_INT32>(ceil(height() * scaleForPressure(info.pressure)) + 1);
+ return static_cast<TQ_INT32>(ceil(height() * scaleForPressure(info.pressure)) + 1);
}
KisAlphaMaskSP KisBrush::scaleMask(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const
@@ -629,7 +629,7 @@ KisAlphaMaskSP KisBrush::scaleMask(const ScaledBrush *srcBrush, double scale, do
KisAlphaMaskSP dstMask = new KisAlphaMask(dstWidth, dstHeight);
Q_CHECK_PTR(dstMask);
- KisAlphaMaskSP srcMask = srcBrush->mask();
+ KisAlphaMaskSP srcMask = srcBrush->tqmask();
// Compute scales to map the scaled brush onto the required scale.
double xScale = srcBrush->xScale() / scale;
@@ -663,10 +663,10 @@ KisAlphaMaskSP KisBrush::scaleMask(const ScaledBrush *srcBrush, double scale, do
double yInterp = srcY - topY;
- Q_UINT8 topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcMask->alphaAt(leftX, topY) : OPACITY_TRANSPARENT;
- Q_UINT8 bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcMask->alphaAt(leftX, topY + 1) : OPACITY_TRANSPARENT;
- Q_UINT8 topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcMask->alphaAt(leftX + 1, topY) : OPACITY_TRANSPARENT;
- Q_UINT8 bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcMask->alphaAt(leftX + 1, topY + 1) : OPACITY_TRANSPARENT;
+ TQ_UINT8 topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcMask->alphaAt(leftX, topY) : OPACITY_TRANSPARENT;
+ TQ_UINT8 bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcMask->alphaAt(leftX, topY + 1) : OPACITY_TRANSPARENT;
+ TQ_UINT8 topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcMask->alphaAt(leftX + 1, topY) : OPACITY_TRANSPARENT;
+ TQ_UINT8 bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcMask->alphaAt(leftX + 1, topY + 1) : OPACITY_TRANSPARENT;
double a = 1 - xInterp;
double b = 1 - yInterp;
@@ -685,23 +685,23 @@ KisAlphaMaskSP KisBrush::scaleMask(const ScaledBrush *srcBrush, double scale, do
d = OPACITY_OPAQUE;
}
- dstMask->setAlphaAt(dstX, dstY, static_cast<Q_UINT8>(d));
+ dstMask->setAlphaAt(dstX, dstY, static_cast<TQ_UINT8>(d));
}
}
return dstMask;
}
-QImage KisBrush::scaleImage(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const
+TQImage KisBrush::scaleImage(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const
{
// Add one pixel for sub-pixel shifting
int dstWidth = static_cast<int>(ceil(scale * width())) + 1;
int dstHeight = static_cast<int>(ceil(scale * height())) + 1;
- QImage dstImage(dstWidth, dstHeight, 32);
+ TQImage dstImage(dstWidth, dstHeight, 32);
dstImage.setAlphaBuffer(true);
- const QImage srcImage = srcBrush->image();
+ const TQImage srcImage = srcBrush->image();
// Compute scales to map the scaled brush onto the required scale.
double xScale = srcBrush->xScale() / scale;
@@ -735,31 +735,31 @@ QImage KisBrush::scaleImage(const ScaledBrush *srcBrush, double scale, double su
double yInterp = srcY - topY;
- QRgb topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX, topY) : qRgba(0, 0, 0, 0);
- QRgb bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX, topY + 1) : qRgba(0, 0, 0, 0);
- QRgb topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX + 1, topY) : qRgba(0, 0, 0, 0);
- QRgb bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX + 1, topY + 1) : qRgba(0, 0, 0, 0);
+ TQRgb topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX, topY) : tqRgba(0, 0, 0, 0);
+ TQRgb bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX, topY + 1) : tqRgba(0, 0, 0, 0);
+ TQRgb topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX + 1, topY) : tqRgba(0, 0, 0, 0);
+ TQRgb bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX + 1, topY + 1) : tqRgba(0, 0, 0, 0);
double a = 1 - xInterp;
double b = 1 - yInterp;
// Bi-linear interpolation. Image is pre-multiplied by alpha.
- int red = static_cast<int>(a * b * qRed(topLeft)
- + a * (1 - b) * qRed(bottomLeft)
- + (1 - a) * b * qRed(topRight)
- + (1 - a) * (1 - b) * qRed(bottomRight) + 0.5);
- int green = static_cast<int>(a * b * qGreen(topLeft)
- + a * (1 - b) * qGreen(bottomLeft)
- + (1 - a) * b * qGreen(topRight)
- + (1 - a) * (1 - b) * qGreen(bottomRight) + 0.5);
- int blue = static_cast<int>(a * b * qBlue(topLeft)
- + a * (1 - b) * qBlue(bottomLeft)
- + (1 - a) * b * qBlue(topRight)
- + (1 - a) * (1 - b) * qBlue(bottomRight) + 0.5);
- int alpha = static_cast<int>(a * b * qAlpha(topLeft)
- + a * (1 - b) * qAlpha(bottomLeft)
- + (1 - a) * b * qAlpha(topRight)
- + (1 - a) * (1 - b) * qAlpha(bottomRight) + 0.5);
+ int red = static_cast<int>(a * b * tqRed(topLeft)
+ + a * (1 - b) * tqRed(bottomLeft)
+ + (1 - a) * b * tqRed(topRight)
+ + (1 - a) * (1 - b) * tqRed(bottomRight) + 0.5);
+ int green = static_cast<int>(a * b * tqGreen(topLeft)
+ + a * (1 - b) * tqGreen(bottomLeft)
+ + (1 - a) * b * tqGreen(topRight)
+ + (1 - a) * (1 - b) * tqGreen(bottomRight) + 0.5);
+ int blue = static_cast<int>(a * b * tqBlue(topLeft)
+ + a * (1 - b) * tqBlue(bottomLeft)
+ + (1 - a) * b * tqBlue(topRight)
+ + (1 - a) * (1 - b) * tqBlue(bottomRight) + 0.5);
+ int alpha = static_cast<int>(a * b * tqAlpha(topLeft)
+ + a * (1 - b) * tqAlpha(bottomLeft)
+ + (1 - a) * b * tqAlpha(topRight)
+ + (1 - a) * (1 - b) * tqAlpha(bottomRight) + 0.5);
if (red < 0) {
red = 0;
@@ -793,17 +793,17 @@ QImage KisBrush::scaleImage(const ScaledBrush *srcBrush, double scale, double su
alpha = 255;
}
- dstImage.setPixel(dstX, dstY, qRgba(red, green, blue, alpha));
+ dstImage.setPixel(dstX, dstY, tqRgba(red, green, blue, alpha));
}
}
return dstImage;
}
-QImage KisBrush::scaleImage(const QImage& srcImage, int width, int height)
+TQImage KisBrush::scaleImage(const TQImage& srcImage, int width, int height)
{
- QImage scaledImage;
- //QString filename;
+ TQImage scaledImage;
+ //TQString filename;
int srcWidth = srcImage.width();
int srcHeight = srcImage.height();
@@ -816,7 +816,7 @@ QImage KisBrush::scaleImage(const QImage& srcImage, int width, int height)
// or scaling it to less than half size.
scaledImage = srcImage.smoothScale(width, height);
- //filename = QString("smoothScale_%1x%2.png").arg(width).arg(height);
+ //filename = TQString("smoothScale_%1x%2.png").tqarg(width).tqarg(height);
}
else {
scaledImage.create(width, height, 32);
@@ -847,10 +847,10 @@ QImage KisBrush::scaleImage(const QImage& srcImage, int width, int height)
double yInterp = srcY - topY;
- QRgb topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX, topY) : qRgba(0, 0, 0, 0);
- QRgb bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX, topY + 1) : qRgba(0, 0, 0, 0);
- QRgb topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX + 1, topY) : qRgba(0, 0, 0, 0);
- QRgb bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX + 1, topY + 1) : qRgba(0, 0, 0, 0);
+ TQRgb topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX, topY) : tqRgba(0, 0, 0, 0);
+ TQRgb bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX, topY + 1) : tqRgba(0, 0, 0, 0);
+ TQRgb topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX + 1, topY) : tqRgba(0, 0, 0, 0);
+ TQRgb bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX + 1, topY + 1) : tqRgba(0, 0, 0, 0);
double a = 1 - xInterp;
double b = 1 - yInterp;
@@ -861,22 +861,22 @@ QImage KisBrush::scaleImage(const QImage& srcImage, int width, int height)
int alpha;
if (srcImage.hasAlphaBuffer()) {
- red = static_cast<int>(a * b * qRed(topLeft) * qAlpha(topLeft)
- + a * (1 - b) * qRed(bottomLeft) * qAlpha(bottomLeft)
- + (1 - a) * b * qRed(topRight) * qAlpha(topRight)
- + (1 - a) * (1 - b) * qRed(bottomRight) * qAlpha(bottomRight) + 0.5);
- green = static_cast<int>(a * b * qGreen(topLeft) * qAlpha(topLeft)
- + a * (1 - b) * qGreen(bottomLeft) * qAlpha(bottomLeft)
- + (1 - a) * b * qGreen(topRight) * qAlpha(topRight)
- + (1 - a) * (1 - b) * qGreen(bottomRight) * qAlpha(bottomRight) + 0.5);
- blue = static_cast<int>(a * b * qBlue(topLeft) * qAlpha(topLeft)
- + a * (1 - b) * qBlue(bottomLeft) * qAlpha(bottomLeft)
- + (1 - a) * b * qBlue(topRight) * qAlpha(topRight)
- + (1 - a) * (1 - b) * qBlue(bottomRight) * qAlpha(bottomRight) + 0.5);
- alpha = static_cast<int>(a * b * qAlpha(topLeft)
- + a * (1 - b) * qAlpha(bottomLeft)
- + (1 - a) * b * qAlpha(topRight)
- + (1 - a) * (1 - b) * qAlpha(bottomRight) + 0.5);
+ red = static_cast<int>(a * b * tqRed(topLeft) * tqAlpha(topLeft)
+ + a * (1 - b) * tqRed(bottomLeft) * tqAlpha(bottomLeft)
+ + (1 - a) * b * tqRed(topRight) * tqAlpha(topRight)
+ + (1 - a) * (1 - b) * tqRed(bottomRight) * tqAlpha(bottomRight) + 0.5);
+ green = static_cast<int>(a * b * tqGreen(topLeft) * tqAlpha(topLeft)
+ + a * (1 - b) * tqGreen(bottomLeft) * tqAlpha(bottomLeft)
+ + (1 - a) * b * tqGreen(topRight) * tqAlpha(topRight)
+ + (1 - a) * (1 - b) * tqGreen(bottomRight) * tqAlpha(bottomRight) + 0.5);
+ blue = static_cast<int>(a * b * tqBlue(topLeft) * tqAlpha(topLeft)
+ + a * (1 - b) * tqBlue(bottomLeft) * tqAlpha(bottomLeft)
+ + (1 - a) * b * tqBlue(topRight) * tqAlpha(topRight)
+ + (1 - a) * (1 - b) * tqBlue(bottomRight) * tqAlpha(bottomRight) + 0.5);
+ alpha = static_cast<int>(a * b * tqAlpha(topLeft)
+ + a * (1 - b) * tqAlpha(bottomLeft)
+ + (1 - a) * b * tqAlpha(topRight)
+ + (1 - a) * (1 - b) * tqAlpha(bottomRight) + 0.5);
if (alpha != 0) {
red /= alpha;
@@ -885,18 +885,18 @@ QImage KisBrush::scaleImage(const QImage& srcImage, int width, int height)
}
}
else {
- red = static_cast<int>(a * b * qRed(topLeft)
- + a * (1 - b) * qRed(bottomLeft)
- + (1 - a) * b * qRed(topRight)
- + (1 - a) * (1 - b) * qRed(bottomRight) + 0.5);
- green = static_cast<int>(a * b * qGreen(topLeft)
- + a * (1 - b) * qGreen(bottomLeft)
- + (1 - a) * b * qGreen(topRight)
- + (1 - a) * (1 - b) * qGreen(bottomRight) + 0.5);
- blue = static_cast<int>(a * b * qBlue(topLeft)
- + a * (1 - b) * qBlue(bottomLeft)
- + (1 - a) * b * qBlue(topRight)
- + (1 - a) * (1 - b) * qBlue(bottomRight) + 0.5);
+ red = static_cast<int>(a * b * tqRed(topLeft)
+ + a * (1 - b) * tqRed(bottomLeft)
+ + (1 - a) * b * tqRed(topRight)
+ + (1 - a) * (1 - b) * tqRed(bottomRight) + 0.5);
+ green = static_cast<int>(a * b * tqGreen(topLeft)
+ + a * (1 - b) * tqGreen(bottomLeft)
+ + (1 - a) * b * tqGreen(topRight)
+ + (1 - a) * (1 - b) * tqGreen(bottomRight) + 0.5);
+ blue = static_cast<int>(a * b * tqBlue(topLeft)
+ + a * (1 - b) * tqBlue(bottomLeft)
+ + (1 - a) * b * tqBlue(topRight)
+ + (1 - a) * (1 - b) * tqBlue(bottomRight) + 0.5);
alpha = 255;
}
@@ -932,11 +932,11 @@ QImage KisBrush::scaleImage(const QImage& srcImage, int width, int height)
alpha = 255;
}
- scaledImage.setPixel(dstX, dstY, qRgba(red, green, blue, alpha));
+ scaledImage.setPixel(dstX, dstY, tqRgba(red, green, blue, alpha));
}
}
- //filename = QString("bilinear_%1x%2.png").arg(width).arg(height);
+ //filename = TQString("bilinear_%1x%2.png").tqarg(width).tqarg(height);
}
//scaledImage.save(filename, "PNG");
@@ -971,7 +971,7 @@ void KisBrush::findScaledBrushes(double scale, const ScaledBrush **aboveBrush, c
}
}
-KisAlphaMaskSP KisBrush::scaleSinglePixelMask(double scale, Q_UINT8 maskValue, double subPixelX, double subPixelY)
+KisAlphaMaskSP KisBrush::scaleSinglePixelMask(double scale, TQ_UINT8 tqmaskValue, double subPixelX, double subPixelY)
{
int srcWidth = 1;
int srcHeight = 1;
@@ -986,10 +986,10 @@ KisAlphaMaskSP KisBrush::scaleSinglePixelMask(double scale, Q_UINT8 maskValue, d
for (int y = 0; y < dstHeight; y++) {
for (int x = 0; x < dstWidth; x++) {
- Q_UINT8 topLeft = (x > 0 && y > 0) ? maskValue : OPACITY_TRANSPARENT;
- Q_UINT8 bottomLeft = (x > 0 && y < srcHeight) ? maskValue : OPACITY_TRANSPARENT;
- Q_UINT8 topRight = (x < srcWidth && y > 0) ? maskValue : OPACITY_TRANSPARENT;
- Q_UINT8 bottomRight = (x < srcWidth && y < srcHeight) ? maskValue : OPACITY_TRANSPARENT;
+ TQ_UINT8 topLeft = (x > 0 && y > 0) ? tqmaskValue : OPACITY_TRANSPARENT;
+ TQ_UINT8 bottomLeft = (x > 0 && y < srcHeight) ? tqmaskValue : OPACITY_TRANSPARENT;
+ TQ_UINT8 topRight = (x < srcWidth && y > 0) ? tqmaskValue : OPACITY_TRANSPARENT;
+ TQ_UINT8 bottomRight = (x < srcWidth && y < srcHeight) ? tqmaskValue : OPACITY_TRANSPARENT;
// Bi-linear interpolation
int d = static_cast<int>(a * b * topLeft
@@ -1009,21 +1009,21 @@ KisAlphaMaskSP KisBrush::scaleSinglePixelMask(double scale, Q_UINT8 maskValue, d
d = OPACITY_OPAQUE;
}
- outputMask->setAlphaAt(x, y, static_cast<Q_UINT8>(d));
+ outputMask->setAlphaAt(x, y, static_cast<TQ_UINT8>(d));
}
}
return outputMask;
}
-QImage KisBrush::scaleSinglePixelImage(double scale, QRgb pixel, double subPixelX, double subPixelY)
+TQImage KisBrush::scaleSinglePixelImage(double scale, TQRgb pixel, double subPixelX, double subPixelY)
{
int srcWidth = 1;
int srcHeight = 1;
int dstWidth = 2;
int dstHeight = 2;
- QImage outputImage(dstWidth, dstHeight, 32);
+ TQImage outputImage(dstWidth, dstHeight, 32);
outputImage.setAlphaBuffer(true);
double a = subPixelX;
@@ -1032,28 +1032,28 @@ QImage KisBrush::scaleSinglePixelImage(double scale, QRgb pixel, double subPixel
for (int y = 0; y < dstHeight; y++) {
for (int x = 0; x < dstWidth; x++) {
- QRgb topLeft = (x > 0 && y > 0) ? pixel : qRgba(0, 0, 0, 0);
- QRgb bottomLeft = (x > 0 && y < srcHeight) ? pixel : qRgba(0, 0, 0, 0);
- QRgb topRight = (x < srcWidth && y > 0) ? pixel : qRgba(0, 0, 0, 0);
- QRgb bottomRight = (x < srcWidth && y < srcHeight) ? pixel : qRgba(0, 0, 0, 0);
+ TQRgb topLeft = (x > 0 && y > 0) ? pixel : tqRgba(0, 0, 0, 0);
+ TQRgb bottomLeft = (x > 0 && y < srcHeight) ? pixel : tqRgba(0, 0, 0, 0);
+ TQRgb topRight = (x < srcWidth && y > 0) ? pixel : tqRgba(0, 0, 0, 0);
+ TQRgb bottomRight = (x < srcWidth && y < srcHeight) ? pixel : tqRgba(0, 0, 0, 0);
// Bi-linear interpolation. Images are in pre-multiplied form.
- int red = static_cast<int>(a * b * qRed(topLeft)
- + a * (1 - b) * qRed(bottomLeft)
- + (1 - a) * b * qRed(topRight)
- + (1 - a) * (1 - b) * qRed(bottomRight) + 0.5);
- int green = static_cast<int>(a * b * qGreen(topLeft)
- + a * (1 - b) * qGreen(bottomLeft)
- + (1 - a) * b * qGreen(topRight)
- + (1 - a) * (1 - b) * qGreen(bottomRight) + 0.5);
- int blue = static_cast<int>(a * b * qBlue(topLeft)
- + a * (1 - b) * qBlue(bottomLeft)
- + (1 - a) * b * qBlue(topRight)
- + (1 - a) * (1 - b) * qBlue(bottomRight) + 0.5);
- int alpha = static_cast<int>(a * b * qAlpha(topLeft)
- + a * (1 - b) * qAlpha(bottomLeft)
- + (1 - a) * b * qAlpha(topRight)
- + (1 - a) * (1 - b) * qAlpha(bottomRight) + 0.5);
+ int red = static_cast<int>(a * b * tqRed(topLeft)
+ + a * (1 - b) * tqRed(bottomLeft)
+ + (1 - a) * b * tqRed(topRight)
+ + (1 - a) * (1 - b) * tqRed(bottomRight) + 0.5);
+ int green = static_cast<int>(a * b * tqGreen(topLeft)
+ + a * (1 - b) * tqGreen(bottomLeft)
+ + (1 - a) * b * tqGreen(topRight)
+ + (1 - a) * (1 - b) * tqGreen(bottomRight) + 0.5);
+ int blue = static_cast<int>(a * b * tqBlue(topLeft)
+ + a * (1 - b) * tqBlue(bottomLeft)
+ + (1 - a) * b * tqBlue(topRight)
+ + (1 - a) * (1 - b) * tqBlue(bottomRight) + 0.5);
+ int alpha = static_cast<int>(a * b * tqAlpha(topLeft)
+ + a * (1 - b) * tqAlpha(bottomLeft)
+ + (1 - a) * b * tqAlpha(topRight)
+ + (1 - a) * (1 - b) * tqAlpha(bottomRight) + 0.5);
// Multiply by the square of the scale because a 0.5x0.5 pixel
// has 0.25 the value of the 1x1.
@@ -1097,14 +1097,14 @@ QImage KisBrush::scaleSinglePixelImage(double scale, QRgb pixel, double subPixel
alpha = 255;
}
- outputImage.setPixel(x, y, qRgba(red, green, blue, alpha));
+ outputImage.setPixel(x, y, tqRgba(red, green, blue, alpha));
}
}
return outputImage;
}
-QImage KisBrush::interpolate(const QImage& image1, const QImage& image2, double t)
+TQImage KisBrush::interpolate(const TQImage& image1, const TQImage& image2, double t)
{
Q_ASSERT((image1.width() == image2.width()) && (image1.height() == image2.height()));
Q_ASSERT(t > -DBL_EPSILON && t < 1 + DBL_EPSILON);
@@ -1112,19 +1112,19 @@ QImage KisBrush::interpolate(const QImage& image1, const QImage& image2, double
int width = image1.width();
int height = image1.height();
- QImage outputImage(width, height, 32);
+ TQImage outputImage(width, height, 32);
outputImage.setAlphaBuffer(true);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
- QRgb image1pixel = image1.pixel(x, y);
- QRgb image2pixel = image2.pixel(x, y);
+ TQRgb image1pixel = image1.pixel(x, y);
+ TQRgb image2pixel = image2.pixel(x, y);
// Images are in pre-multiplied alpha format.
- int red = static_cast<int>((1 - t) * qRed(image1pixel) + t * qRed(image2pixel) + 0.5);
- int green = static_cast<int>((1 - t) * qGreen(image1pixel) + t * qGreen(image2pixel) + 0.5);
- int blue = static_cast<int>((1 - t) * qBlue(image1pixel) + t * qBlue(image2pixel) + 0.5);
- int alpha = static_cast<int>((1 - t) * qAlpha(image1pixel) + t * qAlpha(image2pixel) + 0.5);
+ int red = static_cast<int>((1 - t) * tqRed(image1pixel) + t * tqRed(image2pixel) + 0.5);
+ int green = static_cast<int>((1 - t) * tqGreen(image1pixel) + t * tqGreen(image2pixel) + 0.5);
+ int blue = static_cast<int>((1 - t) * tqBlue(image1pixel) + t * tqBlue(image2pixel) + 0.5);
+ int alpha = static_cast<int>((1 - t) * tqAlpha(image1pixel) + t * tqAlpha(image2pixel) + 0.5);
if (red < 0) {
red = 0;
@@ -1158,7 +1158,7 @@ QImage KisBrush::interpolate(const QImage& image1, const QImage& image2, double
alpha = 255;
}
- outputImage.setPixel(x, y, qRgba(red, green, blue, alpha));
+ outputImage.setPixel(x, y, tqRgba(red, green, blue, alpha));
}
}
@@ -1167,16 +1167,16 @@ QImage KisBrush::interpolate(const QImage& image1, const QImage& image2, double
KisBrush::ScaledBrush::ScaledBrush()
{
- m_mask = 0;
- m_image = QImage();
+ m_tqmask = 0;
+ m_image = TQImage();
m_scale = 1;
m_xScale = 1;
m_yScale = 1;
}
-KisBrush::ScaledBrush::ScaledBrush(KisAlphaMaskSP scaledMask, const QImage& scaledImage, double scale, double xScale, double yScale)
+KisBrush::ScaledBrush::ScaledBrush(KisAlphaMaskSP scaledMask, const TQImage& scaledImage, double scale, double xScale, double yScale)
{
- m_mask = scaledMask;
+ m_tqmask = scaledMask;
m_image = scaledImage;
m_scale = scale;
m_xScale = xScale;
@@ -1190,24 +1190,24 @@ KisBrush::ScaledBrush::ScaledBrush(KisAlphaMaskSP scaledMask, const QImage& scal
for (int y = 0; y < m_image.height(); y++) {
for (int x = 0; x < m_image.width(); x++) {
- QRgb pixel = m_image.pixel(x, y);
+ TQRgb pixel = m_image.pixel(x, y);
- int red = qRed(pixel);
- int green = qGreen(pixel);
- int blue = qBlue(pixel);
- int alpha = qAlpha(pixel);
+ int red = tqRed(pixel);
+ int green = tqGreen(pixel);
+ int blue = tqBlue(pixel);
+ int alpha = tqAlpha(pixel);
red = (red * alpha) / 255;
green = (green * alpha) / 255;
blue = (blue * alpha) / 255;
- m_image.setPixel(x, y, qRgba(red, green, blue, alpha));
+ m_image.setPixel(x, y, tqRgba(red, green, blue, alpha));
}
}
}
}
-void KisBrush::setImage(const QImage& img)
+void KisBrush::setImage(const TQImage& img)
{
m_img = img;
m_img.detach();
@@ -1220,49 +1220,49 @@ void KisBrush::setImage(const QImage& img)
setValid(true);
}
-Q_INT32 KisBrush::width() const
+TQ_INT32 KisBrush::width() const
{
return m_width;
}
-void KisBrush::setWidth(Q_INT32 w)
+void KisBrush::setWidth(TQ_INT32 w)
{
m_width = w;
}
-Q_INT32 KisBrush::height() const
+TQ_INT32 KisBrush::height() const
{
return m_height;
}
-void KisBrush::setHeight(Q_INT32 h)
+void KisBrush::setHeight(TQ_INT32 h)
{
m_height = h;
}
-/*QImage KisBrush::outline(double pressure) {
+/*TQImage KisBrush::outline(double pressure) {
KisLayerSP layer = image(KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("RGBA",""),""),
KisPaintInformation(pressure));
KisBoundary bounds(layer.data());
- int w = maskWidth(pressure);
- int h = maskHeight(pressure);
+ int w = tqmaskWidth(pressure);
+ int h = tqmaskHeight(pressure);
bounds.generateBoundary(w, h);
- QPixmap pix(bounds.pixmap(w, h));
- QImage result;
+ TQPixmap pix(bounds.pixmap(w, h));
+ TQImage result;
result = pix;
return result;
}*/
void KisBrush::generateBoundary() {
KisPaintDeviceSP dev;
- int w = maskWidth(KisPaintInformation());
- int h = maskHeight(KisPaintInformation());
+ int w = tqmaskWidth(KisPaintInformation());
+ int h = tqmaskHeight(KisPaintInformation());
if (brushType() == IMAGE || brushType() == PIPE_IMAGE) {
dev = image(KisMetaRegistry::instance()->csRegistry() ->getColorSpace(KisID("RGBA",""),""), KisPaintInformation());
} else {
- KisAlphaMaskSP amask = mask(KisPaintInformation());
+ KisAlphaMaskSP atqmask = tqmask(KisPaintInformation());
KisColorSpace* cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("RGBA",""),"");
dev = new KisPaintDevice(cs, "tmp for generateBoundary");
for (int y = 0; y < h; y++) {
@@ -1270,7 +1270,7 @@ void KisBrush::generateBoundary() {
int x = 0;
while(!it.isDone()) {
- cs->setAlpha(it.rawData(), amask->alphaAt(x++, y), 1);
+ cs->setAlpha(it.rawData(), atqmask->alphaAt(x++, y), 1);
++it;
}
}
@@ -1290,15 +1290,15 @@ void KisBrush::makeMaskImage() {
if (!hasColor())
return;
- QImage img;
+ TQImage img;
img.create(width(), height(), 32);
if (m_img.width() == img.width() && m_img.height() == img.height()) {
for (int x = 0; x < width(); x++) {
for (int y = 0; y < height(); y++) {
- QRgb c = m_img.pixel(x, y);
- int a = (qGray(c) * qAlpha(c)) / 255; // qGray(black) = 0
- img.setPixel(x, y, qRgba(a, a, a, 255));
+ TQRgb c = m_img.pixel(x, y);
+ int a = (tqGray(c) * tqAlpha(c)) / 255; // tqGray(black) = 0
+ img.setPixel(x, y, tqRgba(a, a, a, 255));
}
}