KoCompositeOp.cpp 1.86 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 25 26 27 28 29 30

KoCompositeOp::KoCompositeOp()
{

}


31 32 33 34 35 36
KoCompositeOp::KoCompositeOp(KoColorSpace * cs, const QString& id,  const QString& description,  const bool userVisible)
    : m_colorSpace( cs )
    , m_id( id )
    , m_description( description )
    , m_userVisible( userVisible )
{
37 38
}

39 40 41 42 43
void KoCompositeOp::composite(quint8 *dstRowStart, qint32 dstRowStride,
                              const quint8 *srcRowStart, qint32 srcRowStride,
                              const quint8 *maskRowStart, qint32 maskRowStride,
                              qint32 rows, qint32 numColumns,
                              quint8 opacity) const
44
{
45
    if (m_defaultChannelFlags.isNull() || m_defaultChannelFlags.isEmpty()) {
Thomas Zander's avatar
Thomas Zander committed
46
        m_defaultChannelFlags.fill( true, m_colorSpace->channelCount() );
47 48
    }

49 50 51 52 53
    composite( dstRowStart, dstRowStride,
               srcRowStart, srcRowStride,
               maskRowStart, maskRowStride,
               rows, numColumns,
               opacity, m_defaultChannelFlags);
54 55
}