OpenShot Library | libopenshot
0.4.0
|
Go to the documentation of this file.
21 Color::Color(
unsigned char Red,
unsigned char Green,
unsigned char Blue,
unsigned char Alpha) :
22 red(static_cast<double>(Red)),
23 green(static_cast<double>(Green)),
24 blue(static_cast<double>(Blue)),
25 alpha(static_cast<double>(Alpha)) { }
29 red(Red), green(Green), blue(Blue), alpha(Alpha) { }
34 green(qcolor.green()),
36 alpha(qcolor.alpha()) { }
41 :
Color::
Color(QString::fromStdString(color_hex)) {}
54 return QColor( r,g,b,a ).name().toStdString();
59 std::vector<int> rgba;
71 long rmean = ( R1 + R2 ) / 2;
75 return sqrt((((512+rmean)*r*r)>>8) + 4*g*g + (((767-rmean)*b*b)>>8));
109 catch (
const std::exception& e)
112 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
120 if (!root[
"red"].isNull())
122 if (!root[
"green"].isNull())
124 if (!root[
"blue"].isNull())
126 if (!root[
"alpha"].isNull())
const Json::Value stringToJson(const std::string value)
Color()
Default constructor.
This namespace is the default namespace for all code in the openshot library.
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
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...
Json::Value JsonValue() const
Generate Json::Value for this object.
This class represents a color (used on the timeline and clips)
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Exception for invalid JSON.
openshot::Keyframe green
Curve representing the green value (0 - 255)
Json::Value JsonValue() const
Generate Json::Value for this object.
int GetInt(int64_t index) const
Get the rounded INT value at a specific index.
void SetJson(const std::string value)
Load JSON string into this object.
std::vector< int > GetColorRGBA(int64_t frame_number)
Header file for Color class.
openshot::Keyframe alpha
Curve representing the alpha value (0 - 255)
openshot::Keyframe red
Curve representing the red value (0 - 255)
std::string GetColorHex(int64_t frame_number)
Get the HEX value of a color at a specific frame.
std::string Json() const
Generate JSON string of this object.
openshot::Keyframe blue
Curve representing the red value (0 - 255)
Header file for all Exception classes.