File indexing completed on 2024-04-21 15:12:09

0001 /************************************************************************
0002  *                                  *
0003  *  This file is part of Kooka, a scanning/OCR application using    *
0004  *  Qt <http://www.qt.io> and KDE Frameworks <http://www.kde.org>.  *
0005  *                                  *
0006  *  Copyright (C) 2000-2016 Klaas Freitag <freitag@suse.de>     *
0007  *                          Jonathan Marten <jjm@keelhaul.me.uk>    *
0008  *                                  *
0009  *  Kooka is free software; you can redistribute it and/or modify it    *
0010  *  under the terms of the GNU Library General Public License as    *
0011  *  published by the Free Software Foundation and appearing in the  *
0012  *  file COPYING included in the packaging of this file;  either    *
0013  *  version 2 of the License, or (at your option) any later version.    *
0014  *                                  *
0015  *  As a special exception, permission is given to link this program    *
0016  *  with any version of the KADMOS OCR/ICR engine (a product of     *
0017  *  reRecognition GmbH, Kreuzlingen), and distribute the resulting  *
0018  *  executable without including the source code for KADMOS in the  *
0019  *  source distribution.                        *
0020  *                                  *
0021  *  This program is distributed in the hope that it will be useful, *
0022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  *
0023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
0024  *  GNU General Public License for more details.            *
0025  *                                  *
0026  *  You should have received a copy of the GNU General Public       *
0027  *  License along with this program;  see the file COPYING.  If     *
0028  *  not, see <http://www.gnu.org/licenses/>.                *
0029  *                                  *
0030  ************************************************************************/
0031 
0032 #ifndef GAMMADIALOG_H
0033 #define GAMMADIALOG_H
0034 
0035 #include "kookascan_export.h"
0036 
0037 #include "dialogbase.h"
0038 
0039 class KScanSlider;
0040 class KGammaTable;
0041 class GammaWidget;
0042 
0043 
0044 /**
0045  * @short A dialogue to allow editing of a gamma table.
0046  *
0047  * The dialogue has three combination slider/spinboxes to set the
0048  * brightness, contrast and gamma of the table.  A preview of the table
0049  * is displayed to the right (in a @c GammaWidget).
0050  *
0051  * @author Klaas Freitag
0052  * @author Jonathan Marten
0053  **/
0054 
0055 class KOOKASCAN_EXPORT GammaDialog : public DialogBase
0056 {
0057     Q_OBJECT
0058 
0059 public:
0060     /**
0061      * Constructor.
0062      *
0063      * @param table Gamma table to take initial values from
0064      * @param parent Parent widget
0065      **/
0066     explicit GammaDialog(const KGammaTable *table, QWidget *parent = nullptr);
0067 
0068     /**
0069      * Destructor.
0070      **/
0071     virtual ~GammaDialog()          {}
0072 
0073     /**
0074      * Get the internal gamma table.
0075      *
0076      * This is a deep copy of the table that was originally specified to
0077      * the constructor.
0078      *
0079      * @return The gamma table
0080      **/
0081     const KGammaTable *gammaTable() const   { return (mTable); }
0082 
0083 protected slots:
0084     /**
0085      * Apply the currently set values via the @c gammaToApply() signal.
0086      **/
0087     void slotApply();
0088 
0089     /**
0090      * Reset the gamma values to the default of a linear transfer function.
0091      **/
0092     void slotReset();
0093 
0094 signals:
0095     /**
0096      * Emitted when the gamma table has been changed and one of the "OK" or
0097      * "Apply" buttons is clicked.
0098      *
0099      * @param table The new gamma table
0100      **/
0101     void gammaToApply(const KGammaTable *table);
0102 
0103 private:
0104     KGammaTable *mTable;
0105     GammaWidget *mGtDisplay;
0106 
0107     KScanSlider *mSetBright;
0108     KScanSlider *mSetContrast;
0109     KScanSlider *mSetGamma;
0110 };
0111 
0112 #endif