Merge gobject-branch into trunk
[profile/ivi/clutter.git] / clutter / clutter-color.c
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Authored By Matthew Allum  <mallum@openedhand.com>
7  *
8  * Copyright (C) 2006 OpenedHand
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  */
25
26 #include "clutter-color.h"
27
28 ClutterColor
29 clutter_color_new (guint8 r, guint8 g, guint8 b, guint8 a)
30 {
31   return ( r | g << 8 | b << 16 | a << 24 );
32 }
33
34 void
35 clutter_color_set (ClutterColor *color, 
36                    guint8        r, 
37                    guint8        g, 
38                    guint8        b, 
39                    guint8        a)
40 {
41   *color = ( r | g << 8 | b << 16 | a << 24 );
42 }
43
44 void
45 clutter_color_get (ClutterColor  color, 
46                    guint8        *r, 
47                    guint8        *g, 
48                    guint8        *b, 
49                    guint8        *a)
50 {
51   if (r)
52     *r = clutter_color_r(color);
53   if (g)
54     *g = clutter_color_g(color);
55   if (b)
56     *b = clutter_color_b(color);
57   if (a)
58     *a = clutter_color_a(color);
59 }
60
61