37Color::Color(
unsigned char Red,
unsigned char Green,
unsigned char Blue,
unsigned char Alpha)
60 QColor color(QString::fromStdString(color_hex));
75 return QColor( r,g,b,a ).name().toStdString();
80 std::vector<int> rgba;
92 long rmean = ( R1 + R2 ) / 2;
96 return sqrt((((512+rmean)*r*r)>>8) + 4*g*g + (((767-rmean)*b*b)>>8));
130 catch (
const std::exception& e)
133 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
141 if (!root[
"red"].isNull())
143 if (!root[
"green"].isNull())
145 if (!root[
"blue"].isNull())
147 if (!root[
"alpha"].isNull())
Header file for Color class.
Header file for all Exception classes.
std::string Json() const
Generate JSON string of this object.
std::string GetColorHex(int64_t frame_number)
Get the HEX value of a color at a specific frame.
openshot::Keyframe blue
Curve representing the red value (0 - 255)
openshot::Keyframe red
Curve representing the red value (0 - 255)
openshot::Keyframe green
Curve representing the green value (0 - 255)
Color()
Default constructor.
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
openshot::Keyframe alpha
Curve representing the alpha value (0 - 255)
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...
std::vector< int > GetColorRGBA(int64_t frame_number)
void SetJson(const std::string value)
Load JSON string into this object.
Json::Value JsonValue() const
Generate Json::Value for this object.
Exception for invalid JSON.
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
int GetInt(int64_t index) const
Get the rounded INT value at a specific index.
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
void AddPoint(Point p)
Add a new point on the key-frame. Each point has a primary coordinate, a left handle,...
Json::Value JsonValue() const
Generate Json::Value for this object.
This namespace is the default namespace for all code in the openshot library.
const Json::Value stringToJson(const std::string value)