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

Add base implementation softproofing with toggles.

It doesn't really work yet :/

Ref: T210
Ref: T2337
parent 7de02569
......@@ -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 Softproofing</toolTip>
<iconText>Turns on Softproofing</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 {
// Proofing colorspace
// Warning color
// Rendering intent
KisProofingConfiguration() : intent(KoColorConversionTransformation::IntentAbsoluteColorimetric),
conversionFlags(KoColorConversionTransformation::BlackpointCompensation),
warningColor(KoColor()),
proofingProfile("Chemical proof"),
proofingModel("CMYKA"),
proofingDepth("U8"){}
KoColorConversionTransformation::Intent intent;
KoColorConversionTransformation::ConversionFlags conversionFlags;
KoColor warningColor;
QString proofingProfile;
QString proofingModel;
QString proofingDepth;
// Conversion flags (except for the SOFTPROOFING and GAMUTCHECK flags, which are per-view)
};
#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
......@@ -1597,6 +1599,9 @@ KisImageAnimationInterface* KisImage::animationInterface() const
KisProofingConfiguration *KisImage::proofingConfiguration() const
{
// XXXX
return 0;
if (!m_d->proofingConfig) {
qDebug()<<"Image: No proofing config found, generating one.";
m_d->proofingConfig = new KisProofingConfiguration();
}
return m_d->proofingConfig;
}
......@@ -443,15 +443,16 @@ bool KoColorSpace::proofPixelsTo(const quint8 * src,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags) const
{
if (*this == *dstColorSpace && *this == *proofingSpace) {
/*if (*this == *dstColorSpace) {
if (src != dst) {
memcpy(dst, src, numPixels * sizeof(quint8) * pixelSize());
}
return true;
}
}*/
// Only the icc engine can do this kind of stuff
//Can we cache this, maybe???
KoColorSpaceEngine *engine = KoColorSpaceEngineRegistry::instance()->get("icc");
qDebug() << ">>>>>>>>>>>>>>>>>>>> we got a proofing engine";
//qDebug() << ">>>>>>>>>>>>>>>>>>>> we got a proofing engine";
if (!engine) return false;
KoColorConversionTransformation *transform = engine->createColorProofingTransformation(this, dstColorSpace, proofingSpace, renderingIntent, conversionFlags);
......
......@@ -147,6 +147,9 @@ public:
QPointer<KisFloatingMessage> savedFloatingMessage;
KisSignalCompressor floatingMessageCompressor;
bool softProofing;
bool gamutCheck;
// Hmm sorry for polluting the private class with such a big inner class.
// At the beginning it was a little struct :)
class StatusBarItem
......@@ -881,3 +884,8 @@ void KisView::slotImageSizeChanged(const QPointF &oldStillPoint, const QPointF &
zoomManager()->updateImageBoundsSnapping();
zoomManager()->updateGUI();
}
void KisView::setProofingOptions(bool softProofing, bool gamutCheck)
{
canvasBase()->setProofingOptions(softProofing, gamutCheck);
}
......@@ -254,7 +254,9 @@ public Q_SLOTS:
void slotImageResolutionChanged();
void slotImageSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint);
private:
void setProofingOptions(bool softProofing, bool gamutCheck);
class Private;
Private * const d;
......
......@@ -208,6 +208,8 @@ public:
KisAction *zoomTo100pct;
KisAction *zoomIn;
KisAction *zoomOut;
KisAction *softProof;
KisAction *gamutCheck;
KisSelectionManager selectionManager;
KisGuidesManager guidesManager;
......@@ -385,6 +387,9 @@ void KisViewManager::setCurrentView(KisView *view)
d->viewConnections.addUniqueConnection(d->zoomIn, SIGNAL(triggered()), imageView->zoomController()->zoomAction(), SLOT(zoomIn()));
d->viewConnections.addUniqueConnection(d->zoomOut, SIGNAL(triggered()), imageView->zoomController()->zoomAction(), SLOT(zoomOut()));
d->viewConnections.addUniqueConnection(d->softProof, SIGNAL(toggled(bool)), d->currentImageView->canvasBase(), SLOT(slotSoftProofing(bool)) );
d->viewConnections.addUniqueConnection(d->gamutCheck, SIGNAL(toggled(bool)), d->currentImageView->canvasBase(), SLOT(slotGamutCheck(bool)) );
imageView->zoomManager()->setShowRulers(d->showRulersAction->isChecked());
imageView->zoomManager()->setRulersTrackMouse(d->rulersTrackMouseAction->isChecked());
......@@ -603,6 +608,8 @@ void KisViewManager::createActions()
d->resetCanvasRotation = actionManager()->createAction("reset_canvas_rotation");
d->wrapAroundAction = actionManager()->createAction("wrap_around_mode");
d->levelOfDetailAction = actionManager()->createAction("level_of_detail_mode");
d->softProof = actionManager()->createAction("softProof");
d->gamutCheck = actionManager()->createAction("gamutCheck");
KisAction *tAction = actionManager()->createAction("showStatusBar");
tAction->setChecked(cfg.showStatusBar());
......
......@@ -74,6 +74,9 @@
#include "opengl/kis_opengl.h"
#include "kis_fps_decoration.h"
#include "KoColorConversionTransformation.h"
#include "KisProofingConfiguration.h"
#include <kis_favorite_resource_manager.h>
#include <kis_popup_palette.h>
......@@ -110,6 +113,9 @@ public:
QRect savedUpdateRect;
QBitArray channelFlags;
KisProofingConfiguration *proofingConfig = 0;
bool softProofing = false;
bool gamutCheck = false;
KisPopupPalette *popupPalette = 0;
KisDisplayColorConverter displayColorConverter;
......@@ -544,6 +550,50 @@ KisExposureGammaCorrectionInterface* KisCanvas2::exposureGammaCorrectionInterfac
KisDumbExposureGammaCorrectionInterface::instance();
}
void KisCanvas2::setProofingOptions(bool softProof, bool gamutCheck)
{
m_d->proofingConfig = this->image()->proofingConfiguration();
if (!m_d->proofingConfig) {
qDebug()<<"Canvas: No proofing config found, generating one.";
m_d->proofingConfig = new KisProofingConfiguration();
}
KoColorConversionTransformation::ConversionFlags conversionFlags = m_d->proofingConfig->conversionFlags;
if (softProof) {
conversionFlags |= KoColorConversionTransformation::SoftProofing;
qDebug()<<"setting softproofing in canvas";
}
if (gamutCheck) {
conversionFlags |= KoColorConversionTransformation::GamutCheck;
qDebug()<<"setting gamutChecking in canvas";
}
m_d->proofingConfig->conversionFlags = conversionFlags;
startUpdateInPatches(this->image()->bounds());
}
void KisCanvas2::slotSoftProofing(bool softProofing)
{
m_d->softProofing = softProofing;
setProofingOptions(m_d->softProofing, m_d->gamutCheck);
}
void KisCanvas2::slotGamutCheck(bool gamutCheck)
{
m_d->gamutCheck = gamutCheck;
setProofingOptions(m_d->softProofing, m_d->gamutCheck);
}
KisProofingConfiguration *KisCanvas2::proofingConfiguration() const
{
if (!m_d->proofingConfig) {
qDebug()<<"No proofing config found, generating one";
m_d->proofingConfig = new KisProofingConfiguration();
}
return m_d->proofingConfig;
}
void KisCanvas2::startResizingImage()
{
KisImageWSP image = this->image();
......
......@@ -164,8 +164,10 @@ public: // KisCanvas2 methods
void setDisplayFilter(KisDisplayFilter *displayFilter);
KisDisplayFilter *displayFilter() const;
KisDisplayColorConverter* displayColorConverter() const;
KisDisplayColorConverter *displayColorConverter() const;
KisExposureGammaCorrectionInterface* exposureGammaCorrectionInterface() const;
void setProofingOptions(bool softProof, bool gamutCheck);
KisProofingConfiguration *proofingConfiguration() const;
void setCursor(const QCursor &cursor);
KisAnimationFrameCacheSP frameCache() const;
......@@ -196,6 +198,8 @@ public Q_SLOTS:
/// Bools indicating canvasmirroring.
bool xAxisMirrored() const;
bool yAxisMirrored() const;
void slotSoftProofing(bool softProofing);
void slotGamutCheck(bool gamutCheck);
void channelSelectionChanged();
......
......@@ -217,6 +217,7 @@ void KisOpenGLCanvas2::initializeGL()
initializeOpenGLFunctions();
KisConfig cfg;
d->openGLImageTextures->setProofingConfig(canvas()->proofingConfiguration());
d->openGLImageTextures->initGL(context()->functions());
d->openGLImageTextures->generateCheckerTexture(createCheckersImage(cfg.checkSize()));
initializeCheckerShader();
......@@ -788,6 +789,7 @@ void KisOpenGLCanvas2::finishResizingImage(qint32 w, qint32 h)
KisUpdateInfoSP KisOpenGLCanvas2::startUpdateCanvasProjection(const QRect & rc, const QBitArray &channelFlags)
{
d->openGLImageTextures->setChannelFlags(channelFlags);
d->openGLImageTextures->setProofingConfig(canvas()->proofingConfiguration());
return d->openGLImageTextures->updateCache(rc);
}
......
......@@ -58,6 +58,7 @@ KisOpenGLImageTextures::KisOpenGLImageTextures()
, m_allChannelsSelected(true)
, m_useOcio(false)
, m_initialized(false)
, m_proofingConfig(0)
{
KisConfig cfg;
m_renderingIntent = (KoColorConversionTransformation::Intent)cfg.monitorRenderIntent();
......@@ -65,7 +66,6 @@ KisOpenGLImageTextures::KisOpenGLImageTextures()
m_conversionFlags = KoColorConversionTransformation::HighQuality;
if (cfg.useBlackPointCompensation()) m_conversionFlags |= KoColorConversionTransformation::BlackpointCompensation;
if (!cfg.allowLCMSOptimization()) m_conversionFlags |= KoColorConversionTransformation::NoOptimization;
m_useOcio = cfg.useOcio();
}
......@@ -325,7 +325,16 @@ KisOpenGLUpdateInfoSP KisOpenGLImageTextures::updateCacheImpl(const QRect& rect,
tileInfo->retrieveData(m_image, channelFlags, m_onlyOneChannelSelected, m_selectedChannelIndex);
if (convertColorSpace) {
tileInfo->convertTo(dstCS, m_renderingIntent, m_conversionFlags);
if (m_proofingConfig && m_proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::SoftProofing)) {
//qDebug()<<"model: "<<m_proofingConfig->proofingModel<<", depth: "<<m_proofingConfig->proofingDepth<<", profile: "<<m_proofingConfig->proofingProfile;
const KoColorSpace *proofingSpace = KoColorSpaceRegistry::instance()->colorSpace(m_proofingConfig->proofingModel,m_proofingConfig->proofingDepth,m_proofingConfig->proofingProfile);
if (!proofingSpace){
qDebug()<<"Proofing space is incorrect";
}
tileInfo->proofTo(dstCS, proofingSpace, m_proofingConfig->intent, m_proofingConfig->conversionFlags);
} else {
tileInfo->convertTo(dstCS, m_renderingIntent, m_conversionFlags);
}
}
info->tileList.append(tileInfo);
......@@ -449,6 +458,11 @@ void KisOpenGLImageTextures::setChannelFlags(const QBitArray &channelFlags)
m_onlyOneChannelSelected = (selectedChannels == 1);
}
void KisOpenGLImageTextures::setProofingConfig(KisProofingConfiguration *proofingConfig)
{
m_proofingConfig = proofingConfig;
}
void KisOpenGLImageTextures::getTextureSize(KisGLTexturesInfo *texturesInfo)
{
KisConfig cfg;
......
......@@ -27,6 +27,7 @@
#include "canvas/kis_update_info.h"
#include "opengl/kis_texture_tile.h"
#include "KisProofingConfiguration.h"
class KisOpenGLImageTextures;
class QOpenGLFunctions;
......@@ -79,6 +80,7 @@ public:
void initGL(QOpenGLFunctions *f);
void setChannelFlags(const QBitArray &channelFlags);
void setProofingConfig(KisProofingConfiguration*);
bool internalColorManagementActive() const;
bool setInternalColorManagementActive(bool value);
......@@ -157,9 +159,9 @@ private:
KisImageWSP m_image;
QRect m_storedImageBounds;
const KoColorProfile *m_monitorProfile;
const KoColorProfile *m_proofingProfile;
KoColorConversionTransformation::Intent m_renderingIntent;
KoColorConversionTransformation::ConversionFlags m_conversionFlags;
KisProofingConfiguration *m_proofingConfig;
/**
* If the destination color space coincides with the one of the image,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment