KoColorSpace.cpp 1.59 KB
Newer Older
1 2 3
/*
 *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
 *
4 5 6 7
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * 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 12
 * 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
 * Library General Public License for more details.
13
 *
14 15 16 17 18
 * You should have received a copy of the GNU Library General Public License
 * 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
#include "KoColorSpace.h"
21

22
KoColorSpace::KoColorSpace(const QString &id, const QString &name, KoColorSpaceRegistry * parent)
23
    : m_id(id)
24
    , m_name( name )
25
    , m_parent( parent )
26
{
Laurent Montel's avatar
Laurent Montel committed
27
    //m_dcop = 0;
28 29
}

30
KoColorSpace::~KoColorSpace()
31
{
Laurent Montel's avatar
Laurent Montel committed
32
    //delete m_dcop;
33 34
}

35
quint8 *KoColorSpace::allocPixelBuffer(quint32 numPixels) const
36 37 38 39
{
    return new quint8[pixelSize()*numPixels];
}

40
bool KoColorSpace::convertPixelsTo(const quint8 * src,
41
					    quint8 * dst,
42
					    KoColorSpace * dstColorSpace,
43 44 45 46 47 48 49 50 51 52 53 54 55
					    quint32 numPixels,
					    qint32 renderingIntent)
{
    // 4 channels: labA, 2 bytes per lab channel
    quint8 *pixels = new quint8[2*4*numPixels];

    toLabA16(src, pixels,numPixels);
    dstColorSpace->fromLabA16(pixels, dst,numPixels);

    delete [] pixels;

    return true;
}