Krita Source Code Documentation
Loading...
Searching...
No Matches
KisWdgOptionsHeif Class Reference

#include <HeifExport.h>

+ Inheritance diagram for KisWdgOptionsHeif:

Public Member Functions

KisPropertiesConfigurationSP configuration () const override
 
 KisWdgOptionsHeif (QWidget *parent)
 
void setConfiguration (const KisPropertiesConfigurationSP cfg) override
 
- Public Member Functions inherited from KisConfigWidget
virtual KoCanvasResourcesInterfaceSP canvasResourcesInterface () const
 
virtual void setCanvasResourcesInterface (KoCanvasResourcesInterfaceSP canvasResourcesInterface)
 
virtual void setView (KisViewManager *view)
 
 ~KisConfigWidget () override
 

Private Slots

void toggleExtraHDROptions (int index)
 
void toggleHLGOptions (bool toggle)
 
void toggleQualitySlider (bool toggle)
 

Private Attributes

bool m_hasAlpha {false}
 

Additional Inherited Members

- Signals inherited from KisConfigWidget
void sigConfigurationItemChanged ()
 
void sigConfigurationUpdated ()
 
void sigDropLockedConfig (KisPropertiesConfigurationSP p)
 
void sigSaveLockedConfig (KisPropertiesConfigurationSP p)
 
- Protected Member Functions inherited from KisConfigWidget
 KisConfigWidget (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
 

Detailed Description

Definition at line 21 of file HeifExport.h.

Constructor & Destructor Documentation

◆ KisWdgOptionsHeif()

KisWdgOptionsHeif::KisWdgOptionsHeif ( QWidget * parent)
inline

Definition at line 26 of file HeifExport.h.

27 : KisConfigWidget(parent)
28 {
29 setupUi(this);
30 connect(chkLossless, SIGNAL(toggled(bool)), SLOT(toggleQualitySlider(bool)));
31 connect(chkHLGOOTF, SIGNAL(toggled(bool)), SLOT(toggleQualitySlider(bool)));
32 connect(cmbConversionPolicy, SIGNAL(currentIndexChanged(int)), SLOT(toggleExtraHDROptions(int)));
33 sliderQuality->setRange(0, 100, 0);
34 }
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisConfigWidget(QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
void toggleQualitySlider(bool toggle)
void toggleExtraHDROptions(int index)

References connect(), toggleExtraHDROptions(), and toggleQualitySlider().

Member Function Documentation

◆ configuration()

KisPropertiesConfigurationSP KisWdgOptionsHeif::configuration ( ) const
overridevirtual
Returns
the configuration

Implements KisConfigWidget.

Definition at line 602 of file HeifExport.cpp.

603{
605 cfg->setProperty("lossless", chkLossless->isChecked());
606 cfg->setProperty("quality", int(sliderQuality->value()));
607 cfg->setProperty("chroma", cmbChroma->currentText());
608 cfg->setProperty("floatingPointConversionOption", cmbConversionPolicy->currentData(Qt::UserRole+1).toString());
609 cfg->setProperty("monochromeToSRGB", chkMonochromesRGB->isChecked());
610 cfg->setProperty("HLGnominalPeak", spnNits->value());
611 cfg->setProperty("HLGgamma", spnGamma->value());
612 cfg->setProperty("removeHGLOOTF", chkHLGOOTF->isChecked());
614 return cfg;
615}
static const QString ImageContainsTransparencyTag

References KisImportExportFilter::ImageContainsTransparencyTag, and m_hasAlpha.

◆ setConfiguration()

void KisWdgOptionsHeif::setConfiguration ( const KisPropertiesConfigurationSP config)
overridevirtual
Parameters
configthe configuration for this configuration widget.

Implements KisConfigWidget.

Definition at line 530 of file HeifExport.cpp.

531{
532 // the export manager should have prepared some info for us!
535
536 QStringList chromaOptions;
537 chromaOptions << "420" << "422" << "444";
538 cmbChroma->addItems(chromaOptions);
539 cmbChroma->setItemData(0, i18nc("@tooltip", "The brightness of the image will be at full resolution, while the colorfulness will be halved in both dimensions."), Qt::ToolTipRole);
540 cmbChroma->setItemData(1, i18nc("@tooltip", "The brightness of the image will be at full resolution, while the colorfulness will be halved horizontally."), Qt::ToolTipRole);
541 cmbChroma->setItemData(2, i18nc("@tooltip", "Both brightness and colorfulness of the image will be at full resolution."), Qt::ToolTipRole);
542 chkLossless->setChecked(cfg->getBool("lossless", true));
543 sliderQuality->setValue(qreal(cfg->getInt("quality", 50)));
544 cmbChroma->setCurrentIndex(chromaOptions.indexOf(cfg->getString("chroma", "444")));
546
547 int cicpPrimaries = cfg->getInt(KisImportExportFilter::CICPPrimariesTag,
548 static_cast<int>(PRIMARIES_UNSPECIFIED));
549
550 // Rav1e doesn't support monochrome. To get around this, people may need to convert to sRGB first.
551 chkMonochromesRGB->setVisible(cfg->getString(KisImportExportFilter::ColorModelIDTag) == "GRAYA");
552
553 conversionSettings->setVisible(cfg->getBool(KisImportExportFilter::HDRTag, false));
554
555 QStringList conversionOptionsList = { i18nc("Color space name", "Rec 2100 PQ"), i18nc("Color space name", "Rec 2100 HLG")};
556 QStringList toolTipList = {i18nc("@tooltip", "The image will be converted to Rec 2020 linear first, and then encoded with a perceptual quantizer curve"
557 " (also known as SMPTE 2048 curve). Recommended for HDR images where the absolute brightness is important."),
558 i18nc("@tooltip", "The image will be converted to Rec 2020 linear first, and then encoded with a Hybrid Log Gamma curve."
559 " Recommended for HDR images where the display may not understand HDR.")};
560 QStringList conversionOptionName = {"Rec2100PQ", "Rec2100HLG"};
561
562 if (cfg->getString(KisImportExportFilter::ColorModelIDTag) == "RGBA") {
563 if (cicpPrimaries != PRIMARIES_UNSPECIFIED) {
564 conversionOptionsList << i18nc("Color space option plus transfer function name", "Keep colorants, encode PQ");
565 toolTipList << i18nc("@tooltip", "The image will be linearized first, and then encoded with a perceptual quantizer curve"
566 " (also known as the SMPTE 2048 curve). Recommended for images where the absolute brightness is important.");
567 conversionOptionName << "ApplyPQ";
568
569 conversionOptionsList << i18nc("Color space option plus transfer function name", "Keep colorants, encode HLG");
570 toolTipList << i18nc("@tooltip", "The image will be linearized first, and then encoded with a Hybrid Log Gamma curve."
571 " Recommended for images intended for screens which cannot understand PQ");
572 conversionOptionName << "ApplyHLG";
573
574 conversionOptionsList << i18nc("Color space option plus transfer function name", "Keep colorants, encode SMPTE ST 428");
575 toolTipList << i18nc("@tooltip", "The image will be linearized first, and then encoded with SMPTE ST 428."
576 " Krita always opens images like these as linear floating point, this option is there to reverse that");
577 conversionOptionName << "ApplySMPTE428";
578 }
579
580 conversionOptionsList << i18nc("Color space option", "No changes, clip");
581 toolTipList << i18nc("@tooltip", "The image will be converted plainly to 12bit integer, and values that are out of bounds are clipped, the icc profile will be embedded.");
582 conversionOptionName << "KeepSame";
583 }
584 cmbConversionPolicy->addItems(conversionOptionsList);
585 for (int i=0; i< toolTipList.size(); i++) {
586 cmbConversionPolicy->setItemData(i, toolTipList.at(i), Qt::ToolTipRole);
587 cmbConversionPolicy->setItemData(i, conversionOptionName.at(i), Qt::UserRole+1);
588 }
589 QString optionName =
590 cfg->getString("floatingPointConversionOption", "KeepSame");
591 if (conversionOptionName.contains(optionName)) {
592 cmbConversionPolicy->setCurrentIndex(
593 conversionOptionName.indexOf(optionName));
594 }
595 chkHLGOOTF->setChecked(cfg->getBool("removeHGLOOTF", true));
596 spnNits->setValue(cfg->getDouble("HLGnominalPeak", 1000.0));
597 spnGamma->setValue(cfg->getDouble("HLGgamma", 1.2));
598
599 lossySettings->setEnabled(!chkLossless->isChecked());
600}
@ PRIMARIES_UNSPECIFIED
static const QString ColorModelIDTag
static const QString CICPPrimariesTag
static const QString HDRTag
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130

References KisImportExportFilter::CICPPrimariesTag, KisImportExportFilter::ColorModelIDTag, KisImportExportFilter::HDRTag, KisImportExportFilter::ImageContainsTransparencyTag, KIS_SAFE_ASSERT_RECOVER_NOOP, m_hasAlpha, and PRIMARIES_UNSPECIFIED.

◆ toggleExtraHDROptions

void KisWdgOptionsHeif::toggleExtraHDROptions ( int index)
privateslot

Definition at line 629 of file HeifExport.cpp.

629 {
630 Q_UNUSED(index)
631 bool toggle = cmbConversionPolicy->currentData(Qt::UserRole+1).toString().contains("HLG");
632 chkHLGOOTF->setEnabled(toggle);
633 spnNits->setEnabled(toggle);
634 spnGamma->setEnabled(toggle);
635}

◆ toggleHLGOptions

void KisWdgOptionsHeif::toggleHLGOptions ( bool toggle)
privateslot

Definition at line 623 of file HeifExport.cpp.

624{
625 spnNits->setEnabled(toggle);
626 spnGamma->setEnabled(toggle);
627}

◆ toggleQualitySlider

void KisWdgOptionsHeif::toggleQualitySlider ( bool toggle)
privateslot

Definition at line 617 of file HeifExport.cpp.

618{
619 // Disable the quality slider if lossless is true
620 lossySettings->setEnabled(!toggle);
621}

Member Data Documentation

◆ m_hasAlpha

bool KisWdgOptionsHeif::m_hasAlpha {false}
private

Definition at line 48 of file HeifExport.h.

48{false};

The documentation for this class was generated from the following files: