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 }
KisConfigWidget(QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
void toggleQualitySlider(bool toggle)
void toggleExtraHDROptions(int index)

References toggleExtraHDROptions(), and toggleQualitySlider().

Member Function Documentation

◆ configuration()

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

Implements KisConfigWidget.

Definition at line 603 of file HeifExport.cpp.

604{
606 cfg->setProperty("lossless", chkLossless->isChecked());
607 cfg->setProperty("quality", int(sliderQuality->value()));
608 cfg->setProperty("chroma", cmbChroma->currentText());
609 cfg->setProperty("floatingPointConversionOption", cmbConversionPolicy->currentData(Qt::UserRole+1).toString());
610 cfg->setProperty("monochromeToSRGB", chkMonochromesRGB->isChecked());
611 cfg->setProperty("HLGnominalPeak", spnNits->value());
612 cfg->setProperty("HLGgamma", spnGamma->value());
613 cfg->setProperty("removeHGLOOTF", chkHLGOOTF->isChecked());
615 return cfg;
616}
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 531 of file HeifExport.cpp.

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

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

◆ toggleHLGOptions

void KisWdgOptionsHeif::toggleHLGOptions ( bool toggle)
privateslot

Definition at line 624 of file HeifExport.cpp.

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

◆ toggleQualitySlider

void KisWdgOptionsHeif::toggleQualitySlider ( bool toggle)
privateslot

Definition at line 618 of file HeifExport.cpp.

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

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: