[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/pigment/colorprofiles
From:       Emanuele Tamponi <emanuele () valinor ! it>
Date:       2008-02-18 10:44:47
Message-ID: 1203331487.466298.9075.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 776478 by tamponi:

Add two methods:
- displayToChannelDouble
- channelToDisplayDouble


 M  +17 -4     KoHdrColorProfile.cpp  
 M  +5 -2      KoHdrColorProfile.h  


--- trunk/koffice/libs/pigment/colorprofiles/KoHdrColorProfile.cpp #776477:776478
@@ -34,11 +34,11 @@
 KoHdrColorProfile::KoHdrColorProfile(const QString &name, const QString &info) : d(new Private)
 {
     d->iccProfile = 0;
-    
+
     // After adjusting by the exposure, map 1.0 to 3.5 f-stops below 1.0
     // I.e. scale by 1/(2^3.5).
     d->middleGreyScaleFactor = 0.0883883;
-    
+
     setHdrExposure(0.0);
     setName(name);
     setInfo(info);
@@ -118,10 +118,10 @@
 quint16 KoHdrColorProfile::channelToDisplay(double value) const
 {
     value *= d->exposureFactor;
-    
+
     const int minU16 = 0;
     const int maxU16 = 65535;
-    
+
     return (quint16)qBound(minU16, qRound(value), maxU16);
 }
 
@@ -130,4 +130,17 @@
     return value * d->invExposureFactor;
 }
 
+double KoHdrColorProfile::channelToDisplayDouble(double value) const
+{
+    value = value * d->exposureFactor / 0xFFFF;
 
+    const double min = 0;
+    const double max = 1;
+
+    return qBound(min, value, max);
+}
+
+double KoHdrColorProfile::displayToChannelDouble(double value) const
+{
+    return value * 0xFFFF * d->invExposureFactor;
+}
--- trunk/koffice/libs/pigment/colorprofiles/KoHdrColorProfile.h #776477:776478
@@ -48,13 +48,13 @@
          * clone it before.
          */
         void setIccColorProfile(KoIccColorProfile* profile);
-    
+
         virtual KoColorProfile* clone() const;
         virtual bool valid() const;
         virtual bool isSuitableForOutput() const;
         virtual bool isSuitableForPrinting() const;
         virtual bool isSuitableForDisplay() const;
-        
+
         /**
          * @return the current exposure
          */
@@ -69,6 +69,9 @@
     public:
         quint16 channelToDisplay(double value) const;
         double displayToChannel(quint16 value) const;
+
+        double channelToDisplayDouble(double value) const;
+        double displayToChannelDouble(double value) const;
     private:
         struct Private;
         Private* const d;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic