diff options
Diffstat (limited to 'krita/core/kis_paintop.cc')
-rw-r--r-- | krita/core/kis_paintop.cc | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/krita/core/kis_paintop.cc b/krita/core/kis_paintop.cc deleted file mode 100644 index e00484f1..00000000 --- a/krita/core/kis_paintop.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2002 Patrick Julien <[email protected]> - * Copyright (c) 2004 Boudewijn Rempt <[email protected]> - * Copyright (c) 2004 Clarence Dang <[email protected]> - * Copyright (c) 2004 Adrian Page <[email protected]> - * Copyright (c) 2004 Cyrille Berger <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#include "tqwidget.h" -#include "kis_painter.h" -#include "kis_layer.h" -#include "kis_types.h" -#include "kis_paintop.h" -#include "kis_alpha_tqmask.h" -#include "kis_point.h" -#include "kis_colorspace.h" -#include "kis_global.h" -#include "kis_iterators_pixel.h" -#include "kis_color.h" - -KisPaintOp::KisPaintOp(KisPainter * painter) - : m_dab(0) -{ - m_painter = painter; - setSource(painter->device()); -} - -KisPaintOp::~KisPaintOp() -{ -} - -KisPaintDeviceSP KisPaintOp::computeDab(KisAlphaMaskSP tqmask) { - return computeDab(tqmask, m_painter->device()->colorSpace()); -} - -KisPaintDeviceSP KisPaintOp::computeDab(KisAlphaMaskSP tqmask, KisColorSpace *cs) -{ - // XXX: According to the SeaShore source, the Gimp uses a - // temporary layer the size of the layer that is being painted - // on. This layer is cleared between painting actions. Our - // temporary layer, dab, is for every paintAt, composited with - // the target layer. We only use a real temporary layer for things - // like filter tools. - - if(!m_dab || m_dab->colorSpace() != cs) - m_dab = new KisPaintDevice(cs, "dab"); - Q_CHECK_PTR(m_dab); - - KisColor kc = m_painter->paintColor(); - - KisColorSpace * colorSpace = m_dab->colorSpace(); - - TQ_INT32 pixelSize = colorSpace->pixelSize(); - - TQ_INT32 tqmaskWidth = tqmask->width(); - TQ_INT32 tqmaskHeight = tqmask->height(); - - // Convert the kiscolor to the right colorspace. - kc.convertTo(colorSpace); - - KisHLineIteratorPixel hiter = m_dab->createHLineIterator(0, 0, tqmaskWidth, true); - for (int y = 0; y < tqmaskHeight; y++) - { - int x=0; - while(! hiter.isDone()) - { - // XXX: Set tqmask - colorSpace->setAlpha(kc.data(), tqmask->alphaAt(x++, y), 1); - memcpy(hiter.rawData(), kc.data(), pixelSize); - ++hiter; - } - hiter.nextRow(); - } - - return m_dab; -} - -void KisPaintOp::splitCoordinate(double coordinate, TQ_INT32 *whole, double *fraction) -{ - TQ_INT32 i = static_cast<TQ_INT32>(coordinate); - - if (coordinate < 0) { - // We always want the fractional part to be positive. - // E.g. -1.25 becomes -2 and +0.75 - i--; - } - - double f = coordinate - i; - - *whole = i; - *fraction = f; -} - -void KisPaintOp::setSource(KisPaintDeviceSP p) { - Q_ASSERT(p); - m_source = p; -} - - -KisPaintOpSettings* KisPaintOpFactory::settings(TQWidget* /*tqparent*/, const KisInputDevice& /*inputDevice*/) { return 0; } |