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

References toggleQualitySlider().

Member Function Documentation

◆ configuration()

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

Implements KisConfigWidget.

Definition at line 596 of file HeifExport.cpp.

597{
599 cfg->setProperty("lossless", chkLossless->isChecked());
600 cfg->setProperty("quality", int(sliderQuality->value()));
601 cfg->setProperty("chroma", cmbChroma->currentText());
602 cfg->setProperty("floatingPointConversionOption", cmbConversionPolicy->currentData(Qt::UserRole+1).toString());
603 cfg->setProperty("monochromeToSRGB", chkMonochromesRGB->isChecked());
605 return cfg;
606}
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 527 of file HeifExport.cpp.

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

◆ toggleQualitySlider

void KisWdgOptionsHeif::toggleQualitySlider ( bool toggle)
privateslot

Definition at line 608 of file HeifExport.cpp.

609{
610 // Disable the quality slider if lossless is true
611 lossySettings->setEnabled(!toggle);
612}

Member Data Documentation

◆ m_hasAlpha

bool KisWdgOptionsHeif::m_hasAlpha {false}
private

Definition at line 42 of file HeifExport.h.

42{false};

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