11#include <QApplication>
13#include <kpluginfactory.h>
53 options.
alpha = configuration->getBool(
"alpha",
true);
54 options.
interlace = configuration->getBool(
"interlaced",
false);
55 options.
compression = configuration->getInt(
"compression", 3);
60 options.
forceSRGB = configuration->getBool(
"forceSRGB",
true);
61 options.
storeAuthor = configuration->getBool(
"storeAuthor",
false);
62 options.
storeMetaData = configuration->getBool(
"storeMetaData",
false);
63 options.
downsample = configuration->getBool(
"downsample",
false);
68 const QString conversionOption = configuration->getString(
"floatingPointConversionOption",
"KeepSame");
70 if (conversionOption ==
"Rec2100PQ") {
73 }
else if (conversionOption ==
"Rec2100HLG") {
76 }
else if (conversionOption ==
"ApplyPQ") {
78 }
else if (conversionOption ==
"ApplyHLG") {
80 }
else if (conversionOption ==
"ApplySMPTE428") {
109 cfg->setProperty(
"alpha",
true);
110 cfg->setProperty(
"indexed",
false);
111 cfg->setProperty(
"compression", 3);
112 cfg->setProperty(
"interlaced",
false);
118 v.setValue(fill_color);
120 cfg->setProperty(
"transparencyFillcolor",
v);
121 cfg->setProperty(
"forceSRGB",
true);
122 cfg->setProperty(
"storeMetaData",
false);
123 cfg->setProperty(
"storeAuthor",
false);
124 cfg->setProperty(
"downsample",
false);
125 cfg->setProperty(
"storeColorSpaceInfo",
true);
126 cfg->setProperty(
"writeCicpIfPossible",
false);
127 cfg->setProperty(
"storeExtraColorChunks",
false);
128 cfg->setProperty(
"floatingPointConversionOption",
"KeepSame");
141 supportedColorModels << QPair<KoID, KoID>()
167 QStringList conversionOptionsList = { i18nc(
"Color space name",
"Rec 2100 PQ"), i18nc(
"Color space name",
"Rec 2100 HLG")};
168 QStringList toolTipList = {i18nc(
"@tooltip",
"The image will be converted to Rec 2020 linear first, and then encoded with a perceptual quantizer curve"
169 " (also known as SMPTE 2048 curve). Recommended for HDR images where the absolute brightness is important."),
170 i18nc(
"@tooltip",
"The image will be converted to Rec 2020 linear first, and then encoded with a Hybrid Log Gamma curve."
171 " Recommended for HDR images where the display may not understand HDR.")};
172 QStringList conversionOptionName = {
"Rec2100PQ",
"Rec2100HLG"};
176 conversionOptionsList << i18nc(
"Color space option plus transfer function name",
"Keep colorants, encode PQ");
177 toolTipList << i18nc(
"@tooltip",
"The image will be linearized first, and then encoded with a perceptual quantizer curve"
178 " (also known as the SMPTE 2048 curve). Recommended for images where the absolute brightness is important.");
179 conversionOptionName <<
"ApplyPQ";
181 conversionOptionsList << i18nc(
"Color space option plus transfer function name",
"Keep colorants, encode HLG");
182 toolTipList << i18nc(
"@tooltip",
"The image will be linearized first, and then encoded with a Hybrid Log Gamma curve."
183 " Recommended for images intended for screens which cannot understand PQ");
184 conversionOptionName <<
"ApplyHLG";
186 conversionOptionsList << i18nc(
"Color space option plus transfer function name",
"Keep colorants, encode SMPTE ST 428");
187 toolTipList << i18nc(
"@tooltip",
"The image will be linearized first, and then encoded with SMPTE ST 428."
188 " Krita always opens images like these as linear floating point, this option is there to reverse that");
189 conversionOptionName <<
"ApplySMPTE428";
192 conversionOptionsList << i18nc(
"Color space option",
"No changes, clip");
193 toolTipList << i18nc(
"@tooltip",
"The image will be converted plainly to 16bit integer, and values that are out of bounds are clipped, the icc profile will be embedded.");
194 conversionOptionName <<
"KeepSame";
197 cmbFloatingConversion->clear();
198 cmbFloatingConversion->addItems(conversionOptionsList);
199 for (
int i=0; i< toolTipList.size(); i++) {
200 cmbFloatingConversion->setItemData(i, toolTipList.at(i), Qt::ToolTipRole);
201 cmbFloatingConversion->setItemData(i, conversionOptionName.at(i), Qt::UserRole+1);
204 cfg->getString(
"floatingPointConversionOption",
"KeepSame");
205 if (conversionOptionName.contains(optionName)) {
206 cmbFloatingConversion->setCurrentIndex(
207 conversionOptionName.indexOf(optionName));
209 const QString colorDepthId =
220 gbSaveColorInfo->setChecked(cfg->getBool(
"storeColorSpaceInfo",
true));
221 chkCICP->setChecked(cfg->getBool(
"writeCicpIfPossible",
true));
222 chkExtraColorChunks->setChecked(cfg->getBool(
"storeExtraColorChunks",
true));
227 alpha->setChecked(cfg->getBool(
"alpha", isThereAlpha));
229 bnTransparencyFillColor->setEnabled(!alpha->isChecked());
232 tryToSaveAsIndexed->setVisible(
true);
233 if (alpha->isChecked()) {
234 tryToSaveAsIndexed->setChecked(
false);
237 tryToSaveAsIndexed->setChecked(cfg->getBool(
"indexed",
false));
241 tryToSaveAsIndexed->setVisible(
false);
243 interlacing->setChecked(cfg->getBool(
"interlaced",
false));
244 compressionLevel->setValue(cfg->getInt(
"compression", 3));
245 compressionLevel->setRange(1, 9, 0);
247 tryToSaveAsIndexed->setVisible(!isThereAlpha);
249 chkForceSRGB->setChecked(cfg->getBool(
"forceSRGB",
false));
251 chkAuthor->setChecked(cfg->getBool(
"storeAuthor",
false));
252 chkMetaData->setChecked(cfg->getBool(
"storeMetaData",
false));
256 bnTransparencyFillColor->setDefaultColor(background);
257 bnTransparencyFillColor->setColor(cfg->getColor(
"transparencyFillcolor", background));
259 chkDownsample->setChecked(cfg->getBool(
"downsample",
false));
269 bool alpha = this->alpha->isChecked();
270 bool interlace = interlacing->isChecked();
271 int compression = (int)compressionLevel->value();
272 bool tryToSaveAsIndexed = this->tryToSaveAsIndexed->isChecked();
273 bool forceSRGB = chkForceSRGB->isEnabled()? chkForceSRGB->isChecked():
false;
274 bool storeAuthor = chkAuthor->isChecked();
275 bool storeMetaData = chkMetaData->isChecked();
276 bool downsample = chkDownsample->isChecked();
278 bool saveColorInfo = gbSaveColorInfo->isChecked();
279 bool saveCICP = chkCICP->isChecked();
280 bool extraColor = chkExtraColorChunks->isChecked();
282 QString conversionMode = cmbFloatingConversion->currentData(Qt::UserRole+1).toString();
284 QVariant transparencyFillcolor;
285 transparencyFillcolor.setValue(bnTransparencyFillColor->color());
287 cfg->setProperty(
"alpha", alpha);
288 cfg->setProperty(
"indexed", tryToSaveAsIndexed);
289 cfg->setProperty(
"compression", compression);
290 cfg->setProperty(
"interlaced", interlace);
291 cfg->setProperty(
"transparencyFillcolor", transparencyFillcolor);
292 cfg->setProperty(
"forceSRGB", forceSRGB);
293 cfg->setProperty(
"storeAuthor", storeAuthor);
294 cfg->setProperty(
"storeMetaData", storeMetaData);
295 cfg->setProperty(
"downsample", downsample);
296 cfg->setProperty(
"storeColorSpaceInfo", saveColorInfo);
297 cfg->setProperty(
"writeCicpIfPossible", saveCICP);
298 cfg->setProperty(
"storeExtraColorChunks", extraColor);
299 cfg->setProperty(
"floatingPointConversionOption", conversionMode);
305 bnTransparencyFillColor->setEnabled(!checked);
310 cmbFloatingConversion->setEnabled(
m_floatingPoint && (chkCICP->isChecked() && chkCICP->isEnabled()));
311 const QString conversionMode = cmbFloatingConversion->currentData(Qt::UserRole+1).toString();
312 if (cmbFloatingConversion->isEnabled()) {
313 chkForceSRGB->setEnabled(conversionMode ==
"KeepSame");
315 chkForceSRGB->setEnabled(
true);
319#include "kis_png_export.moc"
VertexDescriptor get(PredecessorMap const &m, VertexDescriptor v)
const KoID Float32BitsColorDepthID("F32", ki18n("32-bit float/channel"))
const KoID Float64BitsColorDepthID("F64", ki18n("64-bit float/channel"))
const KoID GrayAColorModelID("GRAYA", ki18n("Grayscale/Alpha"))
const KoID Float16BitsColorDepthID("F16", ki18n("16-bit float/channel"))
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
The KisExifInfoVisitor class looks for a layer with metadata.
KisMetaData::Store * exifInfo()
bool visit(KisNode *) override
static KisExportCheckRegistry * instance()
vKisAnnotationSP_it endAnnotations()
KisGroupLayerSP rootLayer() const
KisPaintDeviceSP projection() const
QRect bounds() const override
vKisAnnotationSP_it beginAnnotations()
The base class for import and export filters.
static const QString ColorDepthIDTag
static const QString ColorModelIDTag
static const QString CICPPrimariesTag
void addSupportedColorModels(QList< QPair< KoID, KoID > > supportedColorModels, const QString &name, KisExportCheckBase::Level level=KisExportCheckBase::PARTIALLY)
static const QString ImageContainsTransparencyTag
static const QString sRGBTag
void addCapability(KisExportCheckBase *capability)
KisImportExportErrorCode buildFile(const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP device, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisPNGOptions options, KisMetaData::Store *metaData)
KisPropertiesConfigurationSP defaultConfiguration(const QByteArray &from="", const QByteArray &to="") const override
defaultConfiguration defines the default settings for the given import export filter
KisConfigWidget * createConfigurationWidget(QWidget *parent, const QByteArray &from="", const QByteArray &to="") const override
createConfigurationWidget creates a widget that can be used to define the settings for a given import...
KisImportExportErrorCode convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration=0) override
void initializeCapabilities() override
KisPNGExport(QObject *parent, const QVariantList &)
KisWdgOptionsPNG(QWidget *parent)
void on_alpha_toggled(bool checked)
KisPropertiesConfigurationSP configuration() const override
void onConversionPolicyChanged()
void setConfiguration(const KisPropertiesConfigurationSP config) override
void fromQColor(const QColor &c)
Convenient function for converting from a QColor.
K_PLUGIN_FACTORY_WITH_JSON(KritaASCCDLFactory, "kritaasccdl.json", registerPlugin< KritaASCCDL >();) KritaASCCDL
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
vKisAnnotationSP::iterator vKisAnnotationSP_it
bool storeExtraColorChunks
ConversionPolicy floatingPointConversion
bool convertFloatToRec2020
QColor transparencyFillColor
static KoColorSpaceRegistry * instance()