mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-05-25 16:57:54 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
#ifndef Ellipse_hpp
|
|
#define Ellipse_hpp
|
|
|
|
#include "Lottie/Private/Model/ShapeItems/ShapeItem.hpp"
|
|
#include "Lottie/Private/Model/Keyframes/KeyframeGroup.hpp"
|
|
#include <LottieCpp/Vectors.h>
|
|
#include "Lottie/Private/Parsing/JsonParsing.hpp"
|
|
|
|
namespace lottie {
|
|
|
|
enum class PathDirection: int {
|
|
Clockwise = 1,
|
|
UserSetClockwise = 2,
|
|
CounterClockwise = 3
|
|
};
|
|
|
|
/// An item that define an ellipse shape
|
|
class Ellipse: public ShapeItem {
|
|
public:
|
|
explicit Ellipse(lottiejson11::Json::object const &json) noexcept(false) :
|
|
ShapeItem(json),
|
|
position(KeyframeGroup<Vector3D>(Vector3D(0.0, 0.0, 0.0))),
|
|
size(KeyframeGroup<Vector3D>(Vector3D(0.0, 0.0, 0.0))) {
|
|
if (const auto directionRawValue = getOptionalInt(json, "d")) {
|
|
switch (directionRawValue.value()) {
|
|
case 1:
|
|
direction = PathDirection::Clockwise;
|
|
break;
|
|
case 2:
|
|
direction = PathDirection::UserSetClockwise;
|
|
break;
|
|
case 3:
|
|
direction = PathDirection::CounterClockwise;
|
|
break;
|
|
default:
|
|
throw LottieParsingException();
|
|
}
|
|
}
|
|
|
|
position = KeyframeGroup<Vector3D>(getObject(json, "p"));
|
|
size = KeyframeGroup<Vector3D>(getObject(json, "s"));
|
|
}
|
|
|
|
virtual ~Ellipse() = default;
|
|
|
|
virtual void toJson(lottiejson11::Json::object &json) const override {
|
|
ShapeItem::toJson(json);
|
|
|
|
if (direction.has_value()) {
|
|
json.insert(std::make_pair("d", (int)direction.value()));
|
|
}
|
|
json.insert(std::make_pair("p", position.toJson()));
|
|
json.insert(std::make_pair("s", size.toJson()));
|
|
}
|
|
|
|
public:
|
|
std::optional<PathDirection> direction;
|
|
KeyframeGroup<Vector3D> position;
|
|
KeyframeGroup<Vector3D> size;
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* Ellipse_hpp */
|