KoCompositeOp.cpp 2.43 KB
Newer Older
1 2 3
/*
 *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6 7
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
8
 *
9 10 11
 * This library 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
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public License
15 16 17 18
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/
19 20 21 22

#include <klocale.h>

#include "KoCompositeOp.h"
23
#include "KoColorSpace.h"
24

Cyrille Berger's avatar
Cyrille Berger committed
25 26 27 28
struct KoCompositeOp::Private {
    KoColorSpace * colorSpace;
    QString id;
    QString description;
29
    QString category;
Cyrille Berger's avatar
Cyrille Berger committed
30 31 32 33 34
    bool userVisible;
    QBitArray defaultChannelFlags;
};

KoCompositeOp::KoCompositeOp() : d(new Private)
35 36 37 38
{

}

Dirk Mueller's avatar
Dirk Mueller committed
39 40 41 42
KoCompositeOp::~KoCompositeOp()
{
    delete d;
}
43

44
KoCompositeOp::KoCompositeOp(KoColorSpace * cs, const QString& id,  const QString& description, QString category, const bool userVisible)
Cyrille Berger's avatar
Cyrille Berger committed
45
    : d(new Private)
46
{
Cyrille Berger's avatar
Cyrille Berger committed
47 48 49 50
    d->colorSpace = cs;
    d->id = id;
    d->description = description;
    d->userVisible = userVisible;
51
    d->category = category;
52 53
}

54 55 56 57 58
void KoCompositeOp::composite(quint8 *dstRowStart, qint32 dstRowStride,
                              const quint8 *srcRowStart, qint32 srcRowStride,
                              const quint8 *maskRowStart, qint32 maskRowStride,
                              qint32 rows, qint32 numColumns,
                              quint8 opacity) const
59
{
60 61 62 63
    composite( dstRowStart, dstRowStride,
               srcRowStart, srcRowStride,
               maskRowStart, maskRowStride,
               rows, numColumns,
Cyrille Berger's avatar
Cyrille Berger committed
64 65 66
               opacity, d->defaultChannelFlags);
}

67 68 69 70 71
QString KoCompositeOp::category() const
{
    return d->category;
}

Cyrille Berger's avatar
Cyrille Berger committed
72 73 74
KoColorSpace* KoCompositeOp::colorSpace()
{
    return d->colorSpace;
75 76
}

Cyrille Berger's avatar
Cyrille Berger committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
QString KoCompositeOp::id() const
{
    return d->id;
}

QString KoCompositeOp::description() const
{
    return d->description;
}

KoColorSpace * KoCompositeOp::colorSpace() const
{
    return d->colorSpace;
}

bool KoCompositeOp::userVisible() const
{
    return d->userVisible;
}