Commit 467c874f authored by Cyrille Berger's avatar Cyrille Berger

* GPL -> LGPL

* move the code for converting between RGB and YCbCr into a KoColorConversionTransformation (this makes TestColorConversionSystem fails later)

svn path=/trunk/koffice/; revision=722522
parent 685dab21
......@@ -2,16 +2,15 @@
* Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
*
* 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.
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* 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
* You should have received a copy of the GNU Lesser 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.
*/
......@@ -84,40 +83,6 @@ class KisYCbCrBaseColorSpace : public KoIncompleteColorSpace<_CSTraits, KoRGB16F
NATIVE_TO_UINT8(_CSTraits::computeBlue( src->Y, src->Cb, src->Cr) ) );
*opacity = NATIVE_TO_UINT8(src->alpha);
}
virtual void fromRgbA16(const quint8 * srcU8, quint8 * dstU8, quint32 nPixels) const
{
typename _CSTraits::Pixel* dst = reinterpret_cast<typename _CSTraits::Pixel*>(dstU8);
const quint16* src = reinterpret_cast<const quint16*>(srcU8);
while(nPixels > 0)
{
typename _CSTraits::channels_type red = UINT16_TO_NATIVE(src[KoRgbU16Traits::red_pos]);
typename _CSTraits::channels_type green = UINT16_TO_NATIVE(src[KoRgbU16Traits::green_pos]);
typename _CSTraits::channels_type blue = UINT16_TO_NATIVE(src[KoRgbU16Traits::blue_pos]);
dst->Y = _CSTraits::computeY( red, green, blue);
dst->Cb = _CSTraits::computeCb( red, green, blue);
dst->Cr = _CSTraits::computeCr( red, green, blue);
dst->alpha = UINT16_TO_NATIVE(src[KoRgbU16Traits::alpha_pos]);
src +=4;
dst ++;
nPixels--;
}
}
virtual void toRgbA16(const quint8 * srcU8, quint8 * dstU8, quint32 nPixels) const
{
const typename _CSTraits::Pixel* src = reinterpret_cast< const typename _CSTraits::Pixel*>(srcU8);
quint16* dst = reinterpret_cast<quint16*>(dstU8);
while(nPixels > 0)
{
dst[ KoRgbU16Traits::red_pos ] = NATIVE_TO_UINT16(_CSTraits::computeRed( src->Y, src->Cb, src->Cr));
dst[ KoRgbU16Traits::green_pos ] = NATIVE_TO_UINT16(_CSTraits::computeGreen( src->Y, src->Cb, src->Cr));
dst[ KoRgbU16Traits::blue_pos ] = NATIVE_TO_UINT16(_CSTraits::computeBlue( src->Y, src->Cb, src->Cr));
dst[KoRgbU16Traits::alpha_pos] = NATIVE_TO_UINT16(src->alpha);
src ++;
dst += 4;
nPixels--;
}
}
private:
};
......
......@@ -2,9 +2,8 @@
* Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
*
* 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.
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
......
......@@ -2,16 +2,15 @@
* Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
*
* 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.
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* 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
* You should have received a copy of the GNU Lesser 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.
*/
......@@ -27,6 +26,8 @@
#include <KoIntegerMaths.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorConversionTransformationFactory.h>
#include "kis_ycbcr_to_rgb_color_conversion_transformation.h"
#include "kis_rgb_to_ycbcr_color_conversion_transformation.h"
#include "compositeops/KoCompositeOpOver.h"
#include "compositeops/KoCompositeOpErase.h"
......@@ -45,5 +46,11 @@ KisYCbCrU16ColorSpace::KisYCbCrU16ColorSpace(KoColorSpaceRegistry * parent, KoCo
QList<KoColorConversionTransformationFactory*> KisYCbCrU16ColorSpaceFactory::colorConversionLinks() const
{
return QList<KoColorConversionTransformationFactory*>();
QList<KoColorConversionTransformationFactory*> list;
// Conversion to RGB16bit
list.append(new KisYCbCrToRgbColorConversionTransformationFactory< YCbCrU16Traits, KoRgbTraits<quint16> >( YCbCrAColorModelID.id(), Integer16BitsColorDepthID.id(), RGBAColorModelID.id(), Integer16BitsColorDepthID.id() ) );
// Conversion from RGB16bit
list.append(new KisRgbToYCbCrColorConversionTransformationFactory< KoRgbTraits<quint16>, YCbCrU16Traits >( RGBAColorModelID.id(), Integer16BitsColorDepthID.id(), YCbCrAColorModelID.id(), Integer16BitsColorDepthID.id() ) );
return list;
}
......@@ -2,16 +2,15 @@
* Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
*
* 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.
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* 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
* You should have received a copy of the GNU Lesser 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.
*/
......
......@@ -2,16 +2,15 @@
* Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
*
* 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.
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* 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
* You should have received a copy of the GNU Lesser 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.
*/
......@@ -27,6 +26,8 @@
#include <KoIntegerMaths.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorConversionTransformationFactory.h>
#include "kis_ycbcr_to_rgb_color_conversion_transformation.h"
#include "kis_rgb_to_ycbcr_color_conversion_transformation.h"
#include "compositeops/KoCompositeOpOver.h"
#include "compositeops/KoCompositeOpErase.h"
......@@ -45,5 +46,10 @@ KisYCbCrU8ColorSpace::KisYCbCrU8ColorSpace(KoColorSpaceRegistry * parent, KoColo
QList<KoColorConversionTransformationFactory*> KisYCbCrU8ColorSpaceFactory::colorConversionLinks() const
{
return QList<KoColorConversionTransformationFactory*>();
QList<KoColorConversionTransformationFactory*> list;
// Conversion to RGB16bit
list.append(new KisYCbCrToRgbColorConversionTransformationFactory< YCbCrU8Traits, KoRgbTraits<quint16> >( YCbCrAColorModelID.id(), Integer8BitsColorDepthID.id(), RGBAColorModelID.id(), Integer16BitsColorDepthID.id() ) );
// Conversion from RGB16bit
list.append(new KisRgbToYCbCrColorConversionTransformationFactory< KoRgbTraits<quint16>, YCbCrU8Traits >( RGBAColorModelID.id(), Integer16BitsColorDepthID.id(), YCbCrAColorModelID.id(), Integer8BitsColorDepthID.id() ) );
return list;
}
......@@ -2,16 +2,15 @@
* Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
*
* 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.
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* 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
* You should have received a copy of the GNU Lesser 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.
*/
......
......@@ -2,16 +2,15 @@
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* 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.
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* 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
* You should have received a copy of the GNU Lesser 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.
*/
......
......@@ -2,16 +2,15 @@
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* 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.
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* 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
* You should have received a copy of the GNU Lesser 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.
*/
......
......@@ -93,7 +93,7 @@ struct KoColorConversionSystem::Node {
or _colorSpaceFactory->colorModelId() == GrayColorModelID );
}
QString id() const {
return colorSpaceFactory->id();
return modelId + " " + depthId;
}
QString modelId;
QString depthId;
......@@ -236,6 +236,7 @@ void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
csNode->init(csf);
if(csNode->isIcc)
{ // Construct a link between this color space and all other ICC color space
kDebug(31000) << csf->id() << " is an ICC color space, connecting to others";
QList<Node*> nodes = d->graph.values();
foreach(Node* node, nodes)
{
......@@ -259,12 +260,14 @@ void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
}
// Construct a link for "custom" transformation
QList<KoColorConversionTransformationFactory*> cctfs = csf->colorConversionLinks();
kDebug(31000) << csf->id() << " has " << cctfs.size() << " direct connections";
foreach(KoColorConversionTransformationFactory* cctf, cctfs)
{
Node* srcNode = nodeFor(cctf->srcColorModelId(), cctf->srcColorDepthId());
Q_ASSERT(srcNode);
Node* dstNode = nodeFor(cctf->dstColorModelId(), cctf->dstColorDepthId());
Q_ASSERT(dstNode);
kDebug(31000) << "Connecting " << srcNode->id() << " to " << dstNode->id();
Q_ASSERT(srcNode == csNode or dstNode == csNode);
// Check if the two nodes are allready connected
Vertex* v = vertexBetween(srcNode, dstNode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment