OpenShot Library | libopenshot  0.3.3
Color.h
Go to the documentation of this file.
1 
9 // Copyright (c) 2008-2019 OpenShot Studios, LLC
10 //
11 // SPDX-License-Identifier: LGPL-3.0-or-later
12 
13 #ifndef OPENSHOT_COLOR_H
14 #define OPENSHOT_COLOR_H
15 
16 #include "KeyFrame.h"
17 #include <QColor>
18 
19 namespace openshot {
20 
27 class Color{
28 
29 public:
34 
36  Color() {};
37 
39  explicit Color(QColor);
40 
42  explicit Color(std::string color_hex);
43  explicit Color(const char* color_hex);
44 
46  Color(unsigned char Red, unsigned char Green, unsigned char Blue, unsigned char Alpha);
47 
50 
52  std::string GetColorHex(int64_t frame_number);
53 
54  // Get the RGBA values of a color at a specific frame
55  std::vector<int> GetColorRGBA(int64_t frame_number);
56 
58  static long GetDistance(long R1, long G1, long B1, long R2, long G2, long B2);
59 
60  // Get and Set JSON methods
61  std::string Json() const;
62  Json::Value JsonValue() const;
63  void SetJson(const std::string value);
64  void SetJsonValue(const Json::Value root);
65 };
66 
67 } // namespace openshot
68 
69 #endif
openshot::Color::Color
Color()
Default constructor.
Definition: Color.h:36
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Color::GetDistance
static long GetDistance(long R1, long G1, long B1, long R2, long G2, long B2)
Get the distance between 2 RGB pairs. (0=identical colors, 10=very close colors, 760=very different c...
Definition: Color.cpp:69
KeyFrame.h
Header file for the Keyframe class.
openshot::Color
This class represents a color (used on the timeline and clips)
Definition: Color.h:27
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition: KeyFrame.h:53
openshot::Color::SetJsonValue
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Definition: Color.cpp:117
openshot::Color::green
openshot::Keyframe green
Curve representing the green value (0 - 255)
Definition: Color.h:31
openshot::Color::JsonValue
Json::Value JsonValue() const
Generate Json::Value for this object.
Definition: Color.cpp:86
openshot::Color::SetJson
void SetJson(const std::string value)
Load JSON string into this object.
Definition: Color.cpp:100
openshot::Color::GetColorRGBA
std::vector< int > GetColorRGBA(int64_t frame_number)
Definition: Color.cpp:58
openshot::Color::alpha
openshot::Keyframe alpha
Curve representing the alpha value (0 - 255)
Definition: Color.h:33
openshot::Color::red
openshot::Keyframe red
Curve representing the red value (0 - 255)
Definition: Color.h:30
openshot::Color::GetColorHex
std::string GetColorHex(int64_t frame_number)
Get the HEX value of a color at a specific frame.
Definition: Color.cpp:47
openshot::Color::Json
std::string Json() const
Generate JSON string of this object.
Definition: Color.cpp:79
openshot::Color::blue
openshot::Keyframe blue
Curve representing the red value (0 - 255)
Definition: Color.h:32