Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Miguel Lopez
Krita
Commits
561c99c3
Commit
561c99c3
authored
May 02, 2014
by
Dmitry Kazakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed color management in Internal mode
It seems that it was accidentally disabled :)
parent
740e9f29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
20 deletions
+50
-20
krita/plugins/extensions/dockers/lut/ocio_display_filter.cpp
krita/plugins/extensions/dockers/lut/ocio_display_filter.cpp
+1
-1
krita/ui/canvas/kis_display_color_converter.cpp
krita/ui/canvas/kis_display_color_converter.cpp
+34
-17
libs/pigment/KoColor.cpp
libs/pigment/KoColor.cpp
+8
-2
libs/pigment/KoColor.h
libs/pigment/KoColor.h
+7
-0
No files found.
krita/plugins/extensions/dockers/lut/ocio_display_filter.cpp
View file @
561c99c3
...
...
@@ -80,7 +80,7 @@ void OcioDisplayFilter::approximateForwardTransformation(quint8 *pixels, quint32
bool
OcioDisplayFilter
::
useInternalColorManagement
()
const
{
return
f
alse
;
return
f
orceInternalColorManagement
;
}
#ifdef HAVE_OPENGL
...
...
krita/ui/canvas/kis_display_color_converter.cpp
View file @
561c99c3
...
...
@@ -82,7 +82,7 @@ struct KisDisplayColorConverter::Private
void
setCurrentNode
(
KisNodeSP
node
);
bool
useOcio
()
const
;
bool
finalIsRgba
()
const
;
bool
finalIsRgba
(
const
KoColorSpace
*
cs
)
const
;
template
<
bool
flipToBgra
>
QColor
floatArrayToQColor
(
const
float
*
p
);
...
...
@@ -293,9 +293,13 @@ void KisDisplayColorConverter::setDisplayFilter(KisDisplayFilterSP displayFilter
m_d
->
intermediateColorSpace
=
0
;
if
(
m_d
->
displayFilter
)
{
const
KoColorProfile
*
intermediateProfile
=
m_d
->
displayFilter
->
useInternalColorManagement
()
?
m_d
->
monitorProfile
:
0
;
m_d
->
intermediateColorSpace
=
KoColorSpaceRegistry
::
instance
()
->
colorSpace
(
RGBAColorModelID
.
id
(),
Float32BitsColorDepthID
.
id
(),
0
);
colorSpace
(
RGBAColorModelID
.
id
(),
Float32BitsColorDepthID
.
id
(),
intermediateProfile
);
KIS_ASSERT_RECOVER
(
m_d
->
intermediateColorSpace
)
{
m_d
->
intermediateColorSpace
=
m_d
->
monitorColorSpace
;
...
...
@@ -346,12 +350,12 @@ const KoColorProfile* KisDisplayColorConverter::monitorProfile() const
return
m_d
->
monitorProfile
;
}
bool
KisDisplayColorConverter
::
Private
::
finalIsRgba
()
const
bool
KisDisplayColorConverter
::
Private
::
finalIsRgba
(
const
KoColorSpace
*
cs
)
const
{
/**
* In Krita RGB color spaces differ: 8/16bit are BGRA, 16f/32f-bit RGBA
*/
KoID
colorDepthId
=
paintingColorSpace
->
colorDepthId
();
KoID
colorDepthId
=
cs
->
colorDepthId
();
return
colorDepthId
==
Float16BitsColorDepthID
||
colorDepthId
==
Float32BitsColorDepthID
;
}
...
...
@@ -377,26 +381,29 @@ QColor KisDisplayColorConverter::toQColor(const KoColor &srcColor) const
c
.
convertTo
(
m_d
->
paintingColorSpace
);
if
(
!
m_d
->
useOcio
())
{
QByteArray
pixel
(
m_d
->
monitorColorSpace
->
pixelSize
(),
0
);
c
.
colorSpace
()
->
convertPixelsTo
(
c
.
data
(),
(
quint8
*
)
pixel
.
data
(),
m_d
->
monitorColorSpace
,
1
,
m_d
->
renderingIntent
,
m_d
->
conversionFlags
);
// we expect the display profile is rgb8, which is BGRA here
KIS_ASSERT_RECOVER
(
m_d
->
monitorColorSpace
->
pixelSize
()
==
4
)
{
return
Qt
::
red
;
};
const
quint8
*
p
=
(
const
quint8
*
)
pixel
.
constData
();
c
.
convertTo
(
m_d
->
monitorColorSpace
,
m_d
->
renderingIntent
,
m_d
->
conversionFlags
);
const
quint8
*
p
=
c
.
data
();
return
QColor
(
p
[
2
],
p
[
1
],
p
[
0
],
p
[
3
]);
}
else
{
int
numChannels
=
m_d
->
paintingColorSpace
->
channelCount
();
const
KoColorSpace
*
srcCS
=
c
.
colorSpace
();
if
(
m_d
->
displayFilter
->
useInternalColorManagement
())
{
srcCS
=
m_d
->
monitorColorSpace
;
c
.
convertTo
(
srcCS
,
m_d
->
renderingIntent
,
m_d
->
conversionFlags
);
}
int
numChannels
=
srcCS
->
channelCount
();
QVector
<
float
>
normalizedChannels
(
numChannels
);
m_d
->
paintingColorSpace
->
normalisedChannels
Value
(
c
.
data
(),
normalizedChannels
);
srcCS
->
normalisedChannels1
Value
(
c
.
data
(),
normalizedChannels
);
m_d
->
displayFilter
->
filter
((
quint8
*
)
normalizedChannels
.
data
(),
1
);
const
float
*
p
=
(
const
float
*
)
normalizedChannels
.
constData
();
return
m_d
->
finalIsRgba
()
?
return
m_d
->
finalIsRgba
(
srcCS
)
?
m_d
->
floatArrayToQColor
<
true
>
(
p
)
:
m_d
->
floatArrayToQColor
<
false
>
(
p
);
}
...
...
@@ -419,11 +426,12 @@ KisDisplayColorConverter::Private::convertToQImageDirect(KisPaintDeviceSP device
KisSequentialConstIterator
it
(
device
,
bounds
);
quint8
*
dstPtr
=
image
.
bits
();
int
numChannels
=
paintingColorSpace
->
channelCount
();
const
KoColorSpace
*
cs
=
device
->
colorSpace
();
int
numChannels
=
cs
->
channelCount
();
QVector
<
float
>
normalizedChannels
(
numChannels
);
do
{
paintingColorSpace
->
normalisedChannelsValue
(
it
.
rawDataConst
(),
normalizedChannels
);
cs
->
normalisedChannelsValue
(
it
.
rawDataConst
(),
normalizedChannels
);
displayFilter
->
filter
((
quint8
*
)
normalizedChannels
.
data
(),
1
);
const
float
*
p
=
normalizedChannels
.
constData
();
...
...
@@ -459,7 +467,16 @@ QImage KisDisplayColorConverter::toQImage(KisPaintDeviceSP srcDevice) const
if
(
!
m_d
->
useOcio
())
{
return
device
->
convertToQImage
(
m_d
->
monitorProfile
,
m_d
->
renderingIntent
,
m_d
->
conversionFlags
);
}
else
{
return
m_d
->
finalIsRgba
()
?
if
(
m_d
->
displayFilter
->
useInternalColorManagement
())
{
if
(
device
==
srcDevice
)
{
device
=
new
KisPaintDevice
(
*
srcDevice
);
}
KUndo2Command
*
cmd
=
device
->
convertTo
(
m_d
->
monitorColorSpace
,
m_d
->
renderingIntent
,
m_d
->
conversionFlags
);
delete
cmd
;
}
return
m_d
->
finalIsRgba
(
device
->
colorSpace
())
?
m_d
->
convertToQImageDirect
<
true
>
(
device
)
:
m_d
->
convertToQImageDirect
<
false
>
(
device
);
}
...
...
libs/pigment/KoColor.cpp
View file @
561c99c3
...
...
@@ -140,7 +140,7 @@ bool KoColor::operator==(const KoColor &other) const
return
memcmp
(
d
->
data
,
other
.
d
->
data
,
d
->
colorSpace
->
pixelSize
())
==
0
;
}
void
KoColor
::
convertTo
(
const
KoColorSpace
*
cs
)
void
KoColor
::
convertTo
(
const
KoColorSpace
*
cs
,
KoColorConversionTransformation
::
Intent
renderingIntent
,
KoColorConversionTransformation
::
ConversionFlags
conversionFlags
)
{
//dbgPigment <<"Our colormodel:" << d->colorSpace->id().name()
// << ", new colormodel: " << cs->id().name() << "\n";
...
...
@@ -151,13 +151,19 @@ void KoColor::convertTo(const KoColorSpace * cs)
quint8
*
data
=
new
quint8
[
cs
->
pixelSize
()];
memset
(
data
,
0
,
cs
->
pixelSize
());
d
->
colorSpace
->
convertPixelsTo
(
d
->
data
,
data
,
cs
,
1
,
KoColorConversionTransformation
::
InternalRenderingIntent
,
KoColorConversionTransformation
::
InternalC
onversionFlags
);
d
->
colorSpace
->
convertPixelsTo
(
d
->
data
,
data
,
cs
,
1
,
renderingIntent
,
c
onversionFlags
);
delete
[]
d
->
data
;
d
->
data
=
data
;
d
->
colorSpace
=
KoColorSpaceRegistry
::
instance
()
->
permanentColorspace
(
cs
);
}
void
KoColor
::
convertTo
(
const
KoColorSpace
*
cs
)
{
convertTo
(
cs
,
KoColorConversionTransformation
::
InternalRenderingIntent
,
KoColorConversionTransformation
::
InternalConversionFlags
);
}
void
KoColor
::
setColor
(
const
quint8
*
data
,
const
KoColorSpace
*
colorSpace
)
{
...
...
libs/pigment/KoColor.h
View file @
561c99c3
...
...
@@ -23,6 +23,8 @@
#include <QColor>
#include <QMetaType>
#include "pigment_export.h"
#include "KoColorConversionTransformation.h"
class
QDomDocument
;
class
QDomElement
;
...
...
@@ -75,8 +77,13 @@ public:
/// Convert this KoColor to the specified colorspace. If the specified colorspace is the
/// same as the original colorspace, do nothing. Returns the converted KoColor.
void
convertTo
(
const
KoColorSpace
*
cs
,
KoColorConversionTransformation
::
Intent
renderingIntent
,
KoColorConversionTransformation
::
ConversionFlags
conversionFlags
);
void
convertTo
(
const
KoColorSpace
*
cs
);
/// Replace the existing color data, and colorspace with the specified data.
/// The data pointer remains of the responsibility of the caller, and this function
/// might change the internal pointer and reallocate memory if necesserary.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment