diff options
Diffstat (limited to 'krita/core/kis_paint_layer.cc')
-rw-r--r-- | krita/core/kis_paint_layer.cc | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/krita/core/kis_paint_layer.cc b/krita/core/kis_paint_layer.cc index 2567c75c..63663067 100644 --- a/krita/core/kis_paint_layer.cc +++ b/krita/core/kis_paint_layer.cc @@ -18,7 +18,7 @@ */ #include <kdebug.h> -#include <qimage.h> +#include <tqimage.h> #include "kis_debug_areas.h" #include "kis_image.h" @@ -33,39 +33,39 @@ #include "kis_datamanager.h" #include "kis_undo_adapter.h" -KisPaintLayer::KisPaintLayer(KisImage *img, const QString& name, Q_UINT8 opacity, KisPaintDeviceSP dev) +KisPaintLayer::KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity, KisPaintDeviceSP dev) : super(img, name, opacity) { Q_ASSERT(img); Q_ASSERT(dev); m_paintdev = dev; - m_mask = 0; - m_maskAsSelection = 0; + m_tqmask = 0; + m_tqmaskAsSelection = 0; m_paintdev->setParentLayer(this); m_renderMask = false; m_editMask = true; } -KisPaintLayer::KisPaintLayer(KisImage *img, const QString& name, Q_UINT8 opacity) +KisPaintLayer::KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity) : super(img, name, opacity) { Q_ASSERT(img); m_paintdev = new KisPaintDevice(this, img->colorSpace(), name.latin1()); - m_mask = 0; - m_maskAsSelection = 0; + m_tqmask = 0; + m_tqmaskAsSelection = 0; m_renderMask = false; m_editMask = true; } -KisPaintLayer::KisPaintLayer(KisImage *img, const QString& name, Q_UINT8 opacity, KisColorSpace * colorSpace) +KisPaintLayer::KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity, KisColorSpace * colorSpace) : super(img, name, opacity) { Q_ASSERT(img); Q_ASSERT(colorSpace); m_paintdev = new KisPaintDevice(this, colorSpace, name.latin1()); - m_mask = 0; - m_maskAsSelection = 0; + m_tqmask = 0; + m_tqmaskAsSelection = 0; m_renderMask = false; m_editMask = true; } @@ -76,8 +76,8 @@ KisPaintLayer::KisPaintLayer(const KisPaintLayer& rhs) : m_paintdev = new KisPaintDevice( *rhs.m_paintdev.data() ); m_paintdev->setParentLayer(this); if (rhs.hasMask()) { - m_mask = new KisPaintDevice(*rhs.m_mask.data()); - m_mask->setParentLayer(this); + m_tqmask = new KisPaintDevice(*rhs.m_tqmask.data()); + m_tqmask->setParentLayer(this); } m_renderMask = rhs.m_renderMask; m_editMask = rhs.m_editMask; @@ -93,42 +93,42 @@ KisPaintLayer::~KisPaintLayer() if (m_paintdev != 0) { m_paintdev->setParentLayer(0); } - if (m_mask != 0) { - m_mask->setParentLayer(0); + if (m_tqmask != 0) { + m_tqmask->setParentLayer(0); } } -void KisPaintLayer::paintSelection(QImage &img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h) +void KisPaintLayer::paintSelection(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h) { if (m_paintdev && m_paintdev->hasSelection()) { m_paintdev->selection()->paintSelection(img, x, y, w, h); - } else if (m_mask && m_editMask && m_mask->hasSelection()) { - m_mask->selection()->paintSelection(img, x, y, w, h); + } else if (m_tqmask && m_editMask && m_tqmask->hasSelection()) { + m_tqmask->selection()->paintSelection(img, x, y, w, h); } } -void KisPaintLayer::paintSelection(QImage &img, const QRect& scaledImageRect, const QSize& scaledImageSize, const QSize& imageSize) +void KisPaintLayer::paintSelection(TQImage &img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize) { if (m_paintdev && m_paintdev->hasSelection()) { m_paintdev->selection()->paintSelection(img, scaledImageRect, scaledImageSize, imageSize); - } else if (m_mask && m_editMask && m_mask->hasSelection()) { - m_mask->selection()->paintSelection(img, scaledImageRect, scaledImageSize, imageSize); + } else if (m_tqmask && m_editMask && m_tqmask->hasSelection()) { + m_tqmask->selection()->paintSelection(img, scaledImageRect, scaledImageSize, imageSize); } } -void KisPaintLayer::paintMaskInactiveLayers(QImage &img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h) +void KisPaintLayer::paintMaskInactiveLayers(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h) { uchar *j = img.bits(); KisColorSpace *cs = m_paintdev->colorSpace(); - for (Q_INT32 y2 = y; y2 < h + y; ++y2) { + for (TQ_INT32 y2 = y; y2 < h + y; ++y2) { KisHLineIteratorPixel it = m_paintdev->createHLineIterator(x, y2, w, false); while ( ! it.isDone()) { - Q_UINT8 s = cs->getAlpha(it.rawData()); + TQ_UINT8 s = cs->getAlpha(it.rawData()); if(s==0) { - Q_UINT8 g = (*(j + 0) + *(j + 1 ) + *(j + 2 )) / 9; + TQ_UINT8 g = (*(j + 0) + *(j + 1 ) + *(j + 2 )) / 9; *(j+0) = 128+g ; *(j+1) = 165+g; @@ -140,66 +140,66 @@ void KisPaintLayer::paintMaskInactiveLayers(QImage &img, Q_INT32 x, Q_INT32 y, Q } } -QImage KisPaintLayer::createThumbnail(Q_INT32 w, Q_INT32 h) +TQImage KisPaintLayer::createThumbnail(TQ_INT32 w, TQ_INT32 h) { if (m_paintdev) return m_paintdev->createThumbnail(w, h); else - return QImage(); + return TQImage(); } -Q_INT32 KisPaintLayer::x() const { +TQ_INT32 KisPaintLayer::x() const { if (m_paintdev) return m_paintdev->getX(); else return 0; } -void KisPaintLayer::setX(Q_INT32 x) +void KisPaintLayer::setX(TQ_INT32 x) { if (m_paintdev) m_paintdev->setX(x); } -Q_INT32 KisPaintLayer::y() const { +TQ_INT32 KisPaintLayer::y() const { if (m_paintdev) return m_paintdev->getY(); else return 0; } -void KisPaintLayer::setY(Q_INT32 y) { +void KisPaintLayer::setY(TQ_INT32 y) { if (m_paintdev) m_paintdev->setY(y); } -QRect KisPaintLayer::extent() const { +TQRect KisPaintLayer::extent() const { if (m_paintdev) return m_paintdev->extent(); else - return QRect(); + return TQRect(); } -QRect KisPaintLayer::exactBounds() const { +TQRect KisPaintLayer::exactBounds() const { if (m_paintdev) return m_paintdev->exactBounds(); else - return QRect(); + return TQRect(); } void KisPaintLayer::removeMask() { if (!hasMask()) return; - m_mask->setParentLayer(0); - m_mask = 0; - m_maskAsSelection = 0; + m_tqmask->setParentLayer(0); + m_tqmask = 0; + m_tqmaskAsSelection = 0; setDirty(); emit sigMaskInfoChanged(); } -// ### XXX Do we apply the mask outside the image boundaries too? I'd say no, but I'm not sure +// ### XXX Do we apply the tqmask outside the image boundaries too? I'd say no, but I'm not sure void KisPaintLayer::applyMask() { if (!hasMask()) return; @@ -210,7 +210,7 @@ void KisPaintLayer::applyMask() { // A bit slow; but it works KisPaintDeviceSP temp = new KisPaintDevice(m_paintdev->colorSpace()); KisPainter gc(temp); - gc.bltSelection(x, y, COMPOSITE_OVER, m_paintdev, m_maskAsSelection, OPACITY_OPAQUE, x, y, w, h); + gc.bltSelection(x, y, COMPOSITE_OVER, m_paintdev, m_tqmaskAsSelection, OPACITY_OPAQUE, x, y, w, h); gc.end(); gc.begin(m_paintdev); gc.bitBlt(x, y, COMPOSITE_COPY, temp, OPACITY_OPAQUE, x, y, w, h); @@ -221,18 +221,18 @@ void KisPaintLayer::applyMask() { KisPaintDeviceSP KisPaintLayer::createMask() { if (hasMask()) - return m_mask; + return m_tqmask; kdDebug() << k_funcinfo << endl; // Grey8 nicely fits our needs of being intuitively comparable to other apps' - // mask layer interfaces. It does have an alpha component though, which is a bit + // tqmask layer interfaces. It does have an alpha component though, which is a bit // less appropriate in this context. - m_mask = new KisPaintDevice(KisMetaRegistry::instance()->csRegistry() + m_tqmask = new KisPaintDevice(KisMetaRegistry::instance()->csRegistry() ->getColorSpace(KisID("GRAYA"), 0)); genericMaskCreationHelper(); - return m_mask; + return m_tqmask; } // FIXME If from is a paint device is not grey8!! @@ -241,31 +241,31 @@ void KisPaintLayer::createMaskFromPaintDevice(KisPaintDeviceSP from) { return; // Or overwrite? XXX kdDebug() << k_funcinfo << endl; - m_mask = from; // KisPaintDevice(*from); XXX + m_tqmask = from; // KisPaintDevice(*from); XXX genericMaskCreationHelper(); } void KisPaintLayer::createMaskFromSelection(KisSelectionSP from) { kdDebug() << k_funcinfo << endl; - m_mask = new KisPaintDevice(KisMetaRegistry::instance()->csRegistry() + m_tqmask = new KisPaintDevice(KisMetaRegistry::instance()->csRegistry() ->getColorSpace(KisID("GRAYA"), 0)); - m_mask->setParentLayer(this); + m_tqmask->setParentLayer(this); - m_maskAsSelection = new KisSelection(); // Anonymous selection is good enough + m_tqmaskAsSelection = new KisSelection(); // Anonymous selection is good enough - // Default pixel is opaque white == don't mask? - Q_UINT8 const defPixel[] = { 255, 255 }; - m_mask->dataManager()->setDefaultPixel(defPixel); + // Default pixel is opaque white == don't tqmask? + TQ_UINT8 const defPixel[] = { 255, 255 }; + m_tqmask->dataManager()->setDefaultPixel(defPixel); if (from) { - QRect r(extent()); + TQRect r(extent()); int w = r.width(); int h = r.height(); for (int y = r.y(); y < h; y++) { KisHLineIteratorPixel srcIt = from->createHLineIterator(r.x(), y, w, false); - KisHLineIteratorPixel dstIt = m_mask->createHLineIterator(r.x(), y, w, true); + KisHLineIteratorPixel dstIt = m_tqmask->createHLineIterator(r.x(), y, w, true); while(!dstIt.isDone()) { // XXX same remark as in convertMaskToSelection @@ -286,13 +286,13 @@ void KisPaintLayer::createMaskFromSelection(KisSelectionSP from) { KisPaintDeviceSP KisPaintLayer::getMask() { createMask(); kdDebug() << k_funcinfo << endl; - return m_mask; + return m_tqmask; } KisSelectionSP KisPaintLayer::getMaskAsSelection() { createMask(); kdDebug() << k_funcinfo << endl; - return m_maskAsSelection; + return m_tqmaskAsSelection; } void KisPaintLayer::setEditMask(bool b) { @@ -309,10 +309,10 @@ void KisPaintLayer::setRenderMask(bool b) { emit sigMaskInfoChanged(); } -void KisPaintLayer::convertMaskToSelection(const QRect& r) { - KisRectIteratorPixel srcIt = m_mask->createRectIterator(r.x(), r.y(), +void KisPaintLayer::convertMaskToSelection(const TQRect& r) { + KisRectIteratorPixel srcIt = m_tqmask->createRectIterator(r.x(), r.y(), r.width(), r.height(), false); - KisRectIteratorPixel dstIt = m_maskAsSelection->createRectIterator(r.x(), r.y(), + KisRectIteratorPixel dstIt = m_tqmaskAsSelection->createRectIterator(r.x(), r.y(), r.width(), r.height(), true); while(!dstIt.isDone()) { @@ -326,13 +326,13 @@ void KisPaintLayer::convertMaskToSelection(const QRect& r) { } void KisPaintLayer::genericMaskCreationHelper() { - m_mask->setParentLayer(this); + m_tqmask->setParentLayer(this); - m_maskAsSelection = new KisSelection(); // Anonymous selection is good enough + m_tqmaskAsSelection = new KisSelection(); // Anonymous selection is good enough - // Default pixel is opaque white == don't mask? - Q_UINT8 const defPixel[] = { 255, 255 }; - m_mask->dataManager()->setDefaultPixel(defPixel); + // Default pixel is opaque white == don't tqmask? + TQ_UINT8 const defPixel[] = { 255, 255 }; + m_tqmask->dataManager()->setDefaultPixel(defPixel); setDirty(); emit sigMaskInfoChanged(); @@ -344,7 +344,7 @@ void KisPaintLayer::setDirty(bool propagate) { super::setDirty(propagate); } -void KisPaintLayer::setDirty(const QRect & rect, bool propagate) { +void KisPaintLayer::setDirty(const TQRect & rect, bool propagate) { if (hasMask()) convertMaskToSelection(rect); super::setDirty(rect, propagate); @@ -355,16 +355,16 @@ namespace { class KisCreateMaskCommand : public KNamedCommand { typedef KNamedCommand super; KisPaintLayerSP m_layer; - KisPaintDeviceSP m_mask; + KisPaintDeviceSP m_tqmask; public: - KisCreateMaskCommand(const QString& name, KisPaintLayer* layer) + KisCreateMaskCommand(const TQString& name, KisPaintLayer* layer) : super(name), m_layer(layer) {} virtual void execute() { kdDebug() << k_funcinfo << endl; - if (!m_mask) - m_mask = m_layer->createMask(); + if (!m_tqmask) + m_tqmask = m_layer->createMask(); else - m_layer->createMaskFromPaintDevice(m_mask); + m_layer->createMaskFromPaintDevice(m_tqmask); } virtual void unexecute() { m_layer->removeMask(); @@ -374,35 +374,35 @@ namespace { class KisMaskFromSelectionCommand : public KNamedCommand { typedef KNamedCommand super; KisPaintLayerSP m_layer; - KisPaintDeviceSP m_maskBefore; - KisPaintDeviceSP m_maskAfter; + KisPaintDeviceSP m_tqmaskBefore; + KisPaintDeviceSP m_tqmaskAfter; KisSelectionSP m_selection; public: - KisMaskFromSelectionCommand(const QString& name, KisPaintLayer* layer) + KisMaskFromSelectionCommand(const TQString& name, KisPaintLayer* layer) : super(name), m_layer(layer) { if (m_layer->hasMask()) - m_maskBefore = m_layer->getMask(); + m_tqmaskBefore = m_layer->getMask(); else - m_maskBefore = 0; - m_maskAfter = 0; + m_tqmaskBefore = 0; + m_tqmaskAfter = 0; if (m_layer->paintDevice()->hasSelection()) m_selection = m_layer->paintDevice()->selection(); else m_selection = 0; } virtual void execute() { - if (!m_maskAfter) { + if (!m_tqmaskAfter) { m_layer->createMaskFromSelection(m_selection); - m_maskAfter = m_layer->getMask(); + m_tqmaskAfter = m_layer->getMask(); } else { m_layer->paintDevice()->deselect(); - m_layer->createMaskFromPaintDevice(m_maskAfter); + m_layer->createMaskFromPaintDevice(m_tqmaskAfter); } } virtual void unexecute() { m_layer->paintDevice()->setSelection(m_selection); - if (m_maskBefore) - m_layer->createMaskFromPaintDevice(m_maskBefore); + if (m_tqmaskBefore) + m_layer->createMaskFromPaintDevice(m_tqmaskBefore); else m_layer->removeMask(); } @@ -411,12 +411,12 @@ namespace { class KisMaskToSelectionCommand : public KNamedCommand { typedef KNamedCommand super; KisPaintLayerSP m_layer; - KisPaintDeviceSP m_mask; + KisPaintDeviceSP m_tqmask; KisSelectionSP m_selection; public: - KisMaskToSelectionCommand(const QString& name, KisPaintLayer* layer) + KisMaskToSelectionCommand(const TQString& name, KisPaintLayer* layer) : super(name), m_layer(layer) { - m_mask = m_layer->getMask(); + m_tqmask = m_layer->getMask(); if (m_layer->paintDevice()->hasSelection()) m_selection = m_layer->paintDevice()->selection(); else @@ -431,18 +431,18 @@ namespace { m_layer->paintDevice()->setSelection(m_selection); else m_layer->paintDevice()->deselect(); - m_layer->createMaskFromPaintDevice(m_mask); + m_layer->createMaskFromPaintDevice(m_tqmask); } }; class KisRemoveMaskCommand : public KNamedCommand { typedef KNamedCommand super; KisPaintLayerSP m_layer; - KisPaintDeviceSP m_mask; + KisPaintDeviceSP m_tqmask; public: - KisRemoveMaskCommand(const QString& name, KisPaintLayer* layer) + KisRemoveMaskCommand(const TQString& name, KisPaintLayer* layer) : super(name), m_layer(layer) { - m_mask = m_layer->getMask(); + m_tqmask = m_layer->getMask(); } virtual void execute() { kdDebug() << k_funcinfo << endl; @@ -451,19 +451,19 @@ namespace { virtual void unexecute() { // I hope that if the undo stack unwinds, it will end up here in the right // state again; taking a deep-copy sounds like wasteful to me - m_layer->createMaskFromPaintDevice(m_mask); + m_layer->createMaskFromPaintDevice(m_tqmask); } }; class KisApplyMaskCommand : public KNamedCommand { typedef KNamedCommand super; KisPaintLayerSP m_layer; - KisPaintDeviceSP m_mask; + KisPaintDeviceSP m_tqmask; KisPaintDeviceSP m_original; public: - KisApplyMaskCommand(const QString& name, KisPaintLayer* layer) + KisApplyMaskCommand(const TQString& name, KisPaintLayer* layer) : super(name), m_layer(layer) { - m_mask = m_layer->getMask(); + m_tqmask = m_layer->getMask(); m_original = new KisPaintDevice(*m_layer->paintDevice()); } virtual void execute() { @@ -479,7 +479,7 @@ namespace { gc.bitBlt(x, y, COMPOSITE_COPY, m_original, OPACITY_OPAQUE, x, y, w, h); gc.end(); - m_layer->createMaskFromPaintDevice(m_mask); + m_layer->createMaskFromPaintDevice(m_tqmask); } }; } @@ -488,11 +488,11 @@ KNamedCommand* KisPaintLayer::createMaskCommand() { return new KisCreateMaskCommand(i18n("Create Layer Mask"), this); } -KNamedCommand* KisPaintLayer::maskFromSelectionCommand() { +KNamedCommand* KisPaintLayer::tqmaskFromSelectionCommand() { return new KisMaskFromSelectionCommand(i18n("Mask From Selection"), this); } -KNamedCommand* KisPaintLayer::maskToSelectionCommand() { +KNamedCommand* KisPaintLayer::tqmaskToSelectionCommand() { return new KisMaskToSelectionCommand(i18n("Mask to Selection"), this); } |