~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to libgimpcolor/gimprgb.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
/* For information look into the C source or the html documentation */
26
26
 
27
27
 
 
28
/*
 
29
 * GIMP_TYPE_RGB
 
30
 */
 
31
 
28
32
#define GIMP_TYPE_RGB               (gimp_rgb_get_type ())
29
33
#define GIMP_VALUE_HOLDS_RGB(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_RGB))
30
34
 
31
35
GType   gimp_rgb_get_type           (void) G_GNUC_CONST;
32
36
 
 
37
void    gimp_value_get_rgb          (const GValue  *value,
 
38
                                     GimpRGB       *rgb);
 
39
void    gimp_value_set_rgb          (GValue        *value,
 
40
                                     const GimpRGB *rgb);
 
41
 
 
42
 
 
43
/*
 
44
 * GIMP_TYPE_PARAM_RGB
 
45
 */
 
46
 
 
47
#define GIMP_TYPE_PARAM_RGB           (gimp_param_rgb_get_type ())
 
48
#define GIMP_IS_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_RGB))
 
49
 
 
50
 
 
51
GType        gimp_param_rgb_get_type       (void) G_GNUC_CONST;
 
52
 
 
53
GParamSpec * gimp_param_spec_rgb           (const gchar    *name,
 
54
                                            const gchar    *nick,
 
55
                                            const gchar    *blurb,
 
56
                                            gboolean        has_alpha,
 
57
                                            const GimpRGB  *default_value,
 
58
                                            GParamFlags     flags);
 
59
 
 
60
gboolean     gimp_param_spec_rgb_has_alpha (GParamSpec     *pspec);
 
61
 
33
62
 
34
63
/*  RGB and RGBA color types and operations taken from LibGCK  */
35
64
 
41
70
} GimpRGBCompositeMode;
42
71
 
43
72
 
44
 
void      gimp_rgb_set         (GimpRGB       *rgb,
45
 
                                gdouble        red,
46
 
                                gdouble        green,
47
 
                                gdouble        blue);
48
 
void      gimp_rgb_set_alpha   (GimpRGB       *rgb,
49
 
                                gdouble        alpha);
50
 
 
51
 
void      gimp_rgb_set_uchar   (GimpRGB       *rgb,
52
 
                                guchar         red,
53
 
                                guchar         green,
54
 
                                guchar         blue);
55
 
void      gimp_rgb_get_uchar   (const GimpRGB *rgb,
56
 
                                guchar        *red,
57
 
                                guchar        *green,
58
 
                                guchar        *blue);
59
 
 
60
 
gboolean  gimp_rgb_parse_name  (GimpRGB       *rgb,
61
 
                                const gchar   *name,
62
 
                                gint           len);
63
 
gboolean  gimp_rgb_parse_hex   (GimpRGB       *rgb,
64
 
                                const gchar   *hex,
65
 
                                gint           len);
66
 
gboolean  gimp_rgb_parse_css   (GimpRGB       *rgb,
67
 
                                const gchar   *css,
68
 
                                gint           len);
69
 
 
70
 
void      gimp_rgb_add         (GimpRGB       *rgb1,
71
 
                                const GimpRGB *rgb2);
72
 
void      gimp_rgb_subtract    (GimpRGB       *rgb1,
73
 
                                const GimpRGB *rgb2);
74
 
void      gimp_rgb_multiply    (GimpRGB       *rgb1,
75
 
                                gdouble        factor);
76
 
gdouble   gimp_rgb_distance    (const GimpRGB *rgb1,
77
 
                                const GimpRGB *rgb2);
78
 
 
79
 
gdouble   gimp_rgb_max         (const GimpRGB *rgb);
80
 
gdouble   gimp_rgb_min         (const GimpRGB *rgb);
81
 
void      gimp_rgb_clamp       (GimpRGB       *rgb);
82
 
 
83
 
void      gimp_rgb_gamma       (GimpRGB       *rgb,
84
 
                                gdouble        gamma);
85
 
 
86
 
gdouble   gimp_rgb_intensity        (const GimpRGB *rgb);
87
 
guchar    gimp_rgb_intensity_uchar  (const GimpRGB *rgb);
88
 
 
89
 
void      gimp_rgb_composite   (GimpRGB              *color1,
90
 
                                const GimpRGB        *color2,
91
 
                                GimpRGBCompositeMode  mode);
 
