Loading...
Searching...
No Matches
Coordinate.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_COORDINATE_H
#define OPENSHOT_COORDINATE_H
#include <iostream>
#include "Fraction.h"
#include "Json.h"
namespace openshot {
class Coordinate {
public:
double X;
double Y;
Coordinate();
Coordinate(double x, double y);
Coordinate(const std::pair<double, double>& co);
// Get and Set JSON methods
std::string Json() const;
Json::Value JsonValue() const;
void SetJson(const std::string value);
void SetJsonValue(const Json::Value root);
};
template<class charT, class traits>
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& o, const openshot::Coordinate& co) {
std::basic_ostringstream<charT, traits> s;
s.flags(o.flags());
s.imbue(o.getloc());
s.precision(o.precision());
s << "(" << co.X << ", " << co.Y << ")";
return o << s.str();
}
}
#endif
Fraction.h
Header file for Fraction class.
Json.h
Header file for JSON class.
openshot::Coordinate
A Cartesian coordinate (X, Y) used in the Keyframe animation system.
Definition Coordinate.h:38
openshot::Coordinate::SetJsonValue
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Definition Coordinate.cpp:70
openshot::Coordinate::JsonValue
Json::Value JsonValue() const
Generate Json::Value for this object.
Definition Coordinate.cpp:36
openshot::Coordinate::Json
std::string Json() const
Generate JSON string of this object.
Definition Coordinate.cpp:29
openshot::Coordinate::SetJson
void SetJson(const std::string value)
Load JSON string into this object.
Definition Coordinate.cpp:53
openshot::Coordinate::X
double X
The X value of the coordinate (usually representing the frame #).
Definition Coordinate.h:40
openshot::Coordinate::Y
double Y
The Y value of the coordinate (usually representing the value of the property being animated).
Definition Coordinate.h:41
openshot::Coordinate::Coordinate
Coordinate()
The default constructor, which defaults to (0,0).
Definition Coordinate.cpp:19
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29
openshot::operator<<
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