OpenShot Library | libopenshot
0.3.3
|
Go to the documentation of this file.
13 #ifndef OPENSHOT_KEYFRAME_H
14 #define OPENSHOT_KEYFRAME_H
31 double InterpolateBezierCurve(Point
const & left, Point
const & right,
double const target,
double const allowed_error);
34 double InterpolateBetween(Point
const & left, Point
const & right,
double target,
double allowed_error);
57 std::vector<Point> Points;
67 Keyframe(
const std::vector<openshot::Point>& points);
88 double GetValue(int64_t index)
const;
91 int GetInt(int64_t index)
const;
94 int64_t
GetLong(int64_t index)
const;
97 double GetDelta(int64_t index)
const;
125 std::string
Json()
const;
127 void SetJson(
const std::string value);
144 void PrintPoints(std::ostream* out=&std::cout)
const;
147 void PrintValues(std::ostream* out=&std::cout)
const;
bool IsIncreasing(int index) const
Get the direction of the curve at a specific index (increasing or decreasing)
Header file for Point class.
int64_t GetLong(int64_t index) const
Get the rounded LONG value at a specific index.
double InterpolateLinearCurve(Point const &left, Point const &right, double const target)
Linear interpolation between two points.
Keyframe()=default
Default constructor for the Keyframe class.
int64_t FindIndex(Point p) const
Get the index of a point by matching a coordinate.
void RemovePoint(Point p)
Remove a point by matching a coordinate.
This namespace is the default namespace for all code in the openshot library.
std::string Json() const
Generate JSON string of this object.
double GetDelta(int64_t index) const
Get the change in Y value (from the previous Y value)
Point GetMaxPoint() const
Get max point (by Y coordinate)
bool IsPointBeforeX(Point const &p, double const x)
Check if the X coordinate of a given Point is lower than a given value.
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
bool Contains(Point p) const
Does this keyframe contain a specific point.
Json::Value JsonValue() const
Generate Json::Value for this object.
void AddPoint(Point p)
Add a new point on the key-frame. Each point has a primary coordinate, a left handle,...
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
double InterpolateBezierCurve(Point const &left, Point const &right, double const target, double const allowed_error)
Bezier interpolation between two points.
double InterpolateBetween(Point const &left, Point const &right, double target, double allowed_error)
Interpolate two points using the right Point's interpolation method.
void SetJson(const std::string value)
Load JSON string into this object.
void PrintPoints(std::ostream *out=&std::cout) const
Print a list of points.
void PrintValues(std::ostream *out=&std::cout) const
Print just the Y value of the point's primary coordinate.
void UpdatePoint(int64_t index, Point p)
Replace an existing point with a new point.
const Point & GetPoint(int64_t index) const
Get a point at a specific index.
Point GetClosestPoint(Point p) const
Get current point (or closest point to the right) from the X coordinate (i.e. the frame number)
int64_t GetLength() const
int GetInt(int64_t index) const
Get the rounded INT value at a specific index.
int64_t GetCount() const
Get the number of points (i.e. # of points)
void ScalePoints(double scale)
Point GetPreviousPoint(Point p) const
Get previous point (.
InterpolationType
This controls how a Keyframe uses this point to interpolate between two points.
void FlipPoints()
Flip all the points in this openshot::Keyframe (useful for reversing an effect or transition,...
@ BEZIER
Bezier curves are quadratic curves, which create a smooth curve.
Header file for JSON class.
A Point is the basic building block of a key-frame curve.
double GetValue(int64_t index) const
Get the value at a specific index.