FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
color.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2017 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 
23 // Standard C++ library includes
24 
25 // Platform specific includes
26 #include "util/base/fife_stdint.h"
27 
28 // 3rd party library includes
29 
30 // FIFE includes
31 // These includes are split up in two parts, separated by one empty line
32 // First block: files included from the FIFE root src directory
33 // Second block: files included from the same folder
34 
35 #include "color.h"
36 
37 namespace FIFE {
39  :
40  m_r(r),
41  m_g(g),
42  m_b(b),
43  m_a(alpha) {
44  }
45 
47  }
48 
49  void Color::set(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) {
50  m_r = r;
51  m_g = g;
52  m_b = b;
53  m_a = alpha;
54  }
55 
56  void Color::setR(uint8_t r) {
57  m_r = r;
58  }
59 
60  void Color::setG(uint8_t g) {
61  m_g = g;
62  }
63 
64  void Color::setB(uint8_t b) {
65  m_b = b;
66  }
67 
68  void Color::setAlpha(uint8_t alpha) {
69  m_a = alpha;
70  }
71 
72  uint8_t Color::getR() const {
73  return m_r;
74  }
75 
76  uint8_t Color::getG() const {
77  return m_g;
78  }
79 
80  uint8_t Color::getB() const {
81  return m_b;
82  }
83 
85  return m_a;
86  }
87 }
uint8_t getG() const
Definition: color.cpp:76
uint8_t getB() const
Definition: color.cpp:80
void setG(uint8_t g)
Set green channel value.
Definition: color.cpp:60
uint8_t getAlpha() const
Definition: color.cpp:84
void setB(uint8_t b)
Set blue channel value.
Definition: color.cpp:64
void setAlpha(uint8_t alpha)
Set alpha channel value.
Definition: color.cpp:68
~Color()
Destructor.
Definition: color.cpp:46
void set(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha)
Set all color channel values.
Definition: color.cpp:49
unsigned char uint8_t
Definition: core.h:38
uint8_t getR() const
Definition: color.cpp:72
uint8_t m_g
Definition: color.h:133
Color(uint8_t r=0, uint8_t g=0, uint8_t b=0, uint8_t alpha=255)
Constructor.
Definition: color.cpp:38
void setR(uint8_t r)
Set red channel value.
Definition: color.cpp:56
uint8_t m_b
Definition: color.h:134
uint8_t m_a
Definition: color.h:135
uint8_t m_r
Definition: color.h:132