~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to libgimpcolor/gimprgb.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* LIBGIMP - The GIMP Library
 
2
 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Library General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
#ifndef __GIMP_RGB_H__
 
21
#define __GIMP_RGB_H__
 
22
 
 
23
G_BEGIN_DECLS
 
24
 
 
25
/* For information look into the C source or the html documentation */
 
26
 
 
27
 
 
28
#define GIMP_TYPE_RGB               (gimp_rgb_get_type ())
 
29
#define GIMP_VALUE_HOLDS_RGB(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_RGB))
 
30
 
 
31
GType   gimp_rgb_get_type           (void) G_GNUC_CONST;
 
32
 
 
33
 
 
34
/*  RGB and RGBA color types and operations taken from LibGCK  */
 
35
 
 
36
typedef enum
 
37
{
 
38
  GIMP_RGB_COMPOSITE_NONE = 0,
 
39
  GIMP_RGB_COMPOSITE_NORMAL,
 
40
  GIMP_RGB_COMPOSITE_BEHIND
 
41
} GimpRGBCompositeMode;
 
42
 
 
43
 
 
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);
 
92
 
 
93
/*  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
 
 
129
 
 
130
 
 
131
/*  Map RGB to intensity  */
 
132
 
 
133
#define GIMP_RGB_INTENSITY_RED    0.30
 
134
#define GIMP_RGB_INTENSITY_GREEN  0.59
 
135
#define GIMP_RGB_INTENSITY_BLUE   0.11
 
136
#define GIMP_RGB_INTENSITY(r,g,b) ((r) * GIMP_RGB_INTENSITY_RED   + \
 
137
                                   (g) * GIMP_RGB_INTENSITY_GREEN + \
 
138
                                   (b) * GIMP_RGB_INTENSITY_BLUE)
 
139
 
 
140
 
 
141
G_END_DECLS
 
142
 
 
143
#endif  /* __GIMP_RGB_H__ */