summaryrefslogtreecommitdiffstats
path: root/krita/colorspaces/cmyk_u16
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /krita/colorspaces/cmyk_u16
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krita/colorspaces/cmyk_u16')
-rw-r--r--krita/colorspaces/cmyk_u16/Makefile.am30
-rw-r--r--krita/colorspaces/cmyk_u16/cmyk_u16_plugin.cc61
-rw-r--r--krita/colorspaces/cmyk_u16/cmyk_u16_plugin.h37
-rw-r--r--krita/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.cc714
-rw-r--r--krita/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h123
-rw-r--r--krita/colorspaces/cmyk_u16/krita_cmyk_u16_plugin.desktop85
6 files changed, 1050 insertions, 0 deletions
diff --git a/krita/colorspaces/cmyk_u16/Makefile.am b/krita/colorspaces/cmyk_u16/Makefile.am
new file mode 100644
index 00000000..913ec6ab
--- /dev/null
+++ b/krita/colorspaces/cmyk_u16/Makefile.am
@@ -0,0 +1,30 @@
+kde_services_DATA = krita_cmyk_u16_plugin.desktop
+
+INCLUDES = -I$(srcdir)/../../sdk \
+ -I$(srcdir)/../../kritacolor/color_strategy/ \
+ -I$(srcdir)/../../kritacolor/ \
+ $(KOFFICE_INCLUDES) \
+ $(all_includes)
+
+lib_LTLIBRARIES = libkrita_cmyk_u16.la
+libkrita_cmyk_u16_la_SOURCES = kis_cmyk_u16_colorspace.cc
+libkrita_cmyk_u16_la_LDFLAGS = $(all_libraries)
+libkrita_cmyk_u16_la_LIBADD = ../../kritacolor/libkritacolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = krita_cmyk_u16_plugin.la
+
+# Srcs for the plugin
+krita_cmyk_u16_plugin_la_SOURCES = cmyk_u16_plugin.cc
+noinst_HEADERS = cmyk_u16_plugin.h kis_cmyk_u16_colorspace.h
+
+krita_cmyk_u16_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+krita_cmyk_u16_plugin_la_LIBADD = libkrita_cmyk_u16.la ../../kritacolor/libkritacolor.la
+
+krita_cmyk_u16_plugin_la_METASOURCES = AUTO
+#METASOURCES = AUTO # XXX: which of the two?
+
+
+SUBDIRS = .
+#$(TESTSDIR)
+
diff --git a/krita/colorspaces/cmyk_u16/cmyk_u16_plugin.cc b/krita/colorspaces/cmyk_u16/cmyk_u16_plugin.cc
new file mode 100644
index 00000000..a86b09f4
--- /dev/null
+++ b/krita/colorspaces/cmyk_u16/cmyk_u16_plugin.cc
@@ -0,0 +1,61 @@
+/*
+* cmyk_u16_plugin.cc -- Part of Krita
+*
+* Copyright (c) 2004 Boudewijn Rempt ([email protected])
+* Copyright (c) 2005 Adrian Page <[email protected]>
+*
+* 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( krita_cmyk_u16_plugin, CMYKU16PluginFactory( "krita" ) )
+
+
+CMYKU16Plugin::CMYKU16Plugin(QObject *parent, const char *name, const QStringList &)
+ : 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();
+ Q_CHECK_PTR(colorSpaceCMYKU16);
+ f->add(csf);
+ KisHistogramProducerFactoryRegistry::instance()->add(
+ new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
+ (KisID("CMYK16HISTO", i18n("CMYK16")), colorSpaceCMYKU16) );
+ }
+
+}
+
+CMYKU16Plugin::~CMYKU16Plugin()
+{
+}
+
+#include "cmyk_u16_plugin.moc"
diff --git a/krita/colorspaces/cmyk_u16/cmyk_u16_plugin.h b/krita/colorspaces/cmyk_u16/cmyk_u16_plugin.h
new file mode 100644
index 00000000..90dce548
--- /dev/null
+++ b/krita/colorspaces/cmyk_u16/cmyk_u16_plugin.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2005 Boudewijn Rempt ([email protected])
+ *
+ * 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.
+ */
+
+#ifndef CMYK_U16_PLUGIN_H_
+#define CMYK_U16_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the CMYK U16 colour space strategy.
+ */
+class CMYKU16Plugin : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ CMYKU16Plugin(QObject *parent, const char *name, const QStringList &);
+ virtual ~CMYKU16Plugin();
+
+};
+
+
+#endif // CMYK_U16_PLUGIN_H_
diff --git a/krita/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.cc b/krita/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.cc
new file mode 100644
index 00000000..92ac3c83
--- /dev/null
+++ b/krita/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.cc
@@ -0,0 +1,714 @@
+/*
+ * Copyright (c) 2005 Boudewijn Rempt <[email protected]>
+ *
+ * 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 <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include LCMS_HEADER
+
+#include <qimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <kis_debug_areas.h>
+#include "kis_cmyk_u16_colorspace.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_color_conversions.h"
+#include "kis_integer_maths.h"
+#include "kis_colorspace_factory_registry.h"
+
+namespace {
+ const Q_INT32 MAX_CHANNEL_CMYK = 4;
+ const Q_INT32 MAX_CHANNEL_CMYKA = 5;
+}
+
+KisCmykU16ColorSpace::KisCmykU16ColorSpace(KisColorSpaceFactoryRegistry * parent, KisProfile *p) :
+ KisU16BaseColorSpace(KisID("CMYKA16", i18n("CMYK (16-bit integer/channel)")), TYPE_CMYK5_16, icSigCmykData, parent, p)
+{
+ m_channels.push_back(new KisChannelInfo(i18n("Cyan"), i18n("C"), 0 * sizeof(Q_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(Q_UINT16), Qt::cyan));
+ m_channels.push_back(new KisChannelInfo(i18n("Magenta"), i18n("M"), 1 * sizeof(Q_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(Q_UINT16), Qt::magenta));
+ m_channels.push_back(new KisChannelInfo(i18n("Yellow"), i18n("Y"), 2 * sizeof(Q_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(Q_UINT16), Qt::yellow));
+ m_channels.push_back(new KisChannelInfo(i18n("Black"), i18n("K"), 3 * sizeof(Q_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(Q_UINT16), Qt::black));
+ m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), 4 * sizeof(Q_UINT16), KisChannelInfo::ALPHA, KisChannelInfo::UINT16, sizeof(Q_UINT16)));
+
+ m_alphaPos = PIXEL_ALPHA * sizeof(Q_UINT16);
+
+ init();
+}
+
+KisCmykU16ColorSpace::~KisCmykU16ColorSpace()
+{
+}
+
+void KisCmykU16ColorSpace::mixColors(const Q_UINT8 **colors, const Q_UINT8 *weights, Q_UINT32 nColors, Q_UINT8 *dst) const
+{
+ Q_UINT32 totalCyan = 0, totalMagenta = 0, totalYellow = 0, totalBlack = 0, newAlpha = 0;
+
+ while (nColors--)
+ {
+ const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+ Q_UINT32 alpha = pixel->alpha;
+ Q_UINT32 alphaTimesWeight = UINT16_MULT(alpha, UINT8_TO_UINT16(*weights));
+
+ totalCyan += UINT16_MULT(pixel->cyan, alphaTimesWeight);
+ totalMagenta += UINT16_MULT(pixel->magenta, alphaTimesWeight);
+ totalYellow += UINT16_MULT(pixel->yellow, alphaTimesWeight);
+ totalBlack += UINT16_MULT(pixel->black, alphaTimesWeight);
+ newAlpha += alphaTimesWeight;
+
+ weights++;
+ colors++;
+ }
+
+ Q_ASSERT(newAlpha <= U16_OPACITY_OPAQUE);
+
+ Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+ dstPixel->alpha = newAlpha;
+
+ if (newAlpha > 0) {
+ totalCyan = UINT16_DIVIDE(totalCyan, newAlpha);
+ totalMagenta = UINT16_DIVIDE(totalMagenta, newAlpha);
+ totalYellow = UINT16_DIVIDE(totalYellow, newAlpha);
+ totalBlack = UINT16_DIVIDE(totalBlack, newAlpha);
+ }
+
+ dstPixel->cyan = totalCyan;
+ dstPixel->magenta = totalMagenta;
+ dstPixel->yellow = totalYellow;
+ dstPixel->black = totalBlack;
+}
+
+void KisCmykU16ColorSpace::convolveColors(Q_UINT8** colors, Q_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, Q_UINT8 *dst, Q_INT32 factor, Q_INT32 offset, Q_INT32 nColors) const
+{
+ Q_INT32 totalCyan = 0, totalMagenta = 0, totalYellow = 0, totalK = 0, totalAlpha = 0;
+
+ while (nColors--)
+ {
+ const Pixel * pixel = reinterpret_cast<const Pixel *>( *colors );
+
+ Q_INT32 weight = *kernelValues;
+
+ if (weight != 0) {
+ totalCyan += pixel->cyan * weight;
+ totalMagenta += pixel->magenta * weight;
+ totalYellow += pixel->yellow * weight;
+ totalK += pixel->black * weight;
+ totalAlpha += pixel->alpha * weight;
+ }
+ colors++;
+ kernelValues++;
+ }
+
+ Pixel * p = reinterpret_cast< Pixel *>( dst );
+
+ if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+ p->cyan = CLAMP( ( totalCyan / factor) + offset, 0, Q_UINT16_MAX);
+ p->magenta = CLAMP( ( totalMagenta / factor) + offset, 0, Q_UINT16_MAX);
+ p->yellow = CLAMP( ( totalYellow / factor) + offset, 0, Q_UINT16_MAX);
+ p->black = CLAMP( ( totalK / factor) + offset, 0, Q_UINT16_MAX);
+ }
+ if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+ p->alpha = CLAMP((totalAlpha/ factor) + offset, 0, Q_UINT16_MAX);
+ }
+}
+
+
+void KisCmykU16ColorSpace::invertColor(Q_UINT8 * src, Q_INT32 nPixels)
+{
+ Q_UINT32 psize = pixelSize();
+
+ while (nPixels--)
+ {
+ Pixel * p = reinterpret_cast< Pixel *>( src );
+ p->cyan = Q_UINT16_MAX - p->cyan;
+ p->magenta = Q_UINT16_MAX - p->magenta;
+ p->yellow = Q_UINT16_MAX - p->yellow;
+ p->black = Q_UINT16_MAX - p->black;
+ src += psize;
+ }
+}
+
+
+
+void KisCmykU16ColorSpace::applyAdjustment(const Q_UINT8 *src, Q_UINT8 *dst, KisColorAdjustment *adj, Q_INT32 nPixels)
+{
+ Q_UINT32 psize = pixelSize();
+
+ Q_UINT8 * tmp = new Q_UINT8[nPixels * psize];
+ Q_UINT8 * tmpPtr = tmp;
+ memcpy(tmp, dst, nPixels * psize);
+
+ KisAbstractColorSpace::applyAdjustment(src, dst, adj, nPixels);
+
+ // Copy the alpha, which lcms doesn't do for us, grumble.
+
+ while (nPixels--)
+ {
+ Q_UINT16 *pixelAlphaSrc = reinterpret_cast<Q_UINT16 *>(tmpPtr + m_alphaPos);
+ Q_UINT16 *pixelAlphaDst = reinterpret_cast<Q_UINT16 *>(dst + m_alphaPos);
+
+ *pixelAlphaDst= *pixelAlphaSrc;
+
+ tmpPtr += psize;
+ dst += psize;
+ }
+
+ delete [] tmp;
+}
+
+QValueVector<KisChannelInfo *> KisCmykU16ColorSpace::channels() const
+{
+ return m_channels;
+}
+
+Q_UINT32 KisCmykU16ColorSpace::nChannels() const
+{
+ return MAX_CHANNEL_CMYKA;
+}
+
+Q_UINT32 KisCmykU16ColorSpace::nColorChannels() const
+{
+ return MAX_CHANNEL_CMYK;
+}
+
+Q_UINT32 KisCmykU16ColorSpace::pixelSize() const
+{
+ return MAX_CHANNEL_CMYKA * sizeof(Q_UINT16);
+}
+
+void KisCmykU16ColorSpace::getSingleChannelPixel(Q_UINT8 *dstPixel, const Q_UINT8 *srcPixel, Q_UINT32 channelIndex)
+{
+ if (channelIndex < (Q_UINT32)MAX_CHANNEL_CMYKA) {
+
+ memset(dstPixel, 0, MAX_CHANNEL_CMYKA * sizeof(Q_UINT16));
+
+ if (U16_OPACITY_TRANSPARENT != 0) {
+ dstPixel[PIXEL_ALPHA] = U16_OPACITY_TRANSPARENT;
+ }
+
+ memcpy(dstPixel + (channelIndex * sizeof(Q_UINT16)), srcPixel + (channelIndex * sizeof(Q_UINT16)), sizeof(Q_UINT16));
+ }
+}
+
+void KisCmykU16ColorSpace::compositeOver(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ while (rows > 0) {
+
+ const Q_UINT16 *src = reinterpret_cast<const Q_UINT16 *>(srcRowStart);
+ Q_UINT16 *dst = reinterpret_cast<Q_UINT16 *>(dstRowStart);
+ const Q_UINT8 *mask = maskRowStart;
+ Q_INT32 columns = numColumns;
+
+ while (columns > 0) {
+
+ Q_UINT16 srcAlpha = src[PIXEL_ALPHA];
+
+ // apply the alphamask
+ if (mask != 0) {
+ Q_UINT8 U8_mask = *mask;
+
+ if (U8_mask != OPACITY_OPAQUE) {
+ srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_mask));
+ }
+ mask++;
+ }
+
+ if (srcAlpha != U16_OPACITY_TRANSPARENT) {
+
+ if (opacity != U16_OPACITY_OPAQUE) {
+ srcAlpha = UINT16_MULT(srcAlpha, opacity);
+ }
+
+ if (srcAlpha == U16_OPACITY_OPAQUE) {
+ memcpy(dst, src, MAX_CHANNEL_CMYKA * sizeof(Q_UINT16));
+ } else {
+ Q_UINT16 dstAlpha = dst[PIXEL_ALPHA];
+
+ Q_UINT16 srcBlend;
+
+ if (dstAlpha == U16_OPACITY_OPAQUE) {
+ srcBlend = srcAlpha;
+ } else {
+ Q_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha);
+ dst[PIXEL_ALPHA] = newAlpha;
+
+ if (newAlpha != 0) {
+ srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha);
+ } else {
+ srcBlend = srcAlpha;
+ }
+ }
+
+ if (srcBlend == U16_OPACITY_OPAQUE) {
+ memcpy(dst, src, MAX_CHANNEL_CMYK * sizeof(Q_UINT16));
+ } else {
+ dst[PIXEL_CYAN] = UINT16_BLEND(src[PIXEL_CYAN], dst[PIXEL_CYAN], srcBlend);
+ dst[PIXEL_MAGENTA] = UINT16_BLEND(src[PIXEL_MAGENTA], dst[PIXEL_MAGENTA], srcBlend);
+ dst[PIXEL_YELLOW] = UINT16_BLEND(src[PIXEL_YELLOW], dst[PIXEL_YELLOW], srcBlend);
+ dst[PIXEL_BLACK] = UINT16_BLEND(src[PIXEL_BLACK], dst[PIXEL_BLACK], srcBlend);
+ }
+ }
+ }
+
+ columns--;
+ src += MAX_CHANNEL_CMYKA;
+ dst += MAX_CHANNEL_CMYKA;
+ }
+
+ rows--;
+ srcRowStart += srcRowStride;
+ dstRowStart += dstRowStride;
+ if(maskRowStart) {
+ maskRowStart += maskRowStride;
+ }
+ }
+}
+
+#define COMMON_COMPOSITE_OP_PROLOG() \
+ while (rows > 0) { \
+ \
+ const Q_UINT16 *src = reinterpret_cast<const Q_UINT16 *>(srcRowStart); \
+ Q_UINT16 *dst = reinterpret_cast<Q_UINT16 *>(dstRowStart); \
+ Q_INT32 columns = numColumns; \
+ const Q_UINT8 *mask = maskRowStart; \
+ \
+ while (columns > 0) { \
+ \
+ Q_UINT16 srcAlpha = src[PIXEL_ALPHA]; \
+ Q_UINT16 dstAlpha = dst[PIXEL_ALPHA]; \
+ \
+ srcAlpha = QMIN(srcAlpha, dstAlpha); \
+ \
+ if (mask != 0) { \
+ Q_UINT8 U8_mask = *mask; \
+ \
+ if (U8_mask != OPACITY_OPAQUE) { \
+ srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_mask)); \
+ } \
+ mask++; \
+ } \
+ \
+ if (srcAlpha != U16_OPACITY_TRANSPARENT) { \
+ \
+ if (opacity != U16_OPACITY_OPAQUE) { \
+ srcAlpha = UINT16_MULT(srcAlpha, opacity); \
+ } \
+ \
+ Q_UINT16 srcBlend; \
+ \
+ if (dstAlpha == U16_OPACITY_OPAQUE) { \
+ srcBlend = srcAlpha; \
+ } else { \
+ Q_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha); \
+ dst[PIXEL_ALPHA] = newAlpha; \
+ \
+ if (newAlpha != 0) { \
+ srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha); \
+ } else { \
+ srcBlend = srcAlpha; \
+ } \
+ }
+
+#define COMMON_COMPOSITE_OP_EPILOG() \
+ } \
+ \
+ columns--; \
+ src += MAX_CHANNEL_CMYKA; \
+ dst += MAX_CHANNEL_CMYKA; \
+ } \
+ \
+ rows--; \
+ srcRowStart += srcRowStride; \
+ dstRowStart += dstRowStride; \
+ if(maskRowStart) { \
+ maskRowStart += maskRowStride; \
+ } \
+ }
+
+void KisCmykU16ColorSpace::compositeMultiply(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ COMMON_COMPOSITE_OP_PROLOG();
+
+ {
+
+ for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+ Q_UINT16 srcColor = src[channel];
+ Q_UINT16 dstColor = dst[channel];
+
+ srcColor = UINT16_MULT(srcColor, dstColor);
+
+ dst[channel] = UINT16_BLEND(srcColor, dstColor, srcBlend);
+ }
+
+
+ }
+
+ COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeDivide(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ COMMON_COMPOSITE_OP_PROLOG();
+
+ {
+ for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+ Q_UINT16 srcColor = src[channel];
+ Q_UINT16 dstColor = dst[channel];
+
+ srcColor = QMIN((dstColor * (UINT16_MAX + 1u) + (srcColor / 2u)) / (1u + srcColor), UINT16_MAX);
+
+ Q_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+ dst[channel] = newColor;
+ }
+ }
+
+ COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeScreen(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ COMMON_COMPOSITE_OP_PROLOG();
+
+ {
+ for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+ Q_UINT16 srcColor = src[channel];
+ Q_UINT16 dstColor = dst[channel];
+
+ srcColor = UINT16_MAX - UINT16_MULT(UINT16_MAX - dstColor, UINT16_MAX - srcColor);
+
+ Q_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+ dst[channel] = newColor;
+ }
+ }
+
+ COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeOverlay(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ COMMON_COMPOSITE_OP_PROLOG();
+
+ {
+ for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+ Q_UINT16 srcColor = src[channel];
+ Q_UINT16 dstColor = dst[channel];
+
+ srcColor = UINT16_MULT(dstColor, dstColor + 2u * UINT16_MULT(srcColor, UINT16_MAX - dstColor));
+
+ Q_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+ dst[channel] = newColor;
+ }
+ }
+
+ COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeDodge(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ COMMON_COMPOSITE_OP_PROLOG();
+
+ {
+ for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+ Q_UINT16 srcColor = src[channel];
+ Q_UINT16 dstColor = dst[channel];
+
+ srcColor = QMIN((dstColor * (UINT16_MAX + 1u)) / (UINT16_MAX + 1u - srcColor), UINT16_MAX);
+
+ Q_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+ dst[channel] = newColor;
+ }
+ }
+
+ COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeBurn(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ COMMON_COMPOSITE_OP_PROLOG();
+
+ {
+ for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+ Q_UINT16 srcColor = src[channel];
+ Q_UINT16 dstColor = dst[channel];
+
+ srcColor = QMIN(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), UINT16_MAX);
+ if (srcColor > UINT16_MAX - srcColor) srcColor = UINT16_MAX;
+
+ Q_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+ dst[channel] = newColor;
+ }
+ }
+
+ COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeDarken(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ COMMON_COMPOSITE_OP_PROLOG();
+
+ {
+ for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+ Q_UINT16 srcColor = src[channel];
+ Q_UINT16 dstColor = dst[channel];
+
+ srcColor = QMIN(srcColor, dstColor);
+
+ Q_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+ dst[channel] = newColor;
+ }
+ }
+
+ COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeLighten(Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT16 opacity)
+{
+ COMMON_COMPOSITE_OP_PROLOG();
+
+ {
+ for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+ Q_UINT16 srcColor = src[channel];
+ Q_UINT16 dstColor = dst[channel];
+
+ srcColor = QMAX(srcColor, dstColor);
+
+ Q_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+ dst[channel] = newColor;
+ }
+ }
+
+ COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeErase(Q_UINT8 *dst,
+ Q_INT32 dstRowSize,
+ const Q_UINT8 *src,
+ Q_INT32 srcRowSize,
+ const Q_UINT8 *srcAlphaMask,
+ Q_INT32 maskRowStride,
+ Q_INT32 rows,
+ Q_INT32 cols,
+ Q_UINT16 /*opacity*/)
+{
+ while (rows-- > 0)
+ {
+ const Pixel *s = reinterpret_cast<const Pixel *>(src);
+ Pixel *d = reinterpret_cast<Pixel *>(dst);
+ const Q_UINT8 *mask = srcAlphaMask;
+
+ for (Q_INT32 i = cols; i > 0; i--, s++, d++)
+ {
+ Q_UINT16 srcAlpha = s->alpha;
+
+ // apply the alphamask
+ if (mask != 0) {
+ Q_UINT8 U8_mask = *mask;
+
+ if (U8_mask != OPACITY_OPAQUE) {
+ srcAlpha = UINT16_BLEND(srcAlpha, U16_OPACITY_OPAQUE, UINT8_TO_UINT16(U8_mask));
+ }
+ mask++;
+ }
+ d->alpha = UINT16_MULT(srcAlpha, d->alpha);
+ }
+
+ dst += dstRowSize;
+ src += srcRowSize;
+ if(srcAlphaMask) {
+ srcAlphaMask += maskRowStride;
+ }
+ }
+}
+
+
+void KisCmykU16ColorSpace::bitBlt(Q_UINT8 *dst,
+ Q_INT32 dstRowStride,
+ const Q_UINT8 *src,
+ Q_INT32 srcRowStride,
+ const Q_UINT8 *mask,
+ Q_INT32 maskRowStride,
+ Q_UINT8 U8_opacity,
+ Q_INT32 rows,
+ Q_INT32 cols,
+ const KisCompositeOp& op)
+{
+ Q_UINT16 opacity = UINT8_TO_UINT16(U8_opacity);
+
+ switch (op.op()) {
+ case COMPOSITE_UNDEF:
+ // Undefined == no composition
+ break;
+ case COMPOSITE_OVER:
+ compositeOver(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_IN:
+ //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ case COMPOSITE_OUT:
+ //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_ATOP:
+ //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_XOR:
+ //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_PLUS:
+ //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_MINUS:
+ //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_ADD:
+ //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_SUBTRACT:
+ //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_DIFF:
+ //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_MULT:
+ compositeMultiply(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_DIVIDE:
+ compositeDivide(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_BUMPMAP:
+ //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_COPY:
+ compositeCopy(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, U8_opacity);
+ break;
+ case COMPOSITE_COPY_CYAN:
+ //compositeCopyCyan(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_COPY_MAGENTA:
+ //compositeCopyMagenta(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_COPY_YELLOW:
+ //compositeCopyYellow(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_COPY_OPACITY:
+ //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_CLEAR:
+ //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_DISSOLVE:
+ //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_DISPLACE:
+ //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+#if 0
+ case COMPOSITE_MODULATE:
+ compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_THRESHOLD:
+ compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+#endif
+ case COMPOSITE_NO:
+ // No composition.
+ break;
+ case COMPOSITE_DARKEN:
+ compositeDarken(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_LIGHTEN:
+ compositeLighten(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_HUE:
+ //compositeHue(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_SATURATION:
+ //compositeSaturation(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_VALUE:
+ //compositeValue(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_COLOR:
+ //compositeColor(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_COLORIZE:
+ //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_LUMINIZE:
+ //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_SCREEN:
+ compositeScreen(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_OVERLAY:
+ compositeOverlay(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_ERASE:
+ compositeErase(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_DODGE:
+ compositeDodge(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_BURN:
+ compositeBurn(dst, dstRowStride, src, srcRowStride, mask, maskRowStride, rows, cols, opacity);
+ break;
+ case COMPOSITE_ALPHA_DARKEN:
+ abstractCompositeAlphaDarken<Q_UINT16, U16Mult, Uint8ToU16, U16OpacityTest,
+ PIXEL_ALPHA, MAX_CHANNEL_CMYK, MAX_CHANNEL_CMYKA>(
+ dst, dstRowStride, src, srcRowStride, mask, maskRowStride,
+ rows, cols, opacity, U16Mult(), Uint8ToU16(), U16OpacityTest());
+ break;
+ default:
+ break;
+ }
+}
+
+KisCompositeOpList KisCmykU16ColorSpace::userVisiblecompositeOps() const
+{
+ KisCompositeOpList list;
+
+ list.append(KisCompositeOp(COMPOSITE_OVER));
+ list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+ list.append(KisCompositeOp(COMPOSITE_MULT));
+ list.append(KisCompositeOp(COMPOSITE_BURN));
+ list.append(KisCompositeOp(COMPOSITE_DODGE));
+ list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+ list.append(KisCompositeOp(COMPOSITE_SCREEN));
+ list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+ list.append(KisCompositeOp(COMPOSITE_DARKEN));
+ list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+
+ return list;
+}
diff --git a/krita/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h b/krita/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h
new file mode 100644
index 00000000..227e18d2
--- /dev/null
+++ b/krita/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2006 Boudewijn Rempt <[email protected]>
+ *
+ * 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.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_CMYK_U16_H_
+#define KIS_STRATEGY_COLORSPACE_CMYK_U16_H_
+
+#include <qcolor.h>
+
+#include <koffice_export.h>
+
+#include "kis_global.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_integer_maths.h"
+
+
+class KRITATOOL_EXPORT KisCmykU16ColorSpace : public KisU16BaseColorSpace {
+public:
+
+ struct Pixel {
+ Q_UINT16 cyan;
+ Q_UINT16 magenta;
+ Q_UINT16 yellow;
+ Q_UINT16 black;
+ Q_UINT16 alpha;
+ };
+
+public:
+ KisCmykU16ColorSpace(KisColorSpaceFactoryRegistry * parent, KisProfile *p);
+ virtual ~KisCmykU16ColorSpace();
+
+ virtual bool willDegrade(ColorSpaceIndependence independence)
+ {
+ if (independence == TO_RGBA8)
+ return true;
+ else
+ return false;
+ };
+
+public:
+
+ virtual QValueVector<KisChannelInfo *> channels() const;
+ virtual Q_UINT32 nChannels() const;
+ virtual Q_UINT32 nColorChannels() const;
+ virtual Q_UINT32 pixelSize() const;
+
+ virtual void applyAdjustment(const Q_UINT8 *src, Q_UINT8 *dst, KisColorAdjustment *adj, Q_INT32 nPixels);
+ virtual void mixColors(const Q_UINT8 **colors, const Q_UINT8 *weights, Q_UINT32 nColors, Q_UINT8 *dst) const;
+ virtual void invertColor(Q_UINT8 * src, Q_INT32 nPixels);
+ virtual void convolveColors(Q_UINT8** colors, Q_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, Q_UINT8 *dst, Q_INT32 factor, Q_INT32 offset, Q_INT32 nColors) const;
+ virtual void getSingleChannelPixel(Q_UINT8 *dstPixel, const Q_UINT8 *srcPixel, Q_UINT32 channelIndex);
+
+ virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+protected:
+
+ virtual void bitBlt(Q_UINT8 *dst,
+ Q_INT32 dstRowStride,
+ const Q_UINT8 *src,
+ Q_INT32 srcRowStride,
+ const Q_UINT8 *srcAlphaMask,
+ Q_INT32 maskRowStride,
+ Q_UINT8 opacity,
+ Q_INT32 rows,
+ Q_INT32 cols,
+ const KisCompositeOp& op);
+
+ void compositeOver(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeMultiply(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeDivide(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeScreen(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeOverlay(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeDodge(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeBurn(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeDarken(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeLighten(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+ void compositeErase(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT16 opacity);
+
+private:
+ friend class KisCmykU16ColorSpaceTester;
+
+ static const Q_UINT8 PIXEL_CYAN = 0;
+ static const Q_UINT8 PIXEL_MAGENTA = 1;
+ static const Q_UINT8 PIXEL_YELLOW = 2;
+ static const Q_UINT8 PIXEL_BLACK = 3;
+ static const Q_UINT8 PIXEL_ALPHA = 4;
+};
+
+class KisCmykU16ColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+ /**
+ * Krita definition for use in .kra files and internally: unchanging name +
+ * i18n'able description.
+ */
+ virtual KisID id() const { return KisID("CMYKA16", i18n("CMYK (16-bit integer/channel)")); };
+
+ /**
+ * lcms colorspace type definition.
+ */
+ virtual Q_UINT32 colorSpaceType() { return TYPE_CMYK5_16; };
+
+ virtual icColorSpaceSignature colorSpaceSignature() { return icSigCmykData; };
+
+ virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * parent, KisProfile *p) { return new KisCmykU16ColorSpace(parent, p); };
+
+ virtual QString defaultProfile() { return "Offset printing, according to ISO/DIS 12647-2:2004, OFCOM, paper type 1 or 2 = coated art, 115 g/m2, screen ruling 60 cm-1, positive-acting plates"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_CMYK_U16_H_
diff --git a/krita/colorspaces/cmyk_u16/krita_cmyk_u16_plugin.desktop b/krita/colorspaces/cmyk_u16/krita_cmyk_u16_plugin.desktop
new file mode 100644
index 00000000..ea14371a
--- /dev/null
+++ b/krita/colorspaces/cmyk_u16/krita_cmyk_u16_plugin.desktop
@@ -0,0 +1,85 @@
+[Desktop Entry]
+Name=CMYK Color Model (16-bit integer)
+Name[bg]=Цветови модел CMYK (16 бита)
+Name[ca]=Model de color CMYK (enters de 16 bits)
+Name[cy]=Model Lliw CMYK (cyfanrif 16-did)
+Name[da]=CMYK-farvemodel (16-bit heltal)
+Name[de]=CMYK-Farbmodell (16-bit Ganzzahl)
+Name[el]=Χρωματικό μοντέλο CMYK (16-bit ακέραιοι)
+Name[en_GB]=CMYK Colour Model (16-bit integer)
+Name[eo]=CMYK-kolormodelo (16-bita entjero)
+Name[es]=Modelo de color CMYK (entero de 16 bits)
+Name[et]=CMYK värvimudel (16-bitine täisarv)
+Name[fa]=مدل رنگ CMYK )عدد صحیح ۱۶ بیتی(
+Name[fi]=CMYK-värimalli
+Name[fr]=Modèle de couleurs CMYK (entiers 16 bits)
+Name[fy]=CMYK-kleurmodel (16-bit ynteger)
+Name[gl]=Modelo de Cores CMYK (inteiro de 16-bit)
+Name[he]=מודל צבעים CMYK (16 סיביות)
+Name[hu]=CMYK színmodell (16 bites egész)
+Name[is]=CMYK litategund (16-bita)
+Name[it]=Modello di colore CMYK (intero a 16 bit)
+Name[ja]=CMYK カラーモデル (16 ビット整数)
+Name[km]=គំរូ​ពណ៌ CMYK (ចំនួនគត់ ១៦ ប៊ីត)
+Name[lt]=CMYK spalvų modelis (16-bitų sveikasis)
+Name[nb]=CMYK-fargemodell (16-bit heltall)
+Name[nds]=CMYK-Klöörmodell (16-Bit Heeltall)
+Name[ne]=CMYK रङ मोडेल (१६-बिट इन्टिजर)
+Name[nl]=CMYK-kleurmodel (16-bit integer)
+Name[pl]=Przestrzeń barw CMYK (16-bitowa liczbowa całkowita)
+Name[pt]=Modelo de Cor CMYK (inteiros de 16 bits)
+Name[pt_BR]=Modelo de Cor CMYK (inteiros de 16 bits)
+Name[ru]=CMYK (целое 16-бит)
+Name[se]=CMYK-ivdnemálle (16-bihttá lohku)
+Name[sk]=CMYK model farieb (16-bitové čísla)
+Name[sl]=Barvni model CMYK (16-bitno celo število)
+Name[sr]=CMYK модел боја (16-битно целобројно)
+Name[sr@Latn]=CMYK model boja (16-bitno celobrojno)
+Name[sv]=CMYK-färgmodell (16-bitars heltal)
+Name[uk]=Модель кольору CMYK (16-бітне ціле число)
+Name[uz]=CMYK rang usuli (16-bit butun)
+Name[uz@cyrillic]=CMYK ранг усули (16-бит бутун)
+Name[zh_CN]=CMYK 色彩模型(16 位整数)
+Name[zh_TW]=CMYK 色彩模型 (16-bit 整數)
+Comment=Color model for 16-bit integer per channel CMYK images
+Comment[bg]=Цветови модел за 16 битови изображения CMYK
+Comment[ca]=Model de color d'enters de 16 bits per a canal d'imatges CMYK
+Comment[cy]=Model lliw ar gyfer delweddau CMYK â chyfanrif 16-did/sianel
+Comment[da]=Farvemodel for 16-bit heltal pr kanal CMYK-billeder
+Comment[de]=Farbmodell für 16-bit pro Kanal CMYK-Bilder
+Comment[el]=Χρωματικό μοντέλο για 16-bit ακεραίους ανά κανάλι CMYK εικόνες
+Comment[en_GB]=Colour model for 16-bit integer per channel CMYK images
+Comment[es]=Modelo de color de entero de 16 bits por canal para imágenes CMYK
+Comment[et]=16-bitiste täisarvuliste kanalitega CMYK-piltide värvimudel
+Comment[fa]=مدل رنگ برای عدد صحیح ۱۶ بیتی در هر مجرای تصاویر CMYK
+Comment[fi]=Värimalli 8-bittisille/kanavaisille CMYK-kuville
+Comment[fr]=Modèle de couleurs pour des images CMYK à 16 bits/plage
+Comment[fy]=Kleurmodel foar 16-bit/kanaal fan CMYK-ôfbeeldings
+Comment[gl]=Modelo de Cores para imaxes CMYK de 16-bit por canal
+Comment[he]=מודל צבעים עבור תמונות CMYK של 16 סיביות/ערוצים
+Comment[hu]=Színmodell 16 bit/csatorna CMYK képekhez
+Comment[is]=Litategund fyrir 16-bita/rásir CMYK myndir
+Comment[it]=Modello di colore per immagini CMYK a canale di 16 bit
+Comment[ja]=16 ビット整数/チャンネル CMYK 画像のためのカラーモデル
+Comment[km]=គំរូ​ពណ៌​សម្រាប់​រូបភាព CMYK ចំនួនគត់ ១៦ ប៊ីត​ក្នុង​មួយ​ឆានែល
+Comment[nb]=Fargemodell for CMYK-bilder med 16 bit per kanal
+Comment[nds]=Klöörmodell för CMYK-Biller mit 16-Bit Heeltall per Kanaal
+Comment[ne]=प्रति च्यानल CMYK छविहरूको १६ बिट इन्टिजरका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor 16-bit/kanaal van CMYK-afbeeldingen
+Comment[pl]=Przestrzeń barw dla obrazków CMYK z 16-bitowymi liczbami całkowitymi na kanał
+Comment[pt]=Modelo de cor para imagens CMYK com 16 bits por canal
+Comment[pt_BR]=Modelo de cor para imagens CMYK com 16 bits por canal
+Comment[ru]=Цветовое пространство CMYK (целое 16-бит/канал)
+Comment[se]=CMYK-ivdnemálle mas lea 16 bihttá kanálas
+Comment[sk]=Model farieb pre CMYK obrázky so 16 bitmi na kanál
+Comment[sl]=Barvni model za slike CMYK z 16 biti/kanal
+Comment[sr]=Модел боја за CMYK слике, 16-битно целобројно по каналу
+Comment[sr@Latn]=Model boja za CMYK slike, 16-bitno celobrojno po kanalu
+Comment[sv]=Färgmodell för 16-bitars heltal per kanal CMYK-bilder
+Comment[uk]=Модель кольору з 16-бітним цілим числом для кожного каналу зображень CMYK
+Comment[zh_CN]=16 位整数每通道 CYMK 图像的色彩模型
+Comment[zh_TW]=每色頻為 16-bit 的 CMYK 圖片色彩模型
+ServiceTypes=Krita/ColorSpace
+Type=Service
+X-KDE-Library=krita_cmyk_u16_plugin
+X-Krita-Version=2