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.
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#ifndef Trim_hpp
|
|
#define Trim_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 {
|
|
|
|
/// An item that defines trim
|
|
class Trim: public ShapeItem {
|
|
public:
|
|
explicit Trim(lottiejson11::Json::object const &json) noexcept(false) :
|
|
ShapeItem(json),
|
|
start(KeyframeGroup<Vector1D>(Vector1D(0.0))),
|
|
end(KeyframeGroup<Vector1D>(Vector1D(0.0))),
|
|
offset(KeyframeGroup<Vector1D>(Vector1D(0.0))),
|
|
trimType(TrimType::Simultaneously) {
|
|
start = KeyframeGroup<Vector1D>(getObject(json, "s"));
|
|
end = KeyframeGroup<Vector1D>(getObject(json, "e"));
|
|
offset = KeyframeGroup<Vector1D>(getObject(json, "o"));
|
|
|
|
auto trimTypeRawValue = getInt(json, "m");
|
|
switch (trimTypeRawValue) {
|
|
case 1:
|
|
trimType = TrimType::Simultaneously;
|
|
break;
|
|
case 2:
|
|
trimType = TrimType::Individually;
|
|
break;
|
|
default:
|
|
throw LottieParsingException();
|
|
}
|
|
}
|
|
|
|
virtual ~Trim() = default;
|
|
|
|
virtual void toJson(lottiejson11::Json::object &json) const override {
|
|
ShapeItem::toJson(json);
|
|
|
|
json.insert(std::make_pair("s", start.toJson()));
|
|
json.insert(std::make_pair("e", end.toJson()));
|
|
json.insert(std::make_pair("o", offset.toJson()));
|
|
json.insert(std::make_pair("m", (int)trimType));
|
|
}
|
|
|
|
public:
|
|
KeyframeGroup<Vector1D> start;
|
|
KeyframeGroup<Vector1D> end;
|
|
KeyframeGroup<Vector1D> offset;
|
|
TrimType trimType;
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* Trim_hpp */
|