1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * gimplevelsconfig.h
5  * Copyright (C) 2007 Michael Natterer <mitch@gimp.org>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __GIMP_LEVELS_CONFIG_H__
22 #define __GIMP_LEVELS_CONFIG_H__
23 
24 
25 #include "gimpoperationsettings.h"
26 
27 
28 #define GIMP_TYPE_LEVELS_CONFIG            (gimp_levels_config_get_type ())
29 #define GIMP_LEVELS_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfig))
30 #define GIMP_LEVELS_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfigClass))
31 #define GIMP_IS_LEVELS_CONFIG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LEVELS_CONFIG))
32 #define GIMP_IS_LEVELS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GIMP_TYPE_LEVELS_CONFIG))
33 #define GIMP_LEVELS_CONFIG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfigClass))
34 
35 
36 typedef struct _GimpLevelsConfigClass GimpLevelsConfigClass;
37 
38 struct _GimpLevelsConfig
39 {
40   GimpOperationSettings  parent_instance;
41 
42   gboolean               linear;
43 
44   GimpHistogramChannel   channel;
45 
46   gdouble                low_input[5];
47   gdouble                high_input[5];
48 
49   gboolean               clamp_input;
50 
51   gdouble                gamma[5];
52 
53   gdouble                low_output[5];
54   gdouble                high_output[5];
55 
56   gboolean               clamp_output;
57 };
58 
59 struct _GimpLevelsConfigClass
60 {
61   GimpOperationSettingsClass  parent_class;
62 };
63 
64 
65 GType      gimp_levels_config_get_type         (void) G_GNUC_CONST;
66 
67 void       gimp_levels_config_reset_channel    (GimpLevelsConfig      *config);
68 
69 void       gimp_levels_config_stretch          (GimpLevelsConfig      *config,
70                                                 GimpHistogram         *histogram,
71                                                 gboolean               is_color);
72 void       gimp_levels_config_stretch_channel  (GimpLevelsConfig      *config,
73                                                 GimpHistogram         *histogram,
74                                                 GimpHistogramChannel   channel);
75 void       gimp_levels_config_adjust_by_colors (GimpLevelsConfig      *config,
76                                                 GimpHistogramChannel   channel,
77                                                 const GimpRGB         *black,
78                                                 const GimpRGB         *gray,
79                                                 const GimpRGB         *white);
80 
81 GimpCurvesConfig *
82            gimp_levels_config_to_curves_config (GimpLevelsConfig      *config);
83 
84 gboolean   gimp_levels_config_load_cruft       (GimpLevelsConfig      *config,
85                                                 GInputStream          *input,
86                                                 GError               **error);
87 gboolean   gimp_levels_config_save_cruft       (GimpLevelsConfig      *config,
88                                                 GOutputStream         *output,
89                                                 GError               **error);
90 
91 
92 #endif /* __GIMP_LEVELS_CONFIG_H__ */
93