Lumiera  0.pre.03
»edit your freedom«
cairo-util.cpp
Go to the documentation of this file.
1 /*
2  CairoUtil - utility functions for Cairo
3 
4  Copyright (C)
5  2010, Stefan Kangas <skangas@skangas.se>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
21 
22 namespace stage {
23 namespace draw {
24 
25  RefPtr<SolidPattern>
26  CairoUtil::pattern_set_red (const RefPtr<SolidPattern> color, double red)
27  {
28  double old_red;
29  double blue;
30  double green;
31  double alpha;
32 
33  color->get_rgba (old_red, blue, green, alpha);
34  return Cairo::SolidPattern::create_rgba (red, blue, green, alpha);
35  }
36 
37 
38  RefPtr<SolidPattern>
39  CairoUtil::pattern_set_green (const RefPtr<SolidPattern> color, double blue)
40  {
41  double red;
42  double old_blue;
43  double green;
44  double alpha;
45 
46  color->get_rgba (red, old_blue, green, alpha);
47  return Cairo::SolidPattern::create_rgba (red, blue, green, alpha);
48  }
49 
50 
51  RefPtr<SolidPattern>
52  CairoUtil::pattern_set_blue (const RefPtr<SolidPattern> color, double green)
53  {
54  double red;
55  double blue;
56  double old_green;
57  double alpha;
58 
59  color->get_rgba (red, blue, old_green, alpha);
60  return Cairo::SolidPattern::create_rgba (red, blue, green, alpha);
61  }
62 
63 
64  RefPtr<SolidPattern>
65  CairoUtil::pattern_set_alpha (const RefPtr<SolidPattern> color, double alpha)
66  {
67  double red;
68  double blue;
69  double green;
70  double old_alpha;
71 
72  color->get_rgba (red, blue, green, old_alpha);
73 
74  return Cairo::SolidPattern::create_rgba (red, blue, green, alpha);
75  }
76 
77 }}// namespace stage::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:52
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:26
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:39
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:65
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
Utility functions for working with elements from the Cairo vector drawing library.