28 #include "../include/Color.h" 33 Color::Color(
unsigned char Red,
unsigned char Green,
unsigned char Blue,
unsigned char Alpha)
56 QColor color(QString::fromStdString(color_hex));
71 return QColor( r,g,b,a ).name().toStdString();
77 long rmean = ( R1 + R2 ) / 2;
81 return sqrt((((512+rmean)*r*r)>>8) + 4*g*g + (((767-rmean)*b*b)>>8));
111 bool success = reader.parse( value, root );
114 throw InvalidJSON(
"JSON could not be parsed (or is invalid)",
"");
124 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)",
"");
132 if (!root[
"red"].isNull())
134 if (!root[
"green"].isNull())
136 if (!root[
"blue"].isNull())
138 if (!root[
"alpha"].isNull())
Json::Value JsonValue()
Generate Json::JsonValue for this object.
Keyframe green
Curve representing the green value (0 - 255)
Color()
Default constructor.
Json::Value JsonValue()
Generate Json::JsonValue for this object.
Keyframe alpha
Curve representing the alpha value (0 - 255)
Keyframe red
Curve representing the red value (0 - 255)
string GetColorHex(int64_t frame_number)
Get the HEX value of a color at a specific frame.
void SetJson(string value)
Load JSON string into this object.
void SetJsonValue(Json::Value root)
Load Json::JsonValue into this object.
void AddPoint(Point p)
Add a new point on the key-frame. Each point has a primary coordinate, a left handle, and a right handle.
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...
Keyframe blue
Curve representing the red value (0 - 255)
int GetInt(int64_t index)
Get the rounded INT value at a specific index.
This namespace is the default namespace for all code in the openshot library.
Exception for invalid JSON.
string Json()
Get and Set JSON methods.
void SetJsonValue(Json::Value root)
Load Json::JsonValue into this object.
A Keyframe is a collection of Point instances, which is used to vary a number or property over time...