Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>pull/13/head
parent
95834e2bdc
commit
8b78a8791b
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* kis_part_init.cc - part of Krayon
|
||||
*
|
||||
* Copyright (c) 1999 Matthias Elter <elter@kde.org>
|
||||
*
|
||||
* 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 "ui/kis_factory.h"
|
||||
|
||||
|
||||
K_EXPORT_COMPONENT_FACTORY( libchalkpart, KisFactory )
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* kis_part_init.cpp - part of Krayon
|
||||
*
|
||||
* Copyright (c) 1999 Matthias Elter <elter@kde.org>
|
||||
*
|
||||
* 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 "ui/kis_factory.h"
|
||||
|
||||
|
||||
K_EXPORT_COMPONENT_FACTORY( libchalkpart, KisFactory )
|
@ -1,208 +0,0 @@
|
||||
/*
|
||||
* kis_profile.cc - part of Krayon
|
||||
*
|
||||
* Copyright (c) 2000 Matthias Elter <elter@kde.org>
|
||||
* 2001 John Califf
|
||||
* 2004 Boudewijn Rempt <boud@valdyas.org>
|
||||
*
|
||||
* 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 <cfloat>
|
||||
#include <cmath>
|
||||
#include <config.h>
|
||||
#include LCMS_HEADER
|
||||
|
||||
#include <tqimage.h>
|
||||
#include <tqtextstream.h>
|
||||
#include <tqfile.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "kis_profile.h"
|
||||
#include "kis_global.h"
|
||||
|
||||
#include "ksharedptr.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <fixx11h.h>
|
||||
|
||||
KisProfile::KisProfile(TQByteArray rawData)
|
||||
: m_rawData(rawData),
|
||||
m_filename( TQString() ),
|
||||
m_valid( false ),
|
||||
m_suitableForOutput(false)
|
||||
{
|
||||
m_profile = cmsOpenProfileFromMem(rawData.data(), (DWORD)rawData.size());
|
||||
init();
|
||||
}
|
||||
|
||||
KisProfile::KisProfile(const TQString& file)
|
||||
: m_filename(file),
|
||||
m_valid( false ),
|
||||
m_suitableForOutput( false )
|
||||
{
|
||||
}
|
||||
|
||||
KisProfile::KisProfile(const cmsHPROFILE profile)
|
||||
: m_profile(profile),
|
||||
m_filename( TQString() ),
|
||||
m_valid( true )
|
||||
{
|
||||
size_t bytesNeeded=0;
|
||||
|
||||
// Make a raw data image ready for saving
|
||||
_cmsSaveProfileToMem(m_profile, 0, &bytesNeeded); // calc size
|
||||
if(m_rawData.resize(bytesNeeded))
|
||||
{
|
||||
_cmsSaveProfileToMem(m_profile, m_rawData.data(), &bytesNeeded); // fill buffer
|
||||
cmsHPROFILE newprofile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD) bytesNeeded);
|
||||
cmsCloseProfile(m_profile);
|
||||
m_profile = newprofile;
|
||||
}
|
||||
else
|
||||
m_rawData.resize(0);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
KisProfile::~KisProfile()
|
||||
{
|
||||
cmsCloseProfile(m_profile);
|
||||
}
|
||||
|
||||
|
||||
bool KisProfile::load()
|
||||
{
|
||||
TQFile file(m_filename);
|
||||
file.open(IO_ReadOnly);
|
||||
m_rawData = file.readAll();
|
||||
m_profile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD)m_rawData.size());
|
||||
file.close();
|
||||
|
||||
if (m_profile == 0) {
|
||||
kdWarning() << "Failed to load profile from " << m_filename << endl;
|
||||
}
|
||||
|
||||
return init();
|
||||
|
||||
}
|
||||
|
||||
bool KisProfile::init()
|
||||
{
|
||||
if (m_profile) {
|
||||
m_colorSpaceSignature = cmsGetColorSpace(m_profile);
|
||||
m_deviceClass = cmsGetDeviceClass(m_profile);
|
||||
m_productName = cmsTakeProductName(m_profile);
|
||||
m_productDescription = cmsTakeProductDesc(m_profile);
|
||||
m_productInfo = cmsTakeProductInfo(m_profile);
|
||||
m_valid = true;
|
||||
|
||||
// Check if the profile can convert (something->this)
|
||||
// LPMATSHAPER OutMatShaper = cmsBuildOutputMatrixShaper(m_profile);
|
||||
// if( OutMatShaper )
|
||||
// {
|
||||
// m_suitableForOutput = true;
|
||||
// }
|
||||
cmsCIEXYZTRIPLE Primaries;
|
||||
|
||||
if (cmsTakeColorants(&Primaries, m_profile))
|
||||
{
|
||||
m_suitableForOutput = true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// XXX: It wasn't that easy to save a little memory: thsi gives an lcms error
|
||||
// Okay, we know enough. Free the memory; we'll load it again if needed.
|
||||
|
||||
cmsCloseProfile(m_profile);
|
||||
m_profile = 0;
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cmsHPROFILE KisProfile::profile()
|
||||
{
|
||||
#if 0
|
||||
if (m_profile = 0) {
|
||||
TQFile file(m_filename);
|
||||
file.open(IO_ReadOnly);
|
||||
m_rawData = file.readAll();
|
||||
m_profile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD)m_rawData.size());
|
||||
file.close();
|
||||
}
|
||||
#endif
|
||||
return m_profile;
|
||||
}
|
||||
|
||||
bool KisProfile::save()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
KisAnnotationSP KisProfile::annotation() const
|
||||
{
|
||||
// XXX we hardcode icc, this is correct for lcms?
|
||||
// XXX productName(), or just "ICC Profile"?
|
||||
if (!m_rawData.isEmpty())
|
||||
return new KisAnnotation("icc", productName(), m_rawData);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
KisProfile * KisProfile::getScreenProfile (int screen)
|
||||
{
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long nitems;
|
||||
unsigned long bytes_after;
|
||||
TQ_UINT8 * str;
|
||||
|
||||
static Atom icc_atom = XInternAtom( tqt_xdisplay(), "_ICC_PROFILE", False );
|
||||
|
||||
if ( XGetWindowProperty ( tqt_xdisplay(),
|
||||
tqt_xrootwin( screen ),
|
||||
icc_atom,
|
||||
0,
|
||||
INT_MAX,
|
||||
False,
|
||||
XA_CARDINAL,
|
||||
&type,
|
||||
&format,
|
||||
&nitems,
|
||||
&bytes_after,
|
||||
(unsigned char **) &str)
|
||||
) {
|
||||
|
||||
TQByteArray bytes (nitems);
|
||||
bytes.assign((char*)str, (TQ_UINT32)nitems);
|
||||
|
||||
return new KisProfile(bytes);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
return NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,208 @@
|
||||
/*
|
||||
* kis_profile.cpp - part of Krayon
|
||||
*
|
||||
* Copyright (c) 2000 Matthias Elter <elter@kde.org>
|
||||
* 2001 John Califf
|
||||
* 2004 Boudewijn Rempt <boud@valdyas.org>
|
||||
*
|
||||
* 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 <cfloat>
|
||||
#include <cmath>
|
||||
#include <config.h>
|
||||
#include LCMS_HEADER
|
||||
|
||||
#include <tqimage.h>
|
||||
#include <tqtextstream.h>
|
||||
#include <tqfile.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "kis_profile.h"
|
||||
#include "kis_global.h"
|
||||
|
||||
#include "ksharedptr.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <fixx11h.h>
|
||||
|
||||
KisProfile::KisProfile(TQByteArray rawData)
|
||||
: m_rawData(rawData),
|
||||
m_filename( TQString() ),
|
||||
m_valid( false ),
|
||||
m_suitableForOutput(false)
|
||||
{
|
||||
m_profile = cmsOpenProfileFromMem(rawData.data(), (DWORD)rawData.size());
|
||||
init();
|
||||
}
|
||||
|
||||
KisProfile::KisProfile(const TQString& file)
|
||||
: m_filename(file),
|
||||
m_valid( false ),
|
||||
m_suitableForOutput( false )
|
||||
{
|
||||
}
|
||||
|
||||
KisProfile::KisProfile(const cmsHPROFILE profile)
|
||||
: m_profile(profile),
|
||||
m_filename( TQString() ),
|
||||
m_valid( true )
|
||||
{
|
||||
size_t bytesNeeded=0;
|
||||
|
||||
// Make a raw data image ready for saving
|
||||
_cmsSaveProfileToMem(m_profile, 0, &bytesNeeded); // calc size
|
||||
if(m_rawData.resize(bytesNeeded))
|
||||
{
|
||||
_cmsSaveProfileToMem(m_profile, m_rawData.data(), &bytesNeeded); // fill buffer
|
||||
cmsHPROFILE newprofile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD) bytesNeeded);
|
||||
cmsCloseProfile(m_profile);
|
||||
m_profile = newprofile;
|
||||
}
|
||||
else
|
||||
m_rawData.resize(0);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
KisProfile::~KisProfile()
|
||||
{
|
||||
cmsCloseProfile(m_profile);
|
||||
}
|
||||
|
||||
|
||||
bool KisProfile::load()
|
||||
{
|
||||
TQFile file(m_filename);
|
||||
file.open(IO_ReadOnly);
|
||||
m_rawData = file.readAll();
|
||||
m_profile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD)m_rawData.size());
|
||||
file.close();
|
||||
|
||||
if (m_profile == 0) {
|
||||
kdWarning() << "Failed to load profile from " << m_filename << endl;
|
||||
}
|
||||
|
||||
return init();
|
||||
|
||||
}
|
||||
|
||||
bool KisProfile::init()
|
||||
{
|
||||
if (m_profile) {
|
||||
m_colorSpaceSignature = cmsGetColorSpace(m_profile);
|
||||
m_deviceClass = cmsGetDeviceClass(m_profile);
|
||||
m_productName = cmsTakeProductName(m_profile);
|
||||
m_productDescription = cmsTakeProductDesc(m_profile);
|
||||
m_productInfo = cmsTakeProductInfo(m_profile);
|
||||
m_valid = true;
|
||||
|
||||
// Check if the profile can convert (something->this)
|
||||
// LPMATSHAPER OutMatShaper = cmsBuildOutputMatrixShaper(m_profile);
|
||||
// if( OutMatShaper )
|
||||
// {
|
||||
// m_suitableForOutput = true;
|
||||
// }
|
||||
cmsCIEXYZTRIPLE Primaries;
|
||||
|
||||
if (cmsTakeColorants(&Primaries, m_profile))
|
||||
{
|
||||
m_suitableForOutput = true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// XXX: It wasn't that easy to save a little memory: thsi gives an lcms error
|
||||
// Okay, we know enough. Free the memory; we'll load it again if needed.
|
||||
|
||||
cmsCloseProfile(m_profile);
|
||||
m_profile = 0;
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cmsHPROFILE KisProfile::profile()
|
||||
{
|
||||
#if 0
|
||||
if (m_profile = 0) {
|
||||
TQFile file(m_filename);
|
||||
file.open(IO_ReadOnly);
|
||||
m_rawData = file.readAll();
|
||||
m_profile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD)m_rawData.size());
|
||||
file.close();
|
||||
}
|
||||
#endif
|
||||
return m_profile;
|
||||
}
|
||||
|
||||
bool KisProfile::save()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
KisAnnotationSP KisProfile::annotation() const
|
||||
{
|
||||
// XXX we hardcode icc, this is correct for lcms?
|
||||
// XXX productName(), or just "ICC Profile"?
|
||||
if (!m_rawData.isEmpty())
|
||||
return new KisAnnotation("icc", productName(), m_rawData);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
KisProfile * KisProfile::getScreenProfile (int screen)
|
||||
{
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long nitems;
|
||||
unsigned long bytes_after;
|
||||
TQ_UINT8 * str;
|
||||
|
||||
static Atom icc_atom = XInternAtom( tqt_xdisplay(), "_ICC_PROFILE", False );
|
||||
|
||||
if ( XGetWindowProperty ( tqt_xdisplay(),
|
||||
tqt_xrootwin( screen ),
|
||||
icc_atom,
|
||||
0,
|
||||
INT_MAX,
|
||||
False,
|
||||
XA_CARDINAL,
|
||||
&type,
|
||||
&format,
|
||||
&nitems,
|
||||
&bytes_after,
|
||||
(unsigned char **) &str)
|
||||
) {
|
||||
|
||||
TQByteArray bytes (nitems);
|
||||
bytes.assign((char*)str, (TQ_UINT32)nitems);
|
||||
|
||||
return new KisProfile(bytes);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
return NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* cmyk_u16_plugin.cc -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
|
||||
*
|
||||
* 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 <kinstance.h>
|
||||
#include <kgenericfactory.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
#include <kis_debug_areas.h>
|
||||
#include "cmyk_u16_plugin.h"
|
||||
#include "kis_cmyk_u16_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<CMYKU16Plugin> CMYKU16PluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalk_cmyk_u16_plugin, CMYKU16PluginFactory( "chalk" ) )
|
||||
|
||||
|
||||
CMYKU16Plugin::CMYKU16Plugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(CMYKU16PluginFactory::instance());
|
||||
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( parent );
|
||||
|
||||
KisColorSpace * colorSpaceCMYKU16 = new KisCmykU16ColorSpace(f, 0);
|
||||
KisColorSpaceFactory * csf = new KisCmykU16ColorSpaceFactory();
|
||||
TQ_CHECK_PTR(colorSpaceCMYKU16);
|
||||
f->add(csf);
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
|
||||
(KisID("CMYK16HISTO", i18n("CMYK16")), colorSpaceCMYKU16) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CMYKU16Plugin::~CMYKU16Plugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "cmyk_u16_plugin.moc"
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* cmyk_u16_plugin.cpp -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
|
||||
*
|
||||
* 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 <kinstance.h>
|
||||
#include <kgenericfactory.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
#include <kis_debug_areas.h>
|
||||
#include "cmyk_u16_plugin.h"
|
||||
#include "kis_cmyk_u16_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<CMYKU16Plugin> CMYKU16PluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalk_cmyk_u16_plugin, CMYKU16PluginFactory( "chalk" ) )
|
||||
|
||||
|
||||
CMYKU16Plugin::CMYKU16Plugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(CMYKU16PluginFactory::instance());
|
||||
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( parent );
|
||||
|
||||
KisColorSpace * colorSpaceCMYKU16 = new KisCmykU16ColorSpace(f, 0);
|
||||
KisColorSpaceFactory * csf = new KisCmykU16ColorSpaceFactory();
|
||||
TQ_CHECK_PTR(colorSpaceCMYKU16);
|
||||
f->add(csf);
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
|
||||
(KisID("CMYK16HISTO", i18n("CMYK16")), colorSpaceCMYKU16) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CMYKU16Plugin::~CMYKU16Plugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "cmyk_u16_plugin.moc"
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* cmyk_plugin.cc -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
*
|
||||
* 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 <tdelocale.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kinstance.h>
|
||||
#include <tdemessagebox.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <tdetempfile.h>
|
||||
#include <kdebug.h>
|
||||
#include <kgenericfactory.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
|
||||
#include "cmyk_plugin.h"
|
||||
|
||||
#include "kis_cmyk_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<CMYKPlugin> CMYKPluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalkcmykplugin, CMYKPluginFactory( "chalk" ) )
|
||||
|
||||
|
||||
CMYKPlugin::CMYKPlugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(CMYKPluginFactory::instance());
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( parent );
|
||||
|
||||
KisColorSpace * colorSpaceCMYK = new KisCmykColorSpace(f, 0);
|
||||
KisColorSpaceFactory * csf = new KisCmykColorSpaceFactory();
|
||||
TQ_CHECK_PTR(colorSpaceCMYK);
|
||||
f->add(csf);
|
||||
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicU8HistogramProducer>
|
||||
(KisID("CMYKHISTO", i18n("CMYK")), colorSpaceCMYK) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CMYKPlugin::~CMYKPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "cmyk_plugin.moc"
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* cmyk_plugin.cpp -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
*
|
||||
* 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 <tdelocale.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kinstance.h>
|
||||
#include <tdemessagebox.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <tdetempfile.h>
|
||||
#include <kdebug.h>
|
||||
#include <kgenericfactory.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
|
||||
#include "cmyk_plugin.h"
|
||||
|
||||
#include "kis_cmyk_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<CMYKPlugin> CMYKPluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalkcmykplugin, CMYKPluginFactory( "chalk" ) )
|
||||
|
||||
|
||||
CMYKPlugin::CMYKPlugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(CMYKPluginFactory::instance());
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( parent );
|
||||
|
||||
KisColorSpace * colorSpaceCMYK = new KisCmykColorSpace(f, 0);
|
||||
KisColorSpaceFactory * csf = new KisCmykColorSpaceFactory();
|
||||
TQ_CHECK_PTR(colorSpaceCMYK);
|
||||
f->add(csf);
|
||||
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicU8HistogramProducer>
|
||||
(KisID("CMYKHISTO", i18n("CMYK")), colorSpaceCMYK) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CMYKPlugin::~CMYKPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "cmyk_plugin.moc"
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* gray_u16_plugin.cc -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
|
||||
*
|
||||
* This program is free software; you can grayistribute 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 <kinstance.h>
|
||||
#include <kgenericfactory.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
|
||||
#include "gray_u16_plugin.h"
|
||||
#include "kis_gray_u16_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<GRAYU16Plugin> GRAYU16PluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalk_gray_u16_plugin, GRAYU16PluginFactory( "chalk" ) )
|
||||
|
||||
|
||||
GRAYU16Plugin::GRAYU16Plugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(GRAYU16PluginFactory::instance());
|
||||
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( parent );
|
||||
|
||||
KisColorSpace * colorSpaceGRAYU16 = new KisGrayU16ColorSpace(f, 0);
|
||||
KisColorSpaceFactory * csf = new KisGrayU16ColorSpaceFactory();
|
||||
TQ_CHECK_PTR(colorSpaceGRAYU16);
|
||||
f->add(csf);
|
||||
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
|
||||
(KisID("GRAYA16HISTO", i18n("GRAY/Alpha16")), colorSpaceGRAYU16) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GRAYU16Plugin::~GRAYU16Plugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "gray_u16_plugin.moc"
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* gray_u16_plugin.cpp -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
|
||||
*
|
||||
* This program is free software; you can grayistribute 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 <kinstance.h>
|
||||
#include <kgenericfactory.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
|
||||
#include "gray_u16_plugin.h"
|
||||
#include "kis_gray_u16_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<GRAYU16Plugin> GRAYU16PluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalk_gray_u16_plugin, GRAYU16PluginFactory( "chalk" ) )
|
||||
|
||||
|
||||
GRAYU16Plugin::GRAYU16Plugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(GRAYU16PluginFactory::instance());
|
||||
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( parent );
|
||||
|
||||
KisColorSpace * colorSpaceGRAYU16 = new KisGrayU16ColorSpace(f, 0);
|
||||
KisColorSpaceFactory * csf = new KisGrayU16ColorSpaceFactory();
|
||||
TQ_CHECK_PTR(colorSpaceGRAYU16);
|
||||
f->add(csf);
|
||||
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
|
||||
(KisID("GRAYA16HISTO", i18n("GRAY/Alpha16")), colorSpaceGRAYU16) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GRAYU16Plugin::~GRAYU16Plugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "gray_u16_plugin.moc"
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* gray_plugin.cc -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
*
|
||||
* 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 <tdelocale.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kinstance.h>
|
||||
#include <tdemessagebox.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <tdetempfile.h>
|
||||
#include <kdebug.h>
|
||||
#include <kgenericfactory.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
|
||||
#include "gray_plugin.h"
|
||||
#include "kis_gray_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<GrayPlugin> GrayPluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalkgrayplugin, GrayPluginFactory( "chalkcore" ) )
|
||||
|
||||
|
||||
GrayPlugin::GrayPlugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(GrayPluginFactory::instance());
|
||||
|
||||
// This is not a gui plugin; only load it when the doc is created.
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( parent );
|
||||
|
||||
// .22 gamma grayscale or something like that. Taken from the lcms tutorial...
|
||||
LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2);
|
||||
cmsHPROFILE hProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma);
|
||||
cmsFreeGamma(Gamma);
|
||||
KisProfile *defProfile = new KisProfile(hProfile);
|
||||
|
||||
f->addProfile(defProfile);
|
||||
|
||||
KisColorSpace * colorSpaceGrayA = new KisGrayColorSpace(f, 0);
|
||||
|
||||
KisColorSpaceFactory * csf = new KisGrayColorSpaceFactory();
|
||||
TQ_CHECK_PTR(colorSpaceGrayA);
|
||||
|
||||
f->add(csf);
|
||||
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicU8HistogramProducer>
|
||||
(KisID("GRAYA8HISTO", i18n("GRAY/Alpha8")), colorSpaceGrayA) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GrayPlugin::~GrayPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "gray_plugin.moc"
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* gray_plugin.cpp -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
*
|
||||
* 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 <tdelocale.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kinstance.h>
|
||||
#include <tdemessagebox.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <tdetempfile.h>
|
||||
#include <kdebug.h>
|
||||
#include <kgenericfactory.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
|
||||
#include "gray_plugin.h"
|
||||
#include "kis_gray_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<GrayPlugin> GrayPluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalkgrayplugin, GrayPluginFactory( "chalkcore" ) )
|
||||
|
||||
|
||||
GrayPlugin::GrayPlugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(GrayPluginFactory::instance());
|
||||
|
||||
// This is not a gui plugin; only load it when the doc is created.
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( parent );
|
||||
|
||||
// .22 gamma grayscale or something like that. Taken from the lcms tutorial...
|
||||
LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2);
|
||||
cmsHPROFILE hProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma);
|
||||
cmsFreeGamma(Gamma);
|
||||
KisProfile *defProfile = new KisProfile(hProfile);
|
||||
|
||||
f->addProfile(defProfile);
|
||||
|
||||
KisColorSpace * colorSpaceGrayA = new KisGrayColorSpace(f, 0);
|
||||
|
||||
KisColorSpaceFactory * csf = new KisGrayColorSpaceFactory();
|
||||
TQ_CHECK_PTR(colorSpaceGrayA);
|
||||
|
||||
f->add(csf);
|
||||
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicU8HistogramProducer>
|
||||
(KisID("GRAYA8HISTO", i18n("GRAY/Alpha8")), colorSpaceGrayA) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GrayPlugin::~GrayPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "gray_plugin.moc"
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* lms_f32_plugin.cc -- Part of Chalk
|
||||
*
|
||||
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
|
||||
* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
|
||||
* Copyright (c) 2005 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.
|
||||
*
|
||||
* 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 <kinstance.h>
|
||||
#include <kgenericfactory.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <kis_debug_areas.h>
|
||||
#include <kis_colorspace_factory_registry.h>
|
||||
#include <kis_basic_histogram_producers.h>
|
||||
|
||||
#include "lms_f32_plugin.h"
|
||||
#include "kis_lms_f32_colorspace.h"
|
||||
|
||||
typedef KGenericFactory<LMSF32Plugin> LMSF32PluginFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY( chalk_lms_f32_plugin, LMSF32PluginFactory( "chalk" ) )
|
||||
|
||||
|
||||
LMSF32Plugin::LMSF32Plugin(TQObject *parent, const char *name, const TQStringList &)
|
||||
: KParts::Plugin(parent, name)
|
||||
{
|
||||
setInstance(LMSF32PluginFactory::instance());
|
||||
|
||||
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
|
||||
{
|
||||
KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>(parent);
|
||||
|
||||
KisColorSpace * colorSpaceLMSF32 = new KisLmsF32ColorSpace(f, 0);
|
||||
|
||||
KisColorSpaceFactory * csf = new KisLmsF32ColorSpaceFactory();
|
||||
f->add(csf);
|
||||
|
||||
KisHistogramProducerFactoryRegistry::instance()->add(
|
||||
new KisBasicHistogramProducerFactory<KisBasicF32HistogramProducer>
|
||||
(KisID("LMSF32HISTO", i18n("Float32")), colorSpaceLMSF32) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LMSF32Plugin::~LMSF32Plugin()
|
||||
{
|
||||
}
|
||||
|
||||
#include "lms_f32_plugin.moc"
|