Loading...
Searching...
No Matches
openshot::Point Class Reference

A Point is the basic building block of a key-frame curve. More...

`#include <Point.h>`

## Public Member Functions

void | Initialize_Handles ()
void | Initialize_LeftHandle (float x, float y)
| Set the left handle to a percent of the primary coordinate (0 to 1).
void | Initialize_RightHandle (float x, float y)
| Set the right handle to a percent of the primary coordinate (0 to 1).
std::string | Json () const
| Generate JSON string of this object.
Json::Value | JsonValue () const
| Generate Json::Value for this object.
| Point ()
| Default constructor (defaults to 1,0).
| Point (const Coordinate &co)
| Constructor which takes a coordinate.
| Point (const Coordinate &co, InterpolationType interpolation)
| Constructor which takes a coordinate and interpolation mode.
| Point (const Coordinate &co, InterpolationType interpolation, HandleType handle_type)
| Constructor which takes a coordinate, interpolation mode, and handle type.
| Point (float x, float y)
| Constructor which also creates a Point and sets the X and Y of the Point.
| Point (float x, float y, InterpolationType interpolation)
| Constructor which also creates a Point and sets the X,Y, and interpolation of the Point.
| Point (float y)
| Constructor which creates a single coordinate at X=1.
void | SetJson (const std::string value)
| Load JSON string into this object.
void | SetJsonValue (const Json::Value root)
| Load Json::Value into this object.

## Public Attributes

Coordinate | co
| This is the primary coordinate.
Coordinate | handle_left
| This is the left handle coordinate (in percentages from 0 to 1).
Coordinate | handle_right
| This is the right handle coordinate (in percentages from 0 to 1).
HandleType | handle_type
| This is the handle mode.
InterpolationType | interpolation
| This is the interpolation mode.

## Detailed Description

A Point is the basic building block of a key-frame curve.

Points have a primary coordinate and a left and right handle coordinate. The handles are used to influence the direction of the curve as it moves between the primary coordinate and the next primary coordinate when the interpolation mode is BEZIER. When using LINEAR or CONSTANT, the handles are ignored.

Please see the following Example Code:

Coordinate c1(3,9);
Point p1(c1, BEZIER);
assert(c1.X == 3);
assert(c1.Y == 9);
openshot::Coordinate
A Cartesian coordinate (X, Y) used in the Keyframe animation system.
Definition Coordinate.h:38
openshot::Point::Point
Point()
Default constructor (defaults to 1,0).
Definition Point.cpp:20
openshot::BEZIER
@ BEZIER
Bezier curves are quadratic curves, which create a smooth curve.
Definition Point.h:29

Definition at line 64 of file Point.h.

## Constructor & Destructor Documentation

## Point() [1/7]

Point::Point | ( |  | ) |

Default constructor (defaults to 1,0).

Definition at line 20 of file Point.cpp.

Referenced by Point(), Point(), Point(), Point(), Point(), and Point().

## Point() [2/7]

Point::Point | ( | float | y | ) |

Constructor which creates a single coordinate at X=1.

Definition at line 23 of file Point.cpp.

## Point() [3/7]

Point::Point | ( | float | x,
|  | float | y )

Constructor which also creates a Point and sets the X and Y of the Point.

Definition at line 26 of file Point.cpp.

## Point() [4/7]

Point::Point | ( | float | x,
|  | float | y,
|  | InterpolationType | interpolation )

Constructor which also creates a Point and sets the X,Y, and interpolation of the Point.

Definition at line 29 of file Point.cpp.

## Point() [5/7]

Point::Point | ( | const Coordinate & | co | ) |

Constructor which takes a coordinate.

Definition at line 34 of file Point.cpp.

## Point() [6/7]

Point::Point | ( | const Coordinate & | co,
|  | InterpolationType | interpolation )

Constructor which takes a coordinate and interpolation mode.

Definition at line 36 of file Point.cpp.

## Point() [7/7]

Point::Point | ( | const Coordinate & | co,
|  | InterpolationType | interpolation,
|  | HandleType | handle_type )

Constructor which takes a coordinate, interpolation mode, and handle type.

Definition at line 39 of file Point.cpp.

## Member Function Documentation

## Initialize_Handles()

void Point::Initialize_Handles | ( |  | ) |

Set the left and right handles to a percent of the primary coordinate (0 to 1) Defaults to a smooth curve (Ease in and out)

Definition at line 45 of file Point.cpp.

Referenced by Point().

## Initialize_LeftHandle()

void Point::Initialize_LeftHandle | ( | float | x,
|  | float | y )

Set the left handle to a percent of the primary coordinate (0 to 1).

Definition at line 52 of file Point.cpp.

Referenced by Initialize_Handles().

## Initialize_RightHandle()

void Point::Initialize_RightHandle | ( | float | x,
|  | float | y )

Set the right handle to a percent of the primary coordinate (0 to 1).

Definition at line 57 of file Point.cpp.

Referenced by Initialize_Handles().

## Json()

std::string Point::Json | ( |  | ) | const

Generate JSON string of this object.

Definition at line 63 of file Point.cpp.

## JsonValue()

Json::Value Point::JsonValue | ( |  | ) | const

Generate Json::Value for this object.

Definition at line 70 of file Point.cpp.

Referenced by Json().

## SetJson()

void Point::SetJson | ( | const std::string | value | ) |

Load JSON string into this object.

Definition at line 87 of file Point.cpp.

## SetJsonValue()

void Point::SetJsonValue | ( | const Json::Value | root | ) |

Load Json::Value into this object.

Definition at line 104 of file Point.cpp.

Referenced by SetJson(), and openshot::Keyframe::SetJsonValue().

## Member Data Documentation

## co

Coordinate openshot::Point::co

This is the primary coordinate.

Definition at line 66 of file Point.h.

Referenced by openshot::ClipBase::add_property_json(), openshot::TrackedObjectBBox::add_property_json(), openshot::Keyframe::AddPoint(), openshot::ApplyCropResizeScale(), openshot::Keyframe::Contains(), openshot::Keyframe::FindIndex(), openshot::Keyframe::GetClosestPoint(), openshot::Keyframe::GetMaxPoint(), openshot::InterpolateBetween(), openshot::InterpolateBezierCurve(), openshot::TrackedObjectBBox::InterpolateBoxes(), openshot::InterpolateLinearCurve(), openshot::IsPointBeforeX(), JsonValue(), Point(), Point(), Point(), openshot::Keyframe::RemovePoint(), SearchBetweenPoints(), and SetJsonValue().

## handle_left

Coordinate openshot::Point::handle_left

This is the left handle coordinate (in percentages from 0 to 1).

Definition at line 67 of file Point.h.

Referenced by Initialize_LeftHandle(), openshot::InterpolateBezierCurve(), JsonValue(), and SetJsonValue().

## handle_right

Coordinate openshot::Point::handle_right

This is the right handle coordinate (in percentages from 0 to 1).

Definition at line 68 of file Point.h.

Referenced by Initialize_RightHandle(), openshot::InterpolateBezierCurve(), JsonValue(), and SetJsonValue().

## handle_type

HandleType openshot::Point::handle_type

This is the handle mode.

Definition at line 70 of file Point.h.

Referenced by JsonValue(), Point(), and SetJsonValue().

## interpolation

InterpolationType openshot::Point::interpolation

This is the interpolation mode.

Definition at line 69 of file Point.h.

Referenced by openshot::ClipBase::add_property_json(), openshot::TrackedObjectBBox::add_property_json(), openshot::InterpolateBetween(), JsonValue(), Point(), Point(), Point(), and SetJsonValue().

The documentation for this class was generated from the following files:

- Point.h
- Point.cpp