mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-05-01 15:27:55 +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.
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
#ifndef Shape_hpp
|
|
#define Shape_hpp
|
|
|
|
#include "Lottie/Private/Model/ShapeItems/ShapeItem.hpp"
|
|
#include "Lottie/Private/Model/ShapeItems/Ellipse.hpp"
|
|
#include <LottieCpp/BezierPath.h>
|
|
#include "Lottie/Private/Parsing/JsonParsing.hpp"
|
|
|
|
#include <optional>
|
|
|
|
namespace lottie {
|
|
|
|
/// An item that defines an custom shape
|
|
class Shape: public ShapeItem {
|
|
public:
|
|
explicit Shape(lottiejson11::Json::object const &json) noexcept(false) :
|
|
ShapeItem(json),
|
|
path(KeyframeGroup<BezierPath>(getObject(json, "ks"))) {
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
|
|
virtual ~Shape() = default;
|
|
|
|
virtual void toJson(lottiejson11::Json::object &json) const override {
|
|
ShapeItem::toJson(json);
|
|
|
|
json.insert(std::make_pair("ks", path.toJson()));
|
|
|
|
if (direction.has_value()) {
|
|
json.insert(std::make_pair("d", (int)direction.value()));
|
|
}
|
|
}
|
|
|
|
public:
|
|
KeyframeGroup<BezierPath> path;
|
|
std::optional<PathDirection> direction;
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* Shape_hpp */
|