Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qpdfoutputintent.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qpdfoutputintent.h"
6
7
#
ifndef
QT_NO_PDF
8
9
#
include
<
QtCore
/
qfile
.
h
>
10
#
include
<
QtCore
/
qshareddata
.
h
>
11
#
include
<
QtCore
/
qstring
.
h
>
12
#
include
<
QtCore
/
qurl
.
h
>
13
14
#
include
<
QtGui
/
qcolorspace
.
h
>
15
16
QT_BEGIN_NAMESPACE
17
18
using
namespace
Qt::StringLiterals;
19
20
class
QPdfOutputIntentPrivate
:
public
QSharedData
21
{
22
public
:
23
QPdfOutputIntentPrivate
()
24
{
25
QFile colorProfileFile(QStringLiteral(
":/qpdf/sRGB2014.icc"
));
26
bool
ok = colorProfileFile.open(QIODevice::ReadOnly);
27
Q_ASSERT(ok);
28
outputProfile = QColorSpace::fromIccProfile(colorProfileFile.readAll());
29
}
30
31
QString
outputConditionIdentifier
=
QStringLiteral
(
"sRGB_IEC61966-2-1_black_scaled"
);
32
QString
outputCondition
=
QStringLiteral
(
"sRGB IEC61966 v2.1 with black scaling"
);
33
QUrl
registryName
=
QUrl
{u"http://www.color.org"_s};
34
QColorSpace
outputProfile
;
35
};
36
37
/*!
38
\class QPdfOutputIntent
39
\inmodule QtGui
40
\ingroup painting
41
\since 6.8
42
43
The QPdfOutputIntent class contains metadata that characterize
44
the printing condition for which painting data has been prepared
45
when generating a PDF file.
46
47
\sa QPdfWriter
48
*/
49
50
/*!
51
Constructs a new PDF output intent.
52
*/
53
QPdfOutputIntent::QPdfOutputIntent()
54
: d(
new
QPdfOutputIntentPrivate)
55
{}
56
57
/*!
58
Constructs a copy of the output intent \a other.
59
*/
60
QPdfOutputIntent::QPdfOutputIntent(
const
QPdfOutputIntent &other) =
default
;
61
62
/*!
63
\fn QPdfOutputIntent::QPdfOutputIntent(QPdfOutputIntent &&other) noexcept
64
65
Constructs a QPdfOutputIntent object by moving from \a other.
66
*/
67
68
/*!
69
Assigns the output intent \a other over this intent.
70
*/
71
QPdfOutputIntent &QPdfOutputIntent::operator=(
const
QPdfOutputIntent &other) =
default
;
72
73
/*!
74
\fn QPdfOutputIntent &QPdfOutputIntent::operator=(QPdfOutputIntent &&other) noexcept
75
76
Move-assigns the output intent \a other over this intent.
77
*/
78
79
/*!
80
Destroys this output intent.
81
*/
82
QPdfOutputIntent::~QPdfOutputIntent() =
default
;
83
84
/*!
85
\fn void QPdfOutputIntent::swap(QPdfOutputIntent &other) noexcept
86
\memberswap{output intent}
87
*/
88
89
/*!
90
Returns the identifier of the output condition.
91
92
If a registry name is provided, then this identifier should should
93
match the reference name of an entry in that registry.
94
95
The default identifier is \c{sRGB_IEC61966-2-1_black_scaled}.
96
97
\sa setOutputConditionIdentifier()
98
*/
99
QString QPdfOutputIntent::outputConditionIdentifier()
const
100
{
101
return
d->outputConditionIdentifier;
102
}
103
104
/*!
105
Sets the identifier of the output condition to \a identifier.
106
107
If a registry name is provided, then this identifier should should
108
match the reference name of an entry in that registry.
109
110
\sa setOutputCondition(), setRegistryName()
111
*/
112
void
QPdfOutputIntent::setOutputConditionIdentifier(
const
QString &identifier)
113
{
114
d.detach();
115
d->outputConditionIdentifier = identifier;
116
}
117
118
/*!
119
Returns the human-readable output condition.
120
121
This is a string that concisely identifies the characterized
122
printing condition in a form that will be meaningful to a
123
human operator.
124
125
The default output condition is
126
\c{sRGB IEC61966 v2.1 with black scaling}.
127
128
\sa setOutputCondition()
129
*/
130
QString QPdfOutputIntent::outputCondition()
const
131
{
132
return
d->outputCondition;
133
}
134
135
/*!
136
Sets the human-readable output condition to \a condition.
137
138
\sa setOutputConditionIdentifier(), setRegistryName()
139
*/
140
void
QPdfOutputIntent::setOutputCondition(
const
QString &condition)
141
{
142
d.detach();
143
d->outputCondition = condition;
144
}
145
146
/*!
147
Returns the URL of a characterization registry for the intended
148
printing condition.
149
150
The default registry is \c{http://www.color.org}.
151
152
\sa setOutputConditionIdentifier()
153
*/
154
QUrl QPdfOutputIntent::registryName()
const
155
{
156
return
d->registryName;
157
}
158
159
/*!
160
Sets the URL of the characterization registry to \a name.
161
162
\sa setOutputConditionIdentifier()
163
*/
164
void
QPdfOutputIntent::setRegistryName(
const
QUrl &name)
165
{
166
d.detach();
167
d->registryName = name;
168
}
169
170
/*!
171
Returns the output device profile.
172
173
The default profile is the sRGB v2 profile available
174
from the
175
\l{https://www.color.org/srgbprofiles.xalter#v2}{International
176
Color Consortium}.
177
*/
178
QColorSpace QPdfOutputIntent::outputProfile()
const
179
{
180
return
d->outputProfile;
181
}
182
183
/*!
184
Sets the output device profile to \a profile.
185
186
\note PDF/X-4 requires all the color specifications in the
187
document to match the same colorspace of \a profile. It is
188
the application's responsibility to ensure this is the case.
189
190
\sa QColorSpace::fromIccProfile, QPdfWriter::setColorModel
191
*/
192
void
QPdfOutputIntent::setOutputProfile(
const
QColorSpace &profile)
193
{
194
d.detach();
195
d->outputProfile = profile;
196
}
197
198
QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QPdfOutputIntentPrivate)
199
200
QT_END_NAMESPACE
201
202
#
endif
// QT_NO_PDF
QPdfOutputIntentPrivate
Definition
qpdfoutputintent.cpp:21
QPdfOutputIntentPrivate::outputCondition
QString outputCondition
Definition
qpdfoutputintent.cpp:32
QPdfOutputIntentPrivate::outputProfile
QColorSpace outputProfile
Definition
qpdfoutputintent.cpp:34
QPdfOutputIntentPrivate::registryName
QUrl registryName
Definition
qpdfoutputintent.cpp:33
QPdfOutputIntentPrivate::outputConditionIdentifier
QString outputConditionIdentifier
Definition
qpdfoutputintent.cpp:31
QPdfOutputIntentPrivate::QPdfOutputIntentPrivate
QPdfOutputIntentPrivate()
Definition
qpdfoutputintent.cpp:23
qtbase
src
gui
painting
qpdfoutputintent.cpp
Generated on
for Qt by
1.18.0