QGIS API Documentation 4.1.0-Master (ca2ac17535b)
Loading...
Searching...
No Matches
qgscolorgradingsettings.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgscolorgradingsettings.cpp
3 --------------------------------------
4 Date : May 2026
5 Copyright : (C) 2026 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
18#include "qgsreadwritecontext.h"
19
20#include <QDomDocument>
21#include <QString>
22
23using namespace Qt::StringLiterals;
24
26 : mExposureAdjustment( other.mExposureAdjustment )
27 , mToneMapping( other.mToneMapping )
28{}
29
31{
32 if ( &rhs == this )
33 return *this;
34
35 mExposureAdjustment = rhs.mExposureAdjustment;
36 mToneMapping = rhs.mToneMapping;
37 return *this;
38}
39
40void QgsColorGradingSettings::readXml( const QDomElement &element, const QgsReadWriteContext & )
41{
42 mExposureAdjustment = element.attribute( u"exposure"_s, u"0.0"_s ).toDouble();
43 mToneMapping = qgsEnumKeyToValue( element.attribute( u"tone-mapping"_s ), Qgis::ToneMappingMethod::Clamp );
44}
45
46void QgsColorGradingSettings::writeXml( QDomElement &element, const QgsReadWriteContext & ) const
47{
48 element.setAttribute( u"exposure"_s, mExposureAdjustment );
49 element.setAttribute( u"tone-mapping"_s, qgsEnumValueToKey( mToneMapping ) );
50}
@ Clamp
Clamp HDR colors to SDR color ranges, leave SDR colors unchanged. This is computationally cheap and e...
Definition qgis.h:4484
QgsColorGradingSettings()=default
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from a DOM element.
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to a DOM element.
QgsColorGradingSettings & operator=(QgsColorGradingSettings const &rhs)
A container for the context for various read/write operations on objects.
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
Definition qgis.h:7437
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition qgis.h:7418