diff options
Diffstat (limited to 'krita/core/kis_selection.cc')
-rw-r--r-- | krita/core/kis_selection.cc | 282 |
1 files changed, 141 insertions, 141 deletions
diff --git a/krita/core/kis_selection.cc b/krita/core/kis_selection.cc index 9964a355..0150ecf2 100644 --- a/krita/core/kis_selection.cc +++ b/krita/core/kis_selection.cc @@ -16,11 +16,11 @@ * foundation, inc., 675 mass ave, cambridge, ma 02139, usa. */ -#include <qimage.h> +#include <tqimage.h> #include <kdebug.h> #include <klocale.h> -#include <qcolor.h> +#include <tqcolor.h> #include "kis_layer.h" #include "kis_debug_areas.h" @@ -35,9 +35,9 @@ #include "kis_selection.h" KisSelection::KisSelection(KisPaintDeviceSP dev) - : super(dev->parentLayer() + : super(dev->tqparentLayer() , KisMetaRegistry::instance()->csRegistry()->getAlpha8() - , (QString("selection for ") + dev->name()).latin1()) + , (TQString("selection for ") + dev->name()).latin1()) , m_parentPaintDevice(dev) , m_doCacheExactRect(false) , m_dirty(false) @@ -61,46 +61,46 @@ KisSelection::~KisSelection() { } -Q_UINT8 KisSelection::selected(Q_INT32 x, Q_INT32 y) +TQ_UINT8 KisSelection::selected(TQ_INT32 x, TQ_INT32 y) { KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, false); - Q_UINT8 *pix = iter.rawData(); + TQ_UINT8 *pix = iter.rawData(); return *pix; } -void KisSelection::setSelected(Q_INT32 x, Q_INT32 y, Q_UINT8 s) +void KisSelection::setSelected(TQ_INT32 x, TQ_INT32 y, TQ_UINT8 s) { KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, true); - Q_UINT8 *pix = iter.rawData(); + TQ_UINT8 *pix = iter.rawData(); *pix = s; } -QImage KisSelection::maskImage() +TQImage KisSelection::tqmaskImage() { - // If part of a KisAdjustmentLayer, there may be no parent device. - QImage img; - QRect bounds; + // If part of a KisAdjustmentLayer, there may be no tqparent device. + TQImage img; + TQRect bounds; if (m_parentPaintDevice) { bounds = m_parentPaintDevice->exactBounds(); bounds = bounds.intersect( m_parentPaintDevice->image()->bounds() ); - img = QImage(bounds.width(), bounds.height(), 32); + img = TQImage(bounds.width(), bounds.height(), 32); } else { - bounds = QRect( 0, 0, image()->width(), image()->height()); - img = QImage(bounds.width(), bounds.height(), 32); + bounds = TQRect( 0, 0, image()->width(), image()->height()); + img = TQImage(bounds.width(), bounds.height(), 32); } KisHLineIteratorPixel it = createHLineIterator(bounds.x(), bounds.y(), bounds.width(), false); for (int y2 = bounds.y(); y2 < bounds.height() - bounds.y(); ++y2) { int x2 = 0; while (!it.isDone()) { - Q_UINT8 s = MAX_SELECTED - *(it.rawData()); - Q_INT32 c = qRgb(s, s, s); + TQ_UINT8 s = MAX_SELECTED - *(it.rawData()); + TQ_INT32 c = tqRgb(s, s, s); img.setPixel(x2, y2, c); ++x2; ++it; @@ -109,32 +109,32 @@ QImage KisSelection::maskImage() } return img; } -void KisSelection::select(QRect r) +void KisSelection::select(TQRect r) { KisFillPainter painter(this); KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8(); - painter.fillRect(r, KisColor(Qt::white, cs), MAX_SELECTED); - Q_INT32 x, y, w, h; + painter.fillRect(r, KisColor(TQt::white, cs), MAX_SELECTED); + TQ_INT32 x, y, w, h; extent(x, y, w, h); } -void KisSelection::clear(QRect r) +void KisSelection::clear(TQRect r) { KisFillPainter painter(this); KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8(); - painter.fillRect(r, KisColor(Qt::white, cs), MIN_SELECTED); + painter.fillRect(r, KisColor(TQt::white, cs), MIN_SELECTED); } void KisSelection::clear() { - Q_UINT8 defPixel = MIN_SELECTED; + TQ_UINT8 defPixel = MIN_SELECTED; m_datamanager->setDefaultPixel(&defPixel); m_datamanager->clear(); } void KisSelection::invert() { - Q_INT32 x,y,w,h; + TQ_INT32 x,y,w,h; extent(x, y, w, h); KisRectIterator it = createRectIterator(x, y, w, h, true); @@ -145,28 +145,28 @@ void KisSelection::invert() *(it.rawData()) = MAX_SELECTED - *(it.rawData()); ++it; } - Q_UINT8 defPixel = MAX_SELECTED - *(m_datamanager->defaultPixel()); + TQ_UINT8 defPixel = MAX_SELECTED - *(m_datamanager->defaultPixel()); m_datamanager->setDefaultPixel(&defPixel); } -bool KisSelection::isTotallyUnselected(QRect r) +bool KisSelection::isTotallyUnselected(TQRect r) { if(*(m_datamanager->defaultPixel()) != MIN_SELECTED) return false; - QRect sr = selectedExactRect(); + TQRect sr = selectedExactRect(); return ! r.intersects(sr); } -bool KisSelection::isProbablyTotallyUnselected(QRect r) +bool KisSelection::isProbablyTotallyUnselected(TQRect r) { if(*(m_datamanager->defaultPixel()) != MIN_SELECTED) return false; - QRect sr = selectedRect(); + TQRect sr = selectedRect(); return ! r.intersects(sr); } -QRect KisSelection::selectedRect() const +TQRect KisSelection::selectedRect() const { if(*(m_datamanager->defaultPixel()) == MIN_SELECTED || !m_parentPaintDevice) return extent(); @@ -174,7 +174,7 @@ QRect KisSelection::selectedRect() const return extent().unite(m_parentPaintDevice->extent()); } -QRect KisSelection::selectedExactRect() const +TQRect KisSelection::selectedExactRect() const { if(m_doCacheExactRect) return m_cachedExactRect; @@ -201,42 +201,42 @@ void KisSelection::startCachingExactRect() m_doCacheExactRect = true; } -void KisSelection::paintUniformSelectionRegion(QImage img, const QRect& imageRect, const QRegion& uniformRegion) +void KisSelection::paintUniformSelectionRegion(TQImage img, const TQRect& imageRect, const TQRegion& uniformRegion) { Q_ASSERT(img.size() == imageRect.size()); - Q_ASSERT(imageRect.contains(uniformRegion.boundingRect())); + Q_ASSERT(imageRect.tqcontains(uniformRegion.boundingRect())); - if (img.isNull() || img.size() != imageRect.size() || !imageRect.contains(uniformRegion.boundingRect())) { + if (img.isNull() || img.size() != imageRect.size() || !imageRect.tqcontains(uniformRegion.boundingRect())) { return; } if (*m_datamanager->defaultPixel() == MIN_SELECTED) { - QRegion region = uniformRegion & QRegion(imageRect); + TQRegion region = uniformRegion & TQRegion(imageRect); if (!region.isEmpty()) { - QMemArray<QRect> rects = region.rects(); + TQMemArray<TQRect> rects = region.rects(); for (unsigned int i = 0; i < rects.count(); i++) { - QRect r = rects[i]; + TQRect r = rects[i]; - for (Q_INT32 y = 0; y < r.height(); ++y) { + for (TQ_INT32 y = 0; y < r.height(); ++y) { - QRgb *imagePixel = reinterpret_cast<QRgb *>(img.scanLine(r.y() - imageRect.y() + y)); + TQRgb *imagePixel = reinterpret_cast<TQRgb *>(img.scanLine(r.y() - imageRect.y() + y)); imagePixel += r.x() - imageRect.x(); - Q_INT32 numPixels = r.width(); + TQ_INT32 numPixels = r.width(); while (numPixels > 0) { - QRgb srcPixel = *imagePixel; - Q_UINT8 srcGrey = (qRed(srcPixel) + qGreen(srcPixel) + qBlue(srcPixel)) / 9; - Q_UINT8 srcAlpha = qAlpha(srcPixel); + TQRgb srcPixel = *imagePixel; + TQ_UINT8 srcGrey = (tqRed(srcPixel) + tqGreen(srcPixel) + tqBlue(srcPixel)) / 9; + TQ_UINT8 srcAlpha = tqAlpha(srcPixel); srcGrey = UINT8_MULT(srcGrey, srcAlpha); - Q_UINT8 dstAlpha = QMAX(srcAlpha, 192); + TQ_UINT8 dstAlpha = TQMAX(srcAlpha, 192); - QRgb dstPixel = qRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha); + TQRgb dstPixel = tqRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha); *imagePixel = dstPixel; ++imagePixel; @@ -248,111 +248,111 @@ void KisSelection::paintUniformSelectionRegion(QImage img, const QRect& imageRec } } -void KisSelection::paintSelection(QImage img, Q_INT32 imageRectX, Q_INT32 imageRectY, Q_INT32 imageRectWidth, Q_INT32 imageRectHeight) +void KisSelection::paintSelection(TQImage img, TQ_INT32 imageRectX, TQ_INT32 imageRectY, TQ_INT32 imageRectWidth, TQ_INT32 imageRectHeight) { - Q_ASSERT(img.size() == QSize(imageRectWidth, imageRectHeight)); + Q_ASSERT(img.size() == TQSize(imageRectWidth, imageRectHeight)); - if (img.isNull() || img.size() != QSize(imageRectWidth, imageRectHeight)) { + if (img.isNull() || img.size() != TQSize(imageRectWidth, imageRectHeight)) { return; } - QRect imageRect(imageRectX, imageRectY, imageRectWidth, imageRectHeight); - QRect selectionExtent = extent(); + TQRect imageRect(imageRectX, imageRectY, imageRectWidth, imageRectHeight); + TQRect selectionExtent = extent(); selectionExtent.setLeft(selectionExtent.left() - 1); selectionExtent.setTop(selectionExtent.top() - 1); selectionExtent.setWidth(selectionExtent.width() + 2); selectionExtent.setHeight(selectionExtent.height() + 2); - QRegion uniformRegion = QRegion(imageRect); - uniformRegion -= QRegion(selectionExtent); + TQRegion uniformRegion = TQRegion(imageRect); + uniformRegion -= TQRegion(selectionExtent); if (!uniformRegion.isEmpty()) { paintUniformSelectionRegion(img, imageRect, uniformRegion); } - QRect nonuniformRect = imageRect & selectionExtent; + TQRect nonuniformRect = imageRect & selectionExtent; if (!nonuniformRect.isEmpty()) { - const Q_INT32 imageRectOffsetX = nonuniformRect.x() - imageRectX; - const Q_INT32 imageRectOffsetY = nonuniformRect.y() - imageRectY; + const TQ_INT32 imageRectOffsetX = nonuniformRect.x() - imageRectX; + const TQ_INT32 imageRectOffsetY = nonuniformRect.y() - imageRectY; imageRectX = nonuniformRect.x(); imageRectY = nonuniformRect.y(); imageRectWidth = nonuniformRect.width(); imageRectHeight = nonuniformRect.height(); - const Q_INT32 NUM_SELECTION_ROWS = 3; + const TQ_INT32 NUM_SELECTION_ROWS = 3; - Q_UINT8 *selectionRow[NUM_SELECTION_ROWS]; + TQ_UINT8 *selectionRow[NUM_SELECTION_ROWS]; - Q_INT32 aboveRowIndex = 0; - Q_INT32 centreRowIndex = 1; - Q_INT32 belowRowIndex = 2; + TQ_INT32 aboveRowIndex = 0; + TQ_INT32 centreRowIndex = 1; + TQ_INT32 belowRowIndex = 2; - selectionRow[aboveRowIndex] = new Q_UINT8[imageRectWidth + 2]; - selectionRow[centreRowIndex] = new Q_UINT8[imageRectWidth + 2]; - selectionRow[belowRowIndex] = new Q_UINT8[imageRectWidth + 2]; + selectionRow[aboveRowIndex] = new TQ_UINT8[imageRectWidth + 2]; + selectionRow[centreRowIndex] = new TQ_UINT8[imageRectWidth + 2]; + selectionRow[belowRowIndex] = new TQ_UINT8[imageRectWidth + 2]; readBytes(selectionRow[centreRowIndex], imageRectX - 1, imageRectY - 1, imageRectWidth + 2, 1); readBytes(selectionRow[belowRowIndex], imageRectX - 1, imageRectY, imageRectWidth + 2, 1); - for (Q_INT32 y = 0; y < imageRectHeight; ++y) { + for (TQ_INT32 y = 0; y < imageRectHeight; ++y) { - Q_INT32 oldAboveRowIndex = aboveRowIndex; + TQ_INT32 oldAboveRowIndex = aboveRowIndex; aboveRowIndex = centreRowIndex; centreRowIndex = belowRowIndex; belowRowIndex = oldAboveRowIndex; readBytes(selectionRow[belowRowIndex], imageRectX - 1, imageRectY + y + 1, imageRectWidth + 2, 1); - const Q_UINT8 *aboveRow = selectionRow[aboveRowIndex] + 1; - const Q_UINT8 *centreRow = selectionRow[centreRowIndex] + 1; - const Q_UINT8 *belowRow = selectionRow[belowRowIndex] + 1; + const TQ_UINT8 *aboveRow = selectionRow[aboveRowIndex] + 1; + const TQ_UINT8 *centreRow = selectionRow[centreRowIndex] + 1; + const TQ_UINT8 *belowRow = selectionRow[belowRowIndex] + 1; - QRgb *imagePixel = reinterpret_cast<QRgb *>(img.scanLine(imageRectOffsetY + y)); + TQRgb *imagePixel = reinterpret_cast<TQRgb *>(img.scanLine(imageRectOffsetY + y)); imagePixel += imageRectOffsetX; - for (Q_INT32 x = 0; x < imageRectWidth; ++x) { + for (TQ_INT32 x = 0; x < imageRectWidth; ++x) { - Q_UINT8 centre = *centreRow; + TQ_UINT8 centre = *centreRow; if (centre != MAX_SELECTED) { // this is where we come if the pixels should be blue or bluish - QRgb srcPixel = *imagePixel; - Q_UINT8 srcGrey = (qRed(srcPixel) + qGreen(srcPixel) + qBlue(srcPixel)) / 9; - Q_UINT8 srcAlpha = qAlpha(srcPixel); + TQRgb srcPixel = *imagePixel; + TQ_UINT8 srcGrey = (tqRed(srcPixel) + tqGreen(srcPixel) + tqBlue(srcPixel)) / 9; + TQ_UINT8 srcAlpha = tqAlpha(srcPixel); // Colour influence is proportional to alphaPixel. srcGrey = UINT8_MULT(srcGrey, srcAlpha); - QRgb dstPixel; + TQRgb dstPixel; if (centre == MIN_SELECTED) { //this is where we come if the pixels should be blue (or red outline) - Q_UINT8 left = *(centreRow - 1); - Q_UINT8 right = *(centreRow + 1); - Q_UINT8 above = *aboveRow; - Q_UINT8 below = *belowRow; + TQ_UINT8 left = *(centreRow - 1); + TQ_UINT8 right = *(centreRow + 1); + TQ_UINT8 above = *aboveRow; + TQ_UINT8 below = *belowRow; // Stop unselected transparent areas from appearing the same // as selected transparent areas. - Q_UINT8 dstAlpha = QMAX(srcAlpha, 192); + TQ_UINT8 dstAlpha = TQMAX(srcAlpha, 192); // now for a simple outline based on 4-connectivity if (left != MIN_SELECTED || right != MIN_SELECTED || above != MIN_SELECTED || below != MIN_SELECTED) { - dstPixel = qRgba(255, 0, 0, dstAlpha); + dstPixel = tqRgba(255, 0, 0, dstAlpha); } else { - dstPixel = qRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha); + dstPixel = tqRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha); } } else { - dstPixel = qRgba(UINT8_BLEND(qRed(srcPixel), srcGrey + 128, centre), - UINT8_BLEND(qGreen(srcPixel), srcGrey + 128, centre), - UINT8_BLEND(qBlue(srcPixel), srcGrey + 165, centre), + dstPixel = tqRgba(UINT8_BLEND(tqRed(srcPixel), srcGrey + 128, centre), + UINT8_BLEND(tqGreen(srcPixel), srcGrey + 128, centre), + UINT8_BLEND(tqBlue(srcPixel), srcGrey + 165, centre), srcAlpha); } @@ -372,7 +372,7 @@ void KisSelection::paintSelection(QImage img, Q_INT32 imageRectX, Q_INT32 imageR } } -void KisSelection::paintSelection(QImage img, const QRect& scaledImageRect, const QSize& scaledImageSize, const QSize& imageSize) +void KisSelection::paintSelection(TQImage img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize) { if (img.isNull() || scaledImageRect.isEmpty() || scaledImageSize.isEmpty() || imageSize.isEmpty()) { return; @@ -384,10 +384,10 @@ void KisSelection::paintSelection(QImage img, const QRect& scaledImageRect, cons return; } - Q_INT32 imageWidth = imageSize.width(); - Q_INT32 imageHeight = imageSize.height(); + TQ_INT32 imageWidth = imageSize.width(); + TQ_INT32 imageHeight = imageSize.height(); - QRect selectionExtent = extent(); + TQRect selectionExtent = extent(); selectionExtent.setLeft(selectionExtent.left() - 1); selectionExtent.setTop(selectionExtent.top() - 1); @@ -397,63 +397,63 @@ void KisSelection::paintSelection(QImage img, const QRect& scaledImageRect, cons double xScale = static_cast<double>(scaledImageSize.width()) / imageWidth; double yScale = static_cast<double>(scaledImageSize.height()) / imageHeight; - QRect scaledSelectionExtent; + TQRect scaledSelectionExtent; scaledSelectionExtent.setLeft(static_cast<int>(selectionExtent.left() * xScale)); scaledSelectionExtent.setRight(static_cast<int>(ceil((selectionExtent.right() + 1) * xScale)) - 1); scaledSelectionExtent.setTop(static_cast<int>(selectionExtent.top() * yScale)); scaledSelectionExtent.setBottom(static_cast<int>(ceil((selectionExtent.bottom() + 1) * yScale)) - 1); - QRegion uniformRegion = QRegion(scaledImageRect); - uniformRegion -= QRegion(scaledSelectionExtent); + TQRegion uniformRegion = TQRegion(scaledImageRect); + uniformRegion -= TQRegion(scaledSelectionExtent); if (!uniformRegion.isEmpty()) { paintUniformSelectionRegion(img, scaledImageRect, uniformRegion); } - QRect nonuniformRect = scaledImageRect & scaledSelectionExtent; + TQRect nonuniformRect = scaledImageRect & scaledSelectionExtent; if (!nonuniformRect.isEmpty()) { - const Q_INT32 scaledImageRectXOffset = nonuniformRect.x() - scaledImageRect.x(); - const Q_INT32 scaledImageRectYOffset = nonuniformRect.y() - scaledImageRect.y(); + const TQ_INT32 scaledImageRectXOffset = nonuniformRect.x() - scaledImageRect.x(); + const TQ_INT32 scaledImageRectYOffset = nonuniformRect.y() - scaledImageRect.y(); - const Q_INT32 scaledImageRectX = nonuniformRect.x(); - const Q_INT32 scaledImageRectY = nonuniformRect.y(); - const Q_INT32 scaledImageRectWidth = nonuniformRect.width(); - const Q_INT32 scaledImageRectHeight = nonuniformRect.height(); + const TQ_INT32 scaledImageRectX = nonuniformRect.x(); + const TQ_INT32 scaledImageRectY = nonuniformRect.y(); + const TQ_INT32 scaledImageRectWidth = nonuniformRect.width(); + const TQ_INT32 scaledImageRectHeight = nonuniformRect.height(); - const Q_INT32 imageRowLeft = static_cast<Q_INT32>(scaledImageRectX / xScale); - const Q_INT32 imageRowRight = static_cast<Q_INT32>((ceil((scaledImageRectX + scaledImageRectWidth - 1 + 1) / xScale)) - 1); + const TQ_INT32 imageRowLeft = static_cast<TQ_INT32>(scaledImageRectX / xScale); + const TQ_INT32 imageRowRight = static_cast<TQ_INT32>((ceil((scaledImageRectX + scaledImageRectWidth - 1 + 1) / xScale)) - 1); - const Q_INT32 imageRowWidth = imageRowRight - imageRowLeft + 1; - const Q_INT32 imageRowStride = imageRowWidth + 2; + const TQ_INT32 imageRowWidth = imageRowRight - imageRowLeft + 1; + const TQ_INT32 imageRowStride = imageRowWidth + 2; - const Q_INT32 NUM_SELECTION_ROWS = 3; + const TQ_INT32 NUM_SELECTION_ROWS = 3; - Q_INT32 aboveRowIndex = 0; - Q_INT32 centreRowIndex = 1; - Q_INT32 belowRowIndex = 2; + TQ_INT32 aboveRowIndex = 0; + TQ_INT32 centreRowIndex = 1; + TQ_INT32 belowRowIndex = 2; - Q_INT32 aboveRowSrcY = -3; - Q_INT32 centreRowSrcY = -3; - Q_INT32 belowRowSrcY = -3; + TQ_INT32 aboveRowSrcY = -3; + TQ_INT32 centreRowSrcY = -3; + TQ_INT32 belowRowSrcY = -3; - Q_UINT8 *selectionRows = new Q_UINT8[imageRowStride * NUM_SELECTION_ROWS]; - Q_UINT8 *selectionRow[NUM_SELECTION_ROWS]; + TQ_UINT8 *selectionRows = new TQ_UINT8[imageRowStride * NUM_SELECTION_ROWS]; + TQ_UINT8 *selectionRow[NUM_SELECTION_ROWS]; selectionRow[0] = selectionRows + 1; selectionRow[1] = selectionRow[0] + imageRowStride; selectionRow[2] = selectionRow[0] + (2 * imageRowStride); - for (Q_INT32 y = 0; y < scaledImageRectHeight; ++y) { + for (TQ_INT32 y = 0; y < scaledImageRectHeight; ++y) { - Q_INT32 scaledY = scaledImageRectY + y; - Q_INT32 srcY = (scaledY * imageHeight) / scaledImageSize.height(); + TQ_INT32 scaledY = scaledImageRectY + y; + TQ_INT32 srcY = (scaledY * imageHeight) / scaledImageSize.height(); - Q_UINT8 *aboveRow; - Q_UINT8 *centreRow; - Q_UINT8 *belowRow; + TQ_UINT8 *aboveRow; + TQ_UINT8 *centreRow; + TQ_UINT8 *belowRow; if (srcY - 1 == aboveRowSrcY) { aboveRow = selectionRow[aboveRowIndex]; @@ -461,7 +461,7 @@ void KisSelection::paintSelection(QImage img, const QRect& scaledImageRect, cons belowRow = selectionRow[belowRowIndex]; } else if (srcY - 1 == centreRowSrcY) { - Q_INT32 oldAboveRowIndex = aboveRowIndex; + TQ_INT32 oldAboveRowIndex = aboveRowIndex; aboveRowIndex = centreRowIndex; centreRowIndex = belowRowIndex; @@ -475,8 +475,8 @@ void KisSelection::paintSelection(QImage img, const QRect& scaledImageRect, cons } else if (srcY - 1 == belowRowSrcY) { - Q_INT32 oldAboveRowIndex = aboveRowIndex; - Q_INT32 oldCentreRowIndex = centreRowIndex; + TQ_INT32 oldAboveRowIndex = aboveRowIndex; + TQ_INT32 oldCentreRowIndex = centreRowIndex; aboveRowIndex = belowRowIndex; centreRowIndex = oldAboveRowIndex; @@ -510,51 +510,51 @@ void KisSelection::paintSelection(QImage img, const QRect& scaledImageRect, cons centreRowSrcY = aboveRowSrcY + 1; belowRowSrcY = centreRowSrcY + 1; - QRgb *imagePixel = reinterpret_cast<QRgb *>(img.scanLine(scaledImageRectYOffset + y)); + TQRgb *imagePixel = reinterpret_cast<TQRgb *>(img.scanLine(scaledImageRectYOffset + y)); imagePixel += scaledImageRectXOffset; - for (Q_INT32 x = 0; x < scaledImageRectWidth; ++x) { + for (TQ_INT32 x = 0; x < scaledImageRectWidth; ++x) { - Q_INT32 scaledX = scaledImageRectX + x; - Q_INT32 srcX = (scaledX * imageWidth) / scaledImageSize.width(); + TQ_INT32 scaledX = scaledImageRectX + x; + TQ_INT32 srcX = (scaledX * imageWidth) / scaledImageSize.width(); - Q_UINT8 centre = *(centreRow + srcX - imageRowLeft); + TQ_UINT8 centre = *(centreRow + srcX - imageRowLeft); if (centre != MAX_SELECTED) { // this is where we come if the pixels should be blue or bluish - QRgb srcPixel = *imagePixel; - Q_UINT8 srcGrey = (qRed(srcPixel) + qGreen(srcPixel) + qBlue(srcPixel)) / 9; - Q_UINT8 srcAlpha = qAlpha(srcPixel); + TQRgb srcPixel = *imagePixel; + TQ_UINT8 srcGrey = (tqRed(srcPixel) + tqGreen(srcPixel) + tqBlue(srcPixel)) / 9; + TQ_UINT8 srcAlpha = tqAlpha(srcPixel); // Colour influence is proportional to alphaPixel. srcGrey = UINT8_MULT(srcGrey, srcAlpha); - QRgb dstPixel; + TQRgb dstPixel; if (centre == MIN_SELECTED) { //this is where we come if the pixels should be blue (or red outline) - Q_UINT8 left = *(centreRow + (srcX - imageRowLeft) - 1); - Q_UINT8 right = *(centreRow + (srcX - imageRowLeft) + 1); - Q_UINT8 above = *(aboveRow + (srcX - imageRowLeft)); - Q_UINT8 below = *(belowRow + (srcX - imageRowLeft)); + TQ_UINT8 left = *(centreRow + (srcX - imageRowLeft) - 1); + TQ_UINT8 right = *(centreRow + (srcX - imageRowLeft) + 1); + TQ_UINT8 above = *(aboveRow + (srcX - imageRowLeft)); + TQ_UINT8 below = *(belowRow + (srcX - imageRowLeft)); // Stop unselected transparent areas from appearing the same // as selected transparent areas. - Q_UINT8 dstAlpha = QMAX(srcAlpha, 192); + TQ_UINT8 dstAlpha = TQMAX(srcAlpha, 192); // now for a simple outline based on 4-connectivity if (left != MIN_SELECTED || right != MIN_SELECTED || above != MIN_SELECTED || below != MIN_SELECTED) { - dstPixel = qRgba(255, 0, 0, dstAlpha); + dstPixel = tqRgba(255, 0, 0, dstAlpha); } else { - dstPixel = qRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha); + dstPixel = tqRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha); } } else { - dstPixel = qRgba(UINT8_BLEND(qRed(srcPixel), srcGrey + 128, centre), - UINT8_BLEND(qGreen(srcPixel), srcGrey + 128, centre), - UINT8_BLEND(qBlue(srcPixel), srcGrey + 165, centre), + dstPixel = tqRgba(UINT8_BLEND(tqRed(srcPixel), srcGrey + 128, centre), + UINT8_BLEND(tqGreen(srcPixel), srcGrey + 128, centre), + UINT8_BLEND(tqBlue(srcPixel), srcGrey + 165, centre), srcAlpha); } @@ -569,7 +569,7 @@ void KisSelection::paintSelection(QImage img, const QRect& scaledImageRect, cons } } -void KisSelection::setDirty(const QRect& rc) +void KisSelection::setDirty(const TQRect& rc) { if (m_dirty) super::setDirty(rc); |