ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Color.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <Eigen/Geometry>
11 
12 namespace cloudViewer {
13 namespace visualization {
14 namespace gui {
15 
16 class Color {
17 public:
18  Color();
19  Color(float r, float g, float b, float a = 1.0);
20  Color(const Eigen::Vector3f& rgb); // not explicit: want auto-convert
21 
22  float GetRed() const;
23  float GetGreen() const;
24  float GetBlue() const;
25  float GetAlpha() const;
26 
27  void SetColor(float r, float g, float b, float a = 1.0);
28 
29  const float* GetPointer() const;
30  float* GetMutablePointer();
31 
35  Color Lightened(float amount);
36 
37  unsigned int ToABGR32() const;
38 
39  bool operator==(const Color& rhs) const;
40  bool operator!=(const Color& rhs) const;
41 
42 private:
43  float rgba_[4];
44 };
45 
46 } // namespace gui
47 } // namespace visualization
48 } // namespace cloudViewer
unsigned int ToABGR32() const
Definition: Color.cpp:59
bool operator==(const Color &rhs) const
Definition: Color.cpp:25
const float * GetPointer() const
Definition: Color.cpp:49
void SetColor(float r, float g, float b, float a=1.0)
Definition: Color.cpp:39
bool operator!=(const Color &rhs) const
Definition: Color.cpp:30
Color Lightened(float amount)
Definition: Color.cpp:52
Generic file read and write utility for python interface.