73
void      gimp_rgb_set             (GimpRGB       *rgb,
 
74
                                    gdouble        red,
 
75
                                    gdouble        green,
 
76
                                    gdouble        blue);
 
77
void      gimp_rgb_set_alpha       (GimpRGB       *rgb,
 
78
                                    gdouble        alpha);
 
79
 
 
80
void      gimp_rgb_set_uchar       (GimpRGB       *rgb,
 
81
                                    guchar         red,
 
82
                                    guchar         green,
 
83
                                    guchar         blue);
 
84
void      gimp_rgb_get_uchar       (const GimpRGB *rgb,
 
85
                                    guchar        *red,
 
86
                                    guchar        *green,
 
87
                                    guchar        *blue);
 
88
 
 
89
gboolean  gimp_rgb_parse_name      (GimpRGB       *rgb,
 
90
                                    const gchar   *name,
 
91
                                    gint           len);
 
92
gboolean  gimp_rgb_parse_hex       (GimpRGB       *rgb,
 
93
                                    const gchar   *hex,
 
94
                                    gint           len);
 
95
gboolean  gimp_rgb_parse_css       (GimpRGB       *rgb,
 
96
                                    const gchar   *css,
 
97
                                    gint           len);
 
98
 
 
99
void      gimp_rgb_add             (GimpRGB       *rgb1,
 
100
                                    const GimpRGB *rgb2);
 
101
void      gimp_rgb_subtract        (GimpRGB       *rgb1,
 
102
                                    const GimpRGB *rgb2);
 
103
void      gimp_rgb_multiply        (GimpRGB       *rgb1,
 
104
                                    gdouble        factor);
 
105
gdouble   gimp_rgb_distance        (const GimpRGB *rgb1,
 
106
                                    const GimpRGB *rgb2);
 
107
 
 
108
gdouble   gimp_rgb_max             (const GimpRGB *rgb);
 
109
gdouble   gimp_rgb_min             (const GimpRGB *rgb);
 
110
void      gimp_rgb_clamp           (GimpRGB       *rgb);
 
111
 
 
112
void      gimp_rgb_gamma           (GimpRGB       *rgb,
 
113
                                    gdouble        gamma);
 
114
 
 
115
gdouble   gimp_rgb_luminance       (const GimpRGB *rgb);
 
116
guchar    gimp_rgb_luminance_uchar (const GimpRGB *rgb);
 
117
 
 
118
#ifndef GIMP_DISABLE_DEPRECATED
 
119
gdouble   gimp_rgb_intensity       (const GimpRGB *rgb);
 
120
guchar    gimp_rgb_intensity_uchar (const GimpRGB *rgb);
 
121
#endif
 
122
 
 
123
void      gimp_rgb_composite       (GimpRGB              *color1,
 
124
                                    const GimpRGB        *color2,
 
125
                                    GimpRGBCompositeMode  mode);
92
126
 
93
127
/*  access to the list of color names  */
94
 
gint      gimp_rgb_list_names  (const gchar ***names,
95
 
                                GimpRGB      **colors);
96
 
 
97
 
 
98
 
void      gimp_rgba_set        (GimpRGB       *rgba,
99
 
                                gdouble        red,
100
 
                                gdouble        green,
101
 
                                gdouble        blue,
102
 
                                gdouble        alpha);
103
 
 
104
 
void      gimp_rgba_set_uchar  (GimpRGB       *rgba,
105
 
                                guchar         red,
106
 
                                guchar         green,
107
 
                                guchar         blue,
108
 
                                 guchar         alpha);
109
 
void      gimp_rgba_get_uchar  (const GimpRGB *rgba,
110
 
                                guchar        *red,
111
 
                                guchar        *green,
112
 
                                guchar        *blue,
113
 
                                guchar        *alpha);
114
 
 
115
 
gboolean  gimp_rgba_parse_css  (GimpRGB       *rgba,
116
 
                                const gchar   *css,
117
 
                                gint           len);
118
 
 
119
 
void      gimp_rgba_add        (GimpRGB       *rgba1,
120
 
                                const GimpRGB *rgba2);
121
 
void      gimp_rgba_subtract   (GimpRGB       *rgba1,
122
 
                                const GimpRGB *rgba2);
123
 
void      gimp_rgba_multiply   (GimpRGB       *rgba,
124
 
                                gdouble        factor);
125
 
 
126
 
