Commit 0807eeb0 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Merge in softproofing and ocio looks.

These features allow for better workflow in for Print and VFX respectively.
Check https://docs.krita.org/Soft_Proofing on how to use softproofing.

Looks will still need a little note added to Lut management page.

CCMAIL:kimageshop@kde.org
Fixes T2395

Squashed commit of the following:

commit 38c4fc32
Merge: 54776118 e308ed0f
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 28 17:46:16 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 54776118
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 28 17:43:20 2016 +0200

    Add rant why per-shot looks won't work after wasting afternoon on it.

    The tl;dr is that OCIO's documentation is extremely vague.

    Ref T2337

commit a3b224b6
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Jun 24 13:16:01 2016 +0200

    Fix loading of default gamut warning color.

    Always set the color space of the kocolor, kids.

    ref T2337

commit 652405d3
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Jun 24 12:54:17 2016 +0200

    Add adaptation state slider.

    This allows you to set whether or not to adapt the white point, that is,
    to set the white point to the screen white(full slider) or to convert all whiteson screen to the white point of the profile when using absolute colorimetric
    as intent.

    This is useful to simulate paper-colour.

    Ref T2337

commit aea525ca
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Jun 24 10:32:37 2016 +0200

    Fix builds on gcc 6

commit 67f4e5a2
Merge: 519f9c1f 159a6126
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 22:00:22 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 519f9c1f
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 19:49:56 2016 +0200

    Add option to set default Proofing Options.

    These will work for images with no proofing options, so, old loaded images
    and new images. With this it is feature complete, and people can start testing.

    Ref T2337
    Ref T1238

commit 062db74d
Merge: 2e057e7a 76255392
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 15:16:54 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 2e057e7a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 15:15:24 2016 +0200

    Clean up all the debug messages.

    It's... quieter in the terminal now.

    Ref T2337

commit 7ff7e60b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 15:01:02 2016 +0200

    Cleanup: Make projection color a defined tag.

commit 604efc8d
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 14:50:20 2016 +0200

    Not sure if this isn't the correct code instead...

    Ref T2337

commit 7c669703
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 14:42:04 2016 +0200

    Load embedded proofing profiles if they exist, and add them to the profile registery.

    Needs testing for obvious reasons.

    Ref T2337

commit 119906b2
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 14:27:07 2016 +0200

    Add embedding of the proofing profile.

    This is so that we can later unembed them.

    Ref T2337

commit 9ef1dad7
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 14:15:47 2016 +0200

    Load Warning Colors properly from file.

    Now the out of gamut warning can be written into file as XML
    and loaded from file as XML.

    Ref T2337

commit 6a57cf08
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 13:49:49 2016 +0200

    Fix naming conventions.

    I was using gamut warnings/alarms, and softproofing and soft proofing.

    The standard is (Out of )Gamut Warnings and Soft Proofing.

    Ref T2337

commit 4faa8b57
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 13:37:49 2016 +0200

    Disable softproofing in floating point spaces.

    There's a bunch of little niggling bugs that crop up when soft proofing
    in floating point spaces, amongst which the inability of the proofing
    mechanism to see floating point values higher than 1.0 fall outside of
    the gamut of the color space, let alone recognising whether it can go
    inside the gamut of the proofing space.

    See also http://ninedegreesbelow.com/bug-reports/soft-proofing-problems.html

    For now, it's best to disable softproofing on floating point spaces.
    Might need a more official check, though.

    Ref 2337

commit 91d7da8c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 22 16:26:52 2016 +0200

    Make views smart enough to track softproof/gamutcheck-state.

    Also add a floating message to say when the softproofing or gamutcheck
    is turned on in the view. Wording may change.

    Ref T2337

commit 5c48dd2c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 22 16:26:35 2016 +0200

    Fix Build

commit 6bacfcda
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 22 14:45:52 2016 +0200

    Add attempt at saving color to xml.

    This fails due to me not being able to load the xml, due object-bonanza.

    ref T2337

commit 3bbf025b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 22 12:49:06 2016 +0200

    Intitial saving/loading of config.[unstable]

    Works, but might change later.

commit 1f733e28
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 21 20:21:15 2016 +0200

    Refactor the proofing transform system for better caching.

    This now makes the transform separately from the actual transforming,
    which means it's easier to cache and to update. Softproofing is now
    gone from usable to user-friendly.

    Still needs saving/loading and little setting-bugs fixed.

    ref T2337

commit 8371c417
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 21 18:20:48 2016 +0200

    Enable Gamut color and proofing intent.

    The image now stored proofing intent, and the monitor intent is the general
    rendering intent.

    This also allows us to set the gamut warning color, however, for updating
    you currently need to switch profiles as well. I'll make a seperate
    generateSoftProofingTransform function, to cache the transform better, so it's
    easier to update.

    Ref 2337

commit 9d9ce380
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 21 14:18:05 2016 +0200

    Add softproofing section to image properties menu.

    Now, the proofing in the image can be changed.

    Also fixes that ugly little square problem with the kocoloractionpopup button.

    Ref T1238, T2337

commit 8d7b4418
Merge: e2ee9ff5 d58645ed
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 16 13:28:24 2016 +0200

    Merge remote-tracking branch 'origin/master' into krita-testing-wolthera

commit e2ee9ff5
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 14 15:56:50 2016 +0200

    Cache the transform unelegantly.

    This does cause a significant speed-up, but it's a bit fiddly.
    Regardless, the speed-up is enough to make this usable.

commit f643fc7b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 14 14:49:16 2016 +0200

    Fix softproofing

    It's slow again :/

commit cbc91c07
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 14 12:45:43 2016 +0200

    Fix setting softproofing and gamutcheck flags.

commit 9ae336ed
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 14 12:44:50 2016 +0200

    Cache the color space engine to make it faster

    It doesn't fix everything, but it fixes quite a bit.
    Ref T210

commit d4358901
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Jun 13 17:59:18 2016 +0200

    Add base implementation softproofing with toggles.

    It doesn't really work yet :/

    Ref: T210
    Ref: T2337

commit 7de02569
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Sun Jun 12 16:10:31 2016 +0200

    Create the proofing transform

    This doesn't use the caching graph stuff, which is too complex
    to refactor for now.

commit 00efd627
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Sun Jun 12 16:10:05 2016 +0200

    Add a per-image proofing settings class

commit d3bd5375
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Jun 12 14:44:50 2016 +0200

    Push work-in-progress proofing

commit bb97947a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 9 16:42:18 2016 +0200

    Fix copy-paste error

commit 9ed934a8
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 9 16:30:09 2016 +0200

    Add OCIO Look support.

    The code is based of that of Blender, as I couldn't figure out how else to
    apply looks. The OCIO api wasn't clear about it, nor could I find much information,
    but it somewhat works and doesn't crash.

    Auditors: rempt, dkazakov
    Ref: T210

commit 2819ad66
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 8 12:21:25 2016 +0200

    Add softproofing to the lcms conversion tests

    I am not fully sure if I understand the softproofing function, but the alarm works.
parent e308ed0f
......@@ -2,7 +2,7 @@
<kpartgui xmlns="http://www.kde.org/standards/kxmlgui/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="Krita"
version="92"
version="93"
xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 http://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd">
<MenuBar>
<Menu name="file" noMerge="1">
......@@ -62,6 +62,8 @@ xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 http://www.kde.org
<Action name="fullscreen"/>
<Action name="wrap_around_mode"/>
<Action name="level_of_detail_mode"/>
<Action name="softProof"/>
<Action name="gamutCheck"/>
<Separator/>
<Menu name="Canvas">
<text>&amp;Canvas</text>
......
......@@ -528,6 +528,26 @@
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="softProof">
<icon></icon>
<text>Soft Proofing</text>
<whatsThis></whatsThis>
<toolTip>Turns on Soft Proofing</toolTip>
<iconText>Turns on Soft Proofing</iconText>
<shortcut>Ctrl+Y</shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="gamutCheck">
<icon></icon>
<text>Out of Gamut Warnings</text>
<whatsThis></whatsThis>
<toolTip>Turns on warnings for colors our of proofed gamut, needs soft proofing to be turned on.</toolTip>
<iconText>Turns on warnings for colors our of proofed gamut, needs soft proofing to be turned on.</iconText>
<shortcut>Ctrl+Shift+Y</shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="mirror_canvas">
<icon></icon>
<text>Mirror View</text>
......
......@@ -247,6 +247,7 @@ set(kritaimage_LIB_SRCS
kis_outline_generator.cpp
kis_layer_composition.cpp
kis_selection_filters.cpp
KisProofingConfiguration.h
metadata/kis_meta_data_entry.cc
metadata/kis_meta_data_filter.cc
metadata/kis_meta_data_filter_p.cc
......
#ifndef KISPROOFINGCONFIGURATION_H
#define KISPROOFINGCONFIGURATION_H
#include "KoColor.h"
#include "KoColorSpace.h"
#include "KoColorConversionTransformation.h"
/**
* @brief The KisProofingConfiguration struct
* Little struct that stores the proofing configuration for a given file.
* The actual softproofing and gamutcheck toggles are set in the canvas.
* intet, conversionflags and warning color have default set to them. This
* wasn't possible for profileSpace.
*/
struct KisProofingConfiguration {
KisProofingConfiguration() : intent(KoColorConversionTransformation::IntentAbsoluteColorimetric),
conversionFlags(KoColorConversionTransformation::BlackpointCompensation),
warningColor(KoColor()),
proofingProfile("Chemical proof"),
proofingModel("CMYKA"),
proofingDepth("U8"),
adaptationState(1.0){}
KoColorConversionTransformation::Intent intent;
KoColorConversionTransformation::ConversionFlags conversionFlags;
KoColor warningColor;
QString proofingProfile;
QString proofingModel;
QString proofingDepth;
double adaptationState;
};
#endif // KISPROOFINGCONFIGURATION_H
......@@ -38,6 +38,7 @@
#include "KoColor.h"
#include "KoColorProfile.h"
#include <KoCompositeOpRegistry.h>
#include "KisProofingConfiguration.h"
#include "recorder/kis_action_recorder.h"
#include "kis_adjustment_layer.h"
......@@ -145,6 +146,7 @@ public:
double yres = 1.0;
const KoColorSpace * colorSpace;
KisProofingConfiguration *proofingConfig = 0;
KisSelectionSP deselectedGlobalSelection;
KisGroupLayerSP rootLayer; // The layers are contained in here
......@@ -1594,3 +1596,18 @@ KisImageAnimationInterface* KisImage::animationInterface() const
{
return m_d->animationInterface;
}
void KisImage::setProofingConfiguration(KisProofingConfiguration *proofingConfig)
{
m_d->proofingConfig = proofingConfig;
emit sigProofingConfigChanged();
}
KisProofingConfiguration *KisImage::proofingConfiguration() const
{
if (!m_d->proofingConfig) {
KisImageConfig cfg;
m_d->proofingConfig = cfg.defaultProofingconfiguration();
}
return m_d->proofingConfig;
}
......@@ -53,7 +53,7 @@ class KisLayerComposition;
class KisSpontaneousJob;
class KisImageAnimationInterface;
class KUndo2MagicString;
class KisProofingConfiguration;
namespace KisMetaData
{
......@@ -563,6 +563,18 @@ public:
KisImageAnimationInterface *animationInterface() const;
/**
* @brief setProofingConfiguration, this sets the image's proofing configuration, and signals
* the proofingConfiguration has changed.
* @param proofingConfig - the kis proofing config that will be used instead.
*/
void setProofingConfiguration(KisProofingConfiguration *proofingConfig);
/**
* @brief proofingConfiguration
* @return the proofing configuration of the image.
*/
KisProofingConfiguration *proofingConfiguration() const;
public:
bool startIsolatedMode(KisNodeSP node);
void stopIsolatedMode();
......@@ -709,6 +721,12 @@ Q_SIGNALS:
*/
void sigNodeCollapsedChanged();
/**
* Emitted when the proofing configuration of the image is being changed.
*
*/
void sigProofingConfigChanged();
public Q_SLOTS:
KisCompositeProgressProxy* compositeProgressProxy();
......
......@@ -21,6 +21,9 @@
#include <ksharedconfig.h>
#include <KoConfig.h>
#include <KoColorProfile.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorConversionTransformation.h>
#include "kis_debug.h"
......@@ -394,3 +397,38 @@ void KisImageConfig::setShowAdditionalOnionSkinsSettings(bool value)
{
m_config.writeEntry("showAdditionalOnionSkinsSettings", value);
}
KisProofingConfiguration *KisImageConfig::defaultProofingconfiguration()
{
KisProofingConfiguration *proofingConfig= new KisProofingConfiguration();
proofingConfig->proofingProfile = m_config.readEntry("defaultProofingProfileName", "Chemical proof");
proofingConfig->proofingModel = m_config.readEntry("defaultProofingProfileModel", "CMYKA");
proofingConfig->proofingDepth = m_config.readEntry("defaultProofingProfileDepth", "U8");
proofingConfig->intent = (KoColorConversionTransformation::Intent)m_config.readEntry("defaultProofingProfileIntent", 3);
if (m_config.readEntry("defaultProofingBlackpointCompensation", true)) {
proofingConfig->conversionFlags |= KoColorConversionTransformation::ConversionFlag::BlackpointCompensation;
} else {
proofingConfig->conversionFlags = proofingConfig->conversionFlags & ~KoColorConversionTransformation::ConversionFlag::BlackpointCompensation;
}
QColor def;
def = m_config.readEntry("defaultProofingGamutwarning", QColor(Qt::gray));
KoColor col(KoColorSpaceRegistry::instance()->rgb8());
col.fromQColor(def);
col.setOpacity(1.0);
proofingConfig->warningColor = col;
proofingConfig->adaptationState = (double)m_config.readEntry("defaultProofingAdaptationState", 1.0);
return proofingConfig;
}
void KisImageConfig::setDefaultProofingConfig(const KoColorSpace *proofingSpace, int proofingIntent, bool blackPointCompensation, KoColor warningColor, double adaptationState)
{
m_config.writeEntry("defaultProofingProfileName", proofingSpace->profile()->name());
m_config.writeEntry("defaultProofingProfileModel", proofingSpace->colorModelId().id());
m_config.writeEntry("defaultProofingProfileDepth", proofingSpace->colorDepthId().id());
m_config.writeEntry("defaultProofingProfileIntent", proofingIntent);
m_config.writeEntry("defaultProofingBlackpointCompensation", blackPointCompensation);
QColor c;
warningColor.toQColor(&c);
m_config.writeEntry("defaultProofingGamutwarning", c);
m_config.writeEntry("defaultProofingAdaptationState",adaptationState);
}
......@@ -21,6 +21,7 @@
#include <kconfiggroup.h>
#include "kritaimage_export.h"
#include "KisProofingConfiguration.h"
class KRITAIMAGE_EXPORT KisImageConfig
......@@ -101,6 +102,10 @@ public:
bool showAdditionalOnionSkinsSettings(bool requestDefault = false) const;
void setShowAdditionalOnionSkinsSettings(bool value);
KisProofingConfiguration *defaultProofingconfiguration();
void setDefaultProofingConfig(const KoColorSpace *proofingSpace, int proofingIntent, bool blackPointCompensation, KoColor warningColor, double adaptationState);
private:
Q_DISABLE_COPY(KisImageConfig)
......
......@@ -47,6 +47,7 @@ set(kritapigment_SRCS
KoColorConversions.cpp
KoColorConversionSystem.cpp
KoColorConversionTransformation.cpp
KoColorProofingConversionTransformation.cpp
KoColorConversionTransformationFactory.cpp
KoColorModelStandardIds.cpp
KoColorProfile.cpp
......
......@@ -23,12 +23,14 @@
#include "kritapigment_export.h"
#include <KoColorConversionTransformation.h>
#include <KoColorProofingConversionTransformation.h>
class KRITAPIGMENT_EXPORT KoColorConversionTransformationAbstractFactory
{
public:
KoColorConversionTransformationAbstractFactory() {}
virtual ~KoColorConversionTransformationAbstractFactory() {}
/**
* Creates a color transformation between the source color space and the destination
* color space.
......@@ -40,6 +42,27 @@ public:
const KoColorSpace* dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags) const = 0;
virtual KoColorProofingConversionTransformation* createColorProofingTransformation(const KoColorSpace* srcColorSpace,
const KoColorSpace* dstColorSpace,
const KoColorSpace* proofingSpace,
KoColorProofingConversionTransformation::Intent renderingIntent,
KoColorProofingConversionTransformation::Intent proofingIntent,
KoColorProofingConversionTransformation::ConversionFlags conversionFlags,
quint8 *gamutWarning,
double adaptationState) const
{
Q_UNUSED(srcColorSpace);
Q_UNUSED(dstColorSpace);
Q_UNUSED(proofingSpace);
Q_UNUSED(renderingIntent);
Q_UNUSED(proofingIntent);
Q_UNUSED(conversionFlags);
Q_UNUSED(gamutWarning);
Q_UNUSED(adaptationState);
qFatal("createColorProofinTransform undefined.");
return 0;
}
};
#endif
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*/
#include "KoColorProofingConversionTransformation.h"
#include "KoColorSpace.h"
KoColorProofingConversionTransformation::KoColorProofingConversionTransformation(const KoColorSpace* srcCs,
const KoColorSpace* dstCs,
const KoColorSpace* proofingSpace,
Intent renderingIntent,
Intent proofingIntent,
ConversionFlags conversionFlags,
quint8 *gamutWarning,
double adaptationState)
: KoColorConversionTransformation(srcCs, dstCs, renderingIntent, conversionFlags)
{
Q_ASSERT(proofingSpace);
m_proofingIntent = proofingIntent;
m_gamutWarning = gamutWarning;
m_adaptationState = adaptationState;
m_proofingSpace = proofingSpace;
}
KoColorProofingConversionTransformation::~KoColorProofingConversionTransformation()
{
}
const KoColorSpace* KoColorProofingConversionTransformation::proofingSpace() const
{
return m_proofingSpace;
}
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*/
#ifndef _KO_COLOR_PROOFING_CONVERSION_TRANSFORMATION_H_
#define _KO_COLOR_PROOFING_CONVERSION_TRANSFORMATION_H_
#include "KoColorConversionTransformation.h"
#include "kritapigment_export.h"
class KoColorSpace;
class KoColorConversionCache;
/**
* This is the base class of all color transform that convert the color of a pixel
*/
class KRITAPIGMENT_EXPORT KoColorProofingConversionTransformation : public KoColorConversionTransformation
{
public:
KoColorProofingConversionTransformation(const KoColorSpace *srcCs,
const KoColorSpace *dstCs,
const KoColorSpace *proofingSpace,
Intent renderingIntent,
Intent proofingIntent,
ConversionFlags conversionFlags,
quint8 *gamutWarning,
double adaptationState);
virtual ~KoColorProofingConversionTransformation();
public:
/**
* @brief proofingSpace
* @return the space that is used to proof the color transform
*/
const KoColorSpace *proofingSpace() const;
private:
Intent m_proofingIntent;
quint8 *m_gamutWarning;
double m_adaptationState;
const KoColorSpace *m_proofingSpace;
};
#endif
......@@ -36,6 +36,7 @@
#include "KoMixColorsOp.h"
#include "KoConvolutionOp.h"
#include "KoCompositeOpRegistry.h"
#include "KoColorSpaceEngine.h"
#include <QThreadStorage>
#include <QByteArray>
......@@ -66,6 +67,7 @@ KoColorSpace::KoColorSpace(const QString &id, const QString &name, KoMixColorsOp
d->TRCXYY = QPolygonF();
d->colorants = QVector <qreal> (0);
d->lumaCoefficients = QVector <qreal> (0);
d->iccEngine = 0;
d->deletability = NotOwnedByRegistry;
}
......@@ -119,7 +121,7 @@ QPolygonF KoColorSpace::gamutXYY() const
if ((colorModelId().id()=="CMYKA" || colorModelId().id()=="LABA") && colorDepthId().id()=="F32") {
//boundaries for cmyka/laba have trouble getting the max values for Float, and are pretty awkward in general.
max = this->channels()[0]->getUIMax();
}
int samples = 5;//amount of samples in our color space.
QString name = KoColorSpaceRegistry::instance()->colorSpaceFactory("XYZAF32")->defaultProfile();
......@@ -175,7 +177,7 @@ QPolygonF KoColorSpace::gamutXYY() const
}
}
}
}
}
delete[] data;
......@@ -230,7 +232,7 @@ QPolygonF KoColorSpace::estimatedTRCXYY() const
for (int j=0; j<5; j++){
channelValuesF.fill(0.0);
channelValuesF[i] = ((max/4)*(j));
fromNormalisedChannelsValue(data, channelValuesF);
convertPixelsTo(data, data2, xyzColorSpace, 1, KoColorConversionTransformation::IntentAbsoluteColorimetric, KoColorConversionTransformation::adjustmentConversionFlags());
......@@ -435,6 +437,26 @@ bool KoColorSpace::convertPixelsTo(const quint8 * src,
return true;
}
KoColorConversionTransformation * KoColorSpace::createProofingTransform(const KoColorSpace *dstColorSpace, const KoColorSpace *proofingSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::Intent proofingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags, quint8 *gamutWarning, double adaptationState) const
{
if (!d->iccEngine) {
d->iccEngine = KoColorSpaceEngineRegistry::instance()->get("icc");
}
if (!d->iccEngine) return 0;
return d->iccEngine->createColorProofingTransformation(this, dstColorSpace, proofingSpace, renderingIntent, proofingIntent, conversionFlags, gamutWarning, adaptationState);
}
bool KoColorSpace::proofPixelsTo(const quint8 *src,
quint8 *dst,
quint32 numPixels,
KoColorConversionTransformation *proofingTransform) const
{
proofingTransform->transform(src, dst, numPixels);
//the transform is deleted in the destructor.
return true;
}
void KoColorSpace::bitBlt(const KoColorSpace* srcSpace, const KoCompositeOp::ParameterInfo& params, const KoCompositeOp* op,
KoColorConversionTransformation::Intent renderingIntent,
......
......@@ -29,6 +29,7 @@
#include "KoColorSpaceConstants.h"
#include "KoColorConversionTransformation.h"
#include "KoColorProofingConversionTransformation.h"
#include "KoCompositeOp.h"
#include <KoID.h>
#include "kritapigment_export.h"
......@@ -107,17 +108,17 @@ public:
* maybe convert to 3d space in future?
*/
QPolygonF gamutXYY() const;
/*
* @returns a polygon with 5 samples per channel converted to xyY, but unlike
* gamutxyY it focuses on the luminance. This then can be used to visualise
* the approximate trc of a given colorspace.
*/
QPolygonF estimatedTRCXYY() const;
QVector <qreal> colorants() const;
QVector <qreal> lumaCoefficients() const;
//========== Channels =====================================================//
/// Return a list describing all the channels this color model has. The order
......@@ -371,6 +372,31 @@ public:
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags) const;
virtual KoColorConversionTransformation *createProofingTransform(const KoColorSpace * dstColorSpace,
const KoColorSpace * proofingSpace,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::Intent proofingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags,
quint8 *gamutWarning, double adaptationState) const;
/**
* @brief proofPixelsTo
* @param src
* @param dst
* @param dstColorSpace the colorspace to which we go to.
* @param proofingSpace the proofing space.
* @param numPixels the amount of pixels.
* @param renderingIntent the rendering intent used for rendering.
* @param proofingIntent the intent used for proofing.
* @param conversionFlags the conversion flags.
* @param gamutWarning the data() of a KoColor.
* @param adaptationState the state of adaptation, only affects absolute colorimetric.
* @return
*/
virtual bool proofPixelsTo(const quint8 * src,
quint8 * dst,
quint32 numPixels,
KoColorConversionTransformation *proofingTransform) const;
//============================== Manipulation functions ==========================//
......
......@@ -45,6 +45,7 @@ public:
const QString& name() const;
virtual void addProfile(const QString &filename) = 0;
virtual void removeProfile(const QString &filename) = 0;
private:
struct Private;
Private* const d;
......
......@@ -21,6 +21,8 @@
#define _KOCOLORSPACE_P_H_
#include "KoColorSpace.h"
#include "KoColorSpaceEngine.h"
#include "KoColorConversionTransformation.h"
#include <QThreadStorage>
#include <QPolygonF>
......@@ -45,6 +47,8 @@ struct Q_DECL_HIDDEN KoColorSpace::Private {
QVector <qreal> colorants;
QVector <qreal> lumaCoefficients;
KoColorSpaceEngine *iccEngine;
Deletability deletability;
};
......
......@@ -147,6 +147,9 @@ public:
QPointer<KisFloatingMessage> savedFloatingMessage;
KisSignalCompressor floatingMessageCompressor;
bool softProofing = false;
bool gamutCheck = false;
// Hmm sorry for polluting the private class with such a big inner class.
// At the beginning it was a little struct :)
class StatusBarItem
......@@ -805,6 +808,58 @@ KisSelectionSP KisView::selection()
return 0;
}
void KisView::slotSoftProofing(bool softProofing)
{
d->softProofing = softProofing;
QString message;
if (canvasBase()->image()->colorSpace()->colorDepthId().id().contains("F"))
{
message = i18n("Soft Proofing doesn't work in floating point.");
viewManager()->showFloatingMessage(message,QIcon());
return;
}
if (softProofing){
message = i18n("Soft Proofing turned on.");
} else {
message = i18n("Soft Proofing turned off.");
}
viewManager()->showFloatingMessage(message,QIcon());
canvasBase()->slotSoftProofing(softProofing);
}
void KisView::slotGamutCheck(bool gamutCheck)
{
d->gamutCheck = gamutCheck;
QString message;
if (canvasBase()->image()->colorSpace()->colorDepthId().id().contains("F"))
{
message = i18n("Gamut Warnings don't work in floating point.");
viewManager()->showFloatingMessage(message,QIcon());
return;
}
if (gamutCheck){
message = i18n("Gamut Warnings turned on.");
if (!d->softProofing){
message += "\n "+i18n("But Soft Proofing is still off.");
}
} else {
message = i18n("Gamut Warnings turned off.");
}
viewManager()->showFloatingMessage(message,QIcon());
canvasBase()->slotGamutCheck(gamutCheck);
}
bool KisView::softProofing()
{
return d->softProofing;
}
bool KisView::gamutCheck()
{
return d->gamutCheck;
}
void KisView::slotLoadingFinished()
{
if (!document()) return;
......
......@@ -192,6 +192,16 @@ public:
KisNodeSP currentNode() const;
KisLayerSP currentLayer() const;
KisMaskSP currentMask() const;
/**
* @brief softProofing
* @return whether or not we're softproofing in this view.
*/
bool softProofing();
/**
* @brief gamutCheck
* @return whether or not we're using gamut warnings in this view.
*/
bool gamutCheck();
/// Convenience method to get at the active selection (the
/// selection of the current layer, or, if that does not exist,
......@@ -216,6 +226,16 @@ public Q_SLOTS:
* @todo rename to something more generic
*/
void slotClearStatusText();
/**
* @brief slotSoftProofing set whether or not we're softproofing in this view.
* Will be setting the same in the canvas belonging to the view.
*/
void slotSoftProofing(bool softProofing);
/**
* @brief slotGamutCheck set whether or not we're gamutchecking in this view.
* Will be setting the same in the vans belonging to the view.
*/
void slotGamutCheck(bool gamutCheck);
bool queryClose();