1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * gimphistogram module Copyright (C) 1999 Jay Cox <jaycox@gimp.org>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __GIMP_HISTOGRAM_H__
21 #define __GIMP_HISTOGRAM_H__
22 
23 
24 #include "gimpobject.h"
25 
26 
27 #define GIMP_TYPE_HISTOGRAM            (gimp_histogram_get_type ())
28 #define GIMP_HISTOGRAM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_HISTOGRAM, GimpHistogram))
29 #define GIMP_HISTOGRAM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_HISTOGRAM, GimpHistogramClass))
30 #define GIMP_IS_HISTOGRAM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_HISTOGRAM))
31 #define GIMP_IS_HISTOGRAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_HISTOGRAM))
32 #define GIMP_HISTOGRAM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_HISTOGRAM, GimpHistogramClass))
33 
34 
35 typedef struct _GimpHistogramPrivate GimpHistogramPrivate;
36 typedef struct _GimpHistogramClass   GimpHistogramClass;
37 
38 struct _GimpHistogram
39 {
40   GimpObject            parent_instance;
41 
42   GimpHistogramPrivate *priv;
43 };
44 
45 struct _GimpHistogramClass
46 {
47   GimpObjectClass  parent_class;
48 };
49 
50 
51 GType           gimp_histogram_get_type        (void) G_GNUC_CONST;
52 
53 GimpHistogram * gimp_histogram_new             (gboolean              linear);
54 
55 GimpHistogram * gimp_histogram_duplicate       (GimpHistogram        *histogram);
56 
57 void            gimp_histogram_calculate       (GimpHistogram        *histogram,
58                                                 GeglBuffer           *buffer,
59                                                 const GeglRectangle  *buffer_rect,
60                                                 GeglBuffer           *mask,
61                                                 const GeglRectangle  *mask_rect);
62 GimpAsync     * gimp_histogram_calculate_async (GimpHistogram        *histogram,
63                                                 GeglBuffer           *buffer,
64                                                 const GeglRectangle  *buffer_rect,
65                                                 GeglBuffer           *mask,
66                                                 const GeglRectangle  *mask_rect);
67 
68 void            gimp_histogram_clear_values    (GimpHistogram        *histogram,
69                                                 gint                  n_components);
70 
71 gdouble         gimp_histogram_get_maximum     (GimpHistogram        *histogram,
72                                                 GimpHistogramChannel  channel);
73 gdouble         gimp_histogram_get_count       (GimpHistogram        *histogram,
74                                                 GimpHistogramChannel  channel,
75                                                 gint                  start,
76                                                 gint                  end);
77 gdouble         gimp_histogram_get_mean        (GimpHistogram        *histogram,
78                                                 GimpHistogramChannel  channel,
79                                                 gint                  start,
80                                                 gint                  end);
81 gdouble         gimp_histogram_get_median      (GimpHistogram        *histogram,
82                                                 GimpHistogramChannel  channel,
83                                                 gint                  start,
84                                                 gint                  end);
85 gdouble         gimp_histogram_get_std_dev     (GimpHistogram        *histogram,
86                                                 GimpHistogramChannel  channel,
87                                                 gint                  start,
88                                                 gint                  end);
89 gdouble         gimp_histogram_get_threshold   (GimpHistogram        *histogram,
90                                                 GimpHistogramChannel  channel,
91                                                 gint                  start,
92                                                 gint                  end);
93 gdouble         gimp_histogram_get_value       (GimpHistogram        *histogram,
94                                                 GimpHistogramChannel  channel,
95                                                 gint                  bin);
96 gdouble         gimp_histogram_get_component   (GimpHistogram        *histogram,
97                                                 gint                  component,
98                                                 gint                  bin);
99 gint            gimp_histogram_n_components    (GimpHistogram        *histogram);
100 gint            gimp_histogram_n_bins          (GimpHistogram        *histogram);
101 gboolean        gimp_histogram_has_channel     (GimpHistogram        *histogram,
102                                                 GimpHistogramChannel  channel);
103 
104 
105 #endif /* __GIMP_HISTOGRAM_H__ */
106