gdouble   gimp_rgba_distance   (const GimpRGB *rgba1,
127
 
                                const GimpRGB *rgba2);
 
128
gint      gimp_rgb_list_names      (const gchar ***names,
 
129
                                    GimpRGB      **colors);
 
130
 
 
131
 
 
132
void      gimp_rgba_set            (GimpRGB       *rgba,
 
133
                                    gdouble        red,
 
134
                                    gdouble        green,
 
135
                                    gdouble        blue,
 
136
                                    gdouble        alpha);
 
137
 
 
138
void      gimp_rgba_set_uchar      (GimpRGB       *rgba,
 
139
                                    guchar         red,
 
140
                                    guchar         green,
 
141
                                    guchar         blue,
 
142
                                    guchar         alpha);
 
143
void      gimp_rgba_get_uchar      (const GimpRGB *rgba,
 
144
                                    guchar        *red,
 
145
                                    guchar        *green,
 
146
                                    guchar        *blue,
 
147
                                    guchar        *alpha);
 
148
 
 
149
gboolean  gimp_rgba_parse_css      (GimpRGB       *rgba,
 
150
                                    const gchar   *css,
 
151
                                    gint           len);
 
152
 
 
153
void      gimp_rgba_add            (GimpRGB       *rgba1,
 
154
                                    const GimpRGB *rgba2);
 
155
void      gimp_rgba_subtract       (GimpRGB       *rgba1,
 
156
                                    const GimpRGB *rgba2);
 
157
void      gimp_rgba_multiply       (GimpRGB       *rgba,
 
158
                                    gdouble        factor);
 
159
 
 
160
gdouble   gimp_rgba_distance       (const GimpRGB *rgba1,
 
161
                                    const GimpRGB *rgba2);
128
162
 
129
163
 
130
164
 
131
165
/*  Map RGB to intensity  */
132
166
 
133
 
#define GIMP_RGB_INTENSITY_RED    0.30
134
 
#define GIMP_RGB_INTENSITY_GREEN  0.59
135
 
#define GIMP_RGB_INTENSITY_BLUE   0.11
 
167
/*
 
168
 * The weights to compute true CIE luminance from linear red, green
 
169
 * and blue, as defined by the ITU-R Recommendation BT.709, "Basic
 
170
 * Parameter Values for the HDTV Standard for the Studio and for
 
171
 * International Programme Exchange" (1990). Also suggested in the
 
172
 * sRGB colorspace specification by the W3C.
 
173
 */
 
174
 
 
175
#define GIMP_RGB_LUMINANCE_RED    (0.2126)
 
176
#define GIMP_RGB_LUMINANCE_GREEN  (0.7152)
 
177
#define GIMP_RGB_LUMINANCE_BLUE   (0.0722)
 
178
 
 
179
#define GIMP_RGB_LUMINANCE(r,g,b) ((r) * GIMP_RGB_LUMINANCE_RED   + \
 
180
                                   (g) * GIMP_RGB_LUMINANCE_GREEN + \
 
181
                                   (b) * GIMP_RGB_LUMINANCE_BLUE)
 
182
 
 
183
 
 
184
#ifndef GIMP_DISABLE_DEPRECATED
 
185
 
 
186
/*
 
187
 * The coefficients below properly computed luminance for monitors
 
188
 * having phosphors that were contemporary at the introduction of NTSC
 
189
 * television in 1953. They are still appropriate for computing video
 
190
 * luma. However, these coefficients do not accurately compute
 
191
 * luminance for contemporary monitors. The use of these definitions
 
192
 * is deprecated.
 
193
 */
 
194
 
 
195
#define GIMP_RGB_INTENSITY_RED    (0.30)
 
196
#define GIMP_RGB_INTENSITY_GREEN  (0.59)
 
197
#define GIMP_RGB_INTENSITY_BLUE   (0.11)
 
198
 
136
199
#define GIMP_RGB_INTENSITY(r,g,b) ((r) * GIMP_RGB_INTENSITY_RED   + \
137
 
                                   (g) * GIMP_RGB_INTENSITY_GREEN + \
138
 
                                   (b) * GIMP_RGB_INTENSITY_BLUE)
 
200
                                   (g) * GIMP_RGB_INTENSITY_GREEN + \
 
201
                                   (b) * GIMP_RGB_INTENSITY_BLUE)
 
202
 
 
203
#endif
139
204
 
140
205
 
141
206
G_END_DECLS