color.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 
5 namespace hebi {
6 
8 struct Color {
9 public:
12  Color() {}
13 
18  Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a) : r_(r), g_(g), b_(b), a_(a) {}
19 
24  Color(uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b), a_(255) {}
25 
27  uint8_t getRed() const { return r_; }
29  uint8_t getGreen() const { return g_; }
31  uint8_t getBlue() const { return b_; }
36  uint8_t getAlpha() const { return a_; }
37 
38  void setRed(uint8_t r) { r_ = r; }
39  void setGreen(uint8_t g) { g_ = g; }
40  void setBlue(uint8_t b) { b_ = b; }
41  void setAlpha(uint8_t a) { a_ = a; }
42 
43 private:
44  uint8_t r_{};
45  uint8_t g_{};
46  uint8_t b_{};
47  uint8_t a_{};
48 };
49 
50 } // namespace hebi
uint8_t getRed() const
Returns the red channel; value is between 0 and 255.
Definition: color.hpp:27
Definition: arm.cpp:5
uint8_t getAlpha() const
Definition: color.hpp:36
void setBlue(uint8_t b)
Definition: color.hpp:40
void setGreen(uint8_t g)
Definition: color.hpp:39
void setAlpha(uint8_t a)
Definition: color.hpp:41
void setRed(uint8_t r)
Definition: color.hpp:38
uint8_t getBlue() const
Returns the blue channel; value is between 0 and 255.
Definition: color.hpp:31
Color()
Creates a color object with zero for the red, green, blue, and alpha channels.
Definition: color.hpp:12
uint8_t r_
Definition: color.hpp:44
uint8_t getGreen() const
Returns the green channel; value is between 0 and 255.
Definition: color.hpp:29
uint8_t g_
Definition: color.hpp:45
uint8_t a_
Definition: color.hpp:47
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Creates a color from the given red, green, blue, and alpha channel values.
Definition: color.hpp:18
Structure to describe an RGB color.
Definition: color.hpp:8
uint8_t b_
Definition: color.hpp:46
Color(uint8_t r, uint8_t g, uint8_t b)
Creates a color from the given red, green, and blue values.
Definition: color.hpp:24


hebi_cpp_api_ros
Author(s): Chris Bollinger , Matthew Tesch
autogenerated on Thu May 28 2020 03:14:44