Debian Codegraph @

src/GUI/FGColor.cxx

raw symbols SCIP
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4
5 #include "FGColor.hxx"
6
7 #include <iostream>
8
9 #include <simgear/props/props.hxx>
10
11 ////////////////////////////////////////////////////////////////////////
12 // FGColor class.
13 ////////////////////////////////////////////////////////////////////////
14
15 void
16 FGColor::print() const {
17 std::cerr << "red=" << _red << ", green=" << _green
18 << ", blue=" << _blue << ", alpha=" << _alpha << std::endl;
19 }
20
21 bool
22 FGColor::merge(const SGPropertyNode *node)
23 {
24 if (!node)
25 return false;
26
27 bool dirty = false;
28 const SGPropertyNode * n;
29 if ((n = node->getNode("red")))
30 _red = n->getFloatValue(), dirty = true;
31 if ((n = node->getNode("green")))
32 _green = n->getFloatValue(), dirty = true;
33 if ((n = node->getNode("blue")))
34 _blue = n->getFloatValue(), dirty = true;
35 if ((n = node->getNode("alpha")))
36 _alpha = n->getFloatValue(), dirty = true;
37 return dirty;
38 }
39
40 bool
41 FGColor::merge(const FGColor *color)
42 {
43 bool dirty = false;
44 if (color && color->_red >= 0.0)
45 _red = color->_red, dirty = true;
46 if (color && color->_green >= 0.0)
47 _green = color->_green, dirty = true;
48 if (color && color->_blue >= 0.0)
49 _blue = color->_blue, dirty = true;
50 if (color && color->_alpha >= 0.0)
51 _alpha = color->_alpha, dirty = true;
52 return dirty;
53 }
54