Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cairo-util.cpp
Go to the documentation of this file.
1 /*
2  CairoUtil - utility functions for Cairo
3 
4  Copyright (C) Lumiera.org
5  2010, Stefan Kangas <skangas@skangas.se>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (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, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
29 #include "gui/draw/cairo-util.hpp"
30 
31 namespace gui {
32 namespace draw {
33 
34  RefPtr<SolidPattern>
35  CairoUtil::pattern_set_red (const RefPtr<SolidPattern> color, double red)
36  {
37  double old_red;
38  double blue;
39  double green;
40  double alpha;
41 
42  color->get_rgba (old_red, blue, green, alpha);
43  return Cairo::SolidPattern::create_rgba (red, blue, green, alpha);
44  }
45 
46 
47  RefPtr<SolidPattern>
48  CairoUtil::pattern_set_green (const RefPtr<SolidPattern> color, double blue)
49  {
50  double red;
51  double old_blue;
52  double green;
53  double alpha;
54 
55  color->get_rgba (red, old_blue, green, alpha);
56  return Cairo::SolidPattern::create_rgba (red, blue, green, alpha);
57  }
58 
59 
60  RefPtr<SolidPattern>
61  CairoUtil::pattern_set_blue (const RefPtr<SolidPattern> color, double green)
62  {
63  double red;
64  double blue;
65  double old_green;
66  double alpha;
67 
68  color->get_rgba (red, blue, old_green, alpha);
69  return Cairo::SolidPattern::create_rgba (red, blue, green, alpha);
70  }
71 
72 
73  RefPtr<SolidPattern>
74  CairoUtil::pattern_set_alpha (const RefPtr<SolidPattern> color, double alpha)
75  {
76  double red;
77  double blue;
78  double green;
79  double old_alpha;
80 
81  color->get_rgba (red, blue, green, old_alpha);
82 
83  return Cairo::SolidPattern::create_rgba (red, blue, green, alpha);
84  }
85 
86 }}// namespace gui::draw
static RefPtr< SolidPattern > pattern_set_blue(const RefPtr< SolidPattern >, double blue)
Make a new SolidPattern from an old one, changing the blue component of the colour.
Definition: cairo-util.cpp:61
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:47
static RefPtr< SolidPattern > pattern_set_alpha(const RefPtr< SolidPattern >, double alpha)
Make a new SolidPattern from an old one, changing the alpha component of the colour.
Definition: cairo-util.cpp:74
static RefPtr< SolidPattern > pattern_set_green(const RefPtr< SolidPattern >, double green)
Make a new SolidPattern from an old one, changing the green component of the colour.
Definition: cairo-util.cpp:48
Utility functions for working with elements from the Cairo vector drawing library.
static RefPtr< SolidPattern > pattern_set_red(const RefPtr< SolidPattern > color, double red)
Make a new SolidPattern from an old one, changing the red component of the colour.
Definition: cairo-util.cpp:35