Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Gwenview
Commits
79f1c25e
Commit
79f1c25e
authored
May 11, 2021
by
Daniel Novomeský
Committed by
Daniel Novomeský
May 27, 2021
Browse files
Read color profile from QImage
Increase minimal Qt version
parent
c23ac6c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
79f1c25e
...
...
@@ -10,7 +10,7 @@ project(gwenview VERSION ${RELEASE_SERVICE_VERSION})
set
(
CMAKE_MODULE_PATH
${
CMAKE_SOURCE_DIR
}
/cmake
)
set
(
QT_MIN_VERSION
"5.1
2
.0"
)
set
(
QT_MIN_VERSION
"5.1
4
.0"
)
set
(
KF5_MIN_VERSION
"5.68.0"
)
find_package
(
ECM
${
KF5_MIN_VERSION
}
REQUIRED NO_MODULE
)
...
...
lib/cms/cmsprofile.cpp
View file @
79f1c25e
...
...
@@ -187,6 +187,22 @@ Profile::Ptr Profile::loadFromExiv2Image(const Exiv2::Image* image)
return
ptr
;
}
Profile
::
Ptr
Profile
::
loadFromICC
(
const
QByteArray
&
data
)
{
Profile
::
Ptr
ptr
;
int
size
=
data
.
size
();
if
(
size
>
0
)
{
cmsHPROFILE
hProfile
=
cmsOpenProfileFromMem
(
data
,
size
);
if
(
hProfile
)
{
ptr
=
new
Profile
(
hProfile
);
}
}
return
ptr
;
}
cmsHPROFILE
Profile
::
handle
()
const
{
return
d
->
mProfile
;
...
...
lib/cms/cmsprofile.h
View file @
79f1c25e
...
...
@@ -66,6 +66,7 @@ public:
static
Profile
::
Ptr
loadFromImageData
(
const
QByteArray
&
data
,
const
QByteArray
&
format
);
static
Profile
::
Ptr
loadFromExiv2Image
(
const
Exiv2
::
Image
*
image
);
static
Profile
::
Ptr
loadFromICC
(
const
QByteArray
&
data
);
static
Profile
::
Ptr
getMonitorProfile
();
static
Profile
::
Ptr
getSRgbProfile
();
...
...
lib/document/loadingdocumentimpl.cpp
View file @
79f1c25e
...
...
@@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Qt
#include <QBuffer>
#include <QByteArray>
#include <QColorSpace>
#include <QFile>
#include <QFuture>
#include <QFutureWatcher>
...
...
@@ -201,6 +202,8 @@ struct LoadingDocumentImplPrivate
mExiv2Image
=
loader
.
popImage
();
}
QImageReader
reader
;
#ifdef KDCRAW_FOUND
if
(
KDcrawIface
::
KDcraw
::
rawFilesList
().
contains
(
QString
::
fromLatin1
(
mFormatHint
)))
{
QByteArray
previewData
;
...
...
@@ -233,7 +236,8 @@ struct LoadingDocumentImplPrivate
#else
{
#endif
QImageReader
reader
(
&
buffer
,
mFormatHint
);
reader
.
setFormat
(
mFormatHint
);
reader
.
setDevice
(
&
buffer
);
mImageSize
=
reader
.
size
();
if
(
!
reader
.
canRead
())
{
...
...
@@ -288,6 +292,13 @@ struct LoadingDocumentImplPrivate
mCmsProfile
=
Cms
::
Profile
::
loadFromImageData
(
mData
,
mFormat
);
}
if
(
!
mCmsProfile
&&
reader
.
canRead
())
{
const
QImage
qtimage
=
reader
.
read
();
if
(
!
qtimage
.
isNull
())
{
mCmsProfile
=
Cms
::
Profile
::
loadFromICC
(
qtimage
.
colorSpace
().
iccProfile
());
}
}
return
true
;
}
...
...
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