OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
Coordinate.h
Go to the documentation of this file.
9// Copyright (c) 2008-2019 OpenShot Studios, LLC
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#ifndef OPENSHOT_COORDINATE_H
14#define OPENSHOT_COORDINATE_H
15
16#include <iostream>
17#include "Fraction.h"
18#include "Json.h"
19
20namespace openshot {
21
39public:
40 double X;
41 double Y;
42
44 Coordinate();
45
49 Coordinate(double x, double y);
50
53 Coordinate(const std::pair<double, double>& co);
54
55 // Get and Set JSON methods
56 std::string Json() const;
57 Json::Value JsonValue() const;
58 void SetJson(const std::string value);
59 void SetJsonValue(const Json::Value root);
60};
61
63template<class charT, class traits>
64std::basic_ostream<charT, traits>&
65operator<<(std::basic_ostream<charT, traits>& o, const openshot::Coordinate& co) {
66 std::basic_ostringstream<charT, traits> s;
67 s.flags(o.flags());
68 s.imbue(o.getloc());
69 s.precision(o.precision());
70 s << "(" << co.X << ", " << co.Y << ")";
71 return o << s.str();
72}
73
74}
75
76#endif
Header file for Fraction class.
Header file for JSON class.
A Cartesian coordinate (X, Y) used in the Keyframe animation system.
Definition Coordinate.h:38
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Json::Value JsonValue() const
Generate Json::Value for this object.
std::string Json() const
Generate JSON string of this object.
void SetJson(const std::string value)
Load JSON string into this object.
double X
The X value of the coordinate (usually representing the frame #)
Definition Coordinate.h:40
double Y
The Y value of the coordinate (usually representing the value of the property being animated)
Definition Coordinate.h:41
Coordinate()
The default constructor, which defaults to (0,0)
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &o, const openshot::Coordinate &co)
Stream output operator for openshot::Coordinate.
Definition Coordinate.h:65