1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2012-02-05 7 * Description : film color negative inverter filter 8 * 9 * Copyright (C) 2012 by Matthias Welwarsky <matthias at welwarsky dot de> 10 * 11 * This program is free software; you can redistribute it 12 * and/or modify it under the terms of the GNU General 13 * Public License as published by the Free Software Foundation; 14 * either version 2, or (at your option) 15 * any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 #ifndef DIGIKAM_FILM_FILTER_PRIVATE_H 25 #define DIGIKAM_FILM_FILTER_PRIVATE_H 26 27 #include "filmfilter.h" 28 29 namespace Digikam 30 { 31 32 class DColor; 33 34 class Q_DECL_HIDDEN FilmProfile 35 { 36 public: 37 38 explicit FilmProfile(double rdm = 0.0, double gdm = 0.0, double bdm = 0.0) redDmax(rdm)39 : redDmax (rdm), 40 greenDmax(gdm), 41 blueDmax (bdm), 42 rBalance (1.0), 43 gBalance (1.0), 44 bBalance (1.0), 45 wpRed (1.0), 46 wpGreen (1.0), 47 wpBlue (1.0) 48 { 49 } 50 dmax(int channel)51 double dmax(int channel) const 52 { 53 switch (channel) 54 { 55 case RedChannel: 56 return redDmax; 57 58 case GreenChannel: 59 return greenDmax; 60 61 case BlueChannel: 62 return blueDmax; 63 64 default: 65 return 0.0; 66 } 67 } 68 setBalance(double rB,double gB,double bB)69 FilmProfile& setBalance(double rB, double gB, double bB) 70 { 71 rBalance = rB; 72 gBalance = gB; 73 bBalance = bB; 74 75 return *this; 76 } 77 balance(int channel)78 double balance(int channel) const 79 { 80 switch (channel) 81 { 82 case RedChannel: 83 return rBalance; 84 85 case GreenChannel: 86 return gBalance; 87 88 case BlueChannel: 89 return bBalance; 90 91 default: 92 return 1.0; 93 } 94 } 95 setWp(double rWp,double gWp,double bWp)96 FilmProfile& setWp(double rWp, double gWp, double bWp) 97 { 98 wpRed = rWp; 99 wpGreen = gWp; 100 wpBlue = bWp; 101 102 return *this; 103 } 104 wp(int channel)105 double wp(int channel) const 106 { 107 switch (channel) 108 { 109 case RedChannel: 110 return wpRed; 111 112 case GreenChannel: 113 return wpGreen; 114 115 case BlueChannel: 116 return wpBlue; 117 118 default: 119 return 1.0; 120 } 121 } 122 123 private: 124 125 double redDmax; 126 double greenDmax; 127 double blueDmax; 128 129 double rBalance; 130 double gBalance; 131 double bBalance; 132 133 double wpRed; 134 double wpGreen; 135 double wpBlue; 136 }; 137 138 // -------------------------------------------------------------------------------------------------------- 139 140 class Q_DECL_HIDDEN FilmContainer::Private 141 { 142 public: 143 Private()144 explicit Private() 145 : gamma (1.0), 146 exposure (1.0), 147 sixteenBit (false), 148 profile (FilmProfile(1.0, 1.0, 1.0)), 149 cnType (CNNeutral), 150 whitePoint (DColor(QColor("white"), false)), 151 applyBalance(true) 152 { 153 } 154 ~Private()155 ~Private() 156 { 157 } 158 159 double gamma; 160 double exposure; 161 bool sixteenBit; 162 FilmProfile profile; 163 CNFilmProfile cnType; 164 DColor whitePoint; 165 bool applyBalance; 166 }; 167 168 // ------------------------------------------------------------------ 169 170 class Q_DECL_HIDDEN FilmFilter::Private 171 { 172 public: 173 Private()174 explicit Private() 175 { 176 } 177 ~Private()178 ~Private() 179 { 180 } 181 182 FilmContainer film; 183 }; 184 185 } // namespace Digikam 186 187 #endif // DIGIKAM_FILM_FILTER_PRIVATE_H 188