1 /************************************************************************ 2 * * 3 * This file is part of Kooka, a scanning/OCR application using * 4 * Qt <http://www.qt.io> and KDE Frameworks <http://www.kde.org>. * 5 * * 6 * Copyright (C) 2000-2016 Klaas Freitag <freitag@suse.de> * 7 * Jonathan Marten <jjm@keelhaul.me.uk> * 8 * * 9 * Kooka is free software; you can redistribute it and/or modify it * 10 * under the terms of the GNU Library General Public License as * 11 * published by the Free Software Foundation and appearing in the * 12 * file COPYING included in the packaging of this file; either * 13 * version 2 of the License, or (at your option) any later version. * 14 * * 15 * As a special exception, permission is given to link this program * 16 * with any version of the KADMOS OCR/ICR engine (a product of * 17 * reRecognition GmbH, Kreuzlingen), and distribute the resulting * 18 * executable without including the source code for KADMOS in the * 19 * source distribution. * 20 * * 21 * This program is distributed in the hope that it will be useful, * 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 24 * GNU General Public License for more details. * 25 * * 26 * You should have received a copy of the GNU General Public * 27 * License along with this program; see the file COPYING. If * 28 * not, see <http://www.gnu.org/licenses/>. * 29 * * 30 ************************************************************************/ 31 32 #ifndef GAMMADIALOG_H 33 #define GAMMADIALOG_H 34 35 #include "kookascan_export.h" 36 37 #include "dialogbase.h" 38 39 class KScanSlider; 40 class KGammaTable; 41 class GammaWidget; 42 43 44 /** 45 * @short A dialogue to allow editing of a gamma table. 46 * 47 * The dialogue has three combination slider/spinboxes to set the 48 * brightness, contrast and gamma of the table. A preview of the table 49 * is displayed to the right (in a @c GammaWidget). 50 * 51 * @author Klaas Freitag 52 * @author Jonathan Marten 53 **/ 54 55 class KOOKASCAN_EXPORT GammaDialog : public DialogBase 56 { 57 Q_OBJECT 58 59 public: 60 /** 61 * Constructor. 62 * 63 * @param table Gamma table to take initial values from 64 * @param parent Parent widget 65 **/ 66 explicit GammaDialog(const KGammaTable *table, QWidget *parent = nullptr); 67 68 /** 69 * Destructor. 70 **/ ~GammaDialog()71 virtual ~GammaDialog() {} 72 73 /** 74 * Get the internal gamma table. 75 * 76 * This is a deep copy of the table that was originally specified to 77 * the constructor. 78 * 79 * @return The gamma table 80 **/ gammaTable()81 const KGammaTable *gammaTable() const { return (mTable); } 82 83 protected slots: 84 /** 85 * Apply the currently set values via the @c gammaToApply() signal. 86 **/ 87 void slotApply(); 88 89 /** 90 * Reset the gamma values to the default of a linear transfer function. 91 **/ 92 void slotReset(); 93 94 signals: 95 /** 96 * Emitted when the gamma table has been changed and one of the "OK" or 97 * "Apply" buttons is clicked. 98 * 99 * @param table The new gamma table 100 **/ 101 void gammaToApply(const KGammaTable *table); 102 103 private: 104 KGammaTable *mTable; 105 GammaWidget *mGtDisplay; 106 107 KScanSlider *mSetBright; 108 KScanSlider *mSetContrast; 109 KScanSlider *mSetGamma; 110 }; 111 112 #endif 113