* */
LOT_EXPORT void lottie_animation_property_override(Lottie_Animation *animation, const Lottie_Animation_Property type, const char *keypath, ...);
+
+/**
+ * @brief Returns list of markers in the Lottie resource
+ * @p LOTMarkerList has a @p LOTMarker list and size of list
+ * @p LOTMarker has the marker's name, start frame, and end frame.
+ *
+ * @param[in] animation Animation object.
+ *
+ * @return The list of marker. If there is no marker, return null.
+ *
+ * @ingroup Lottie_Animation
+ * @internal
+ * */
+LOT_EXPORT const LOTMarkerList* lottie_animation_get_markerlist(Lottie_Animation *animation);
+
#ifdef __cplusplus
}
#endif
struct Lottie_Animation_S
{
- std::unique_ptr<Animation> mAnimation;
- std::future<Surface> mRenderTask;
- uint32_t *mBufferRef;
+ std::unique_ptr<Animation> mAnimation;
+ std::future<Surface> mRenderTask;
+ uint32_t *mBufferRef;
+ LOTMarkerList *mMarkerList;
};
LOT_EXPORT Lottie_Animation_S *lottie_animation_from_file(const char *path)
LOT_EXPORT void lottie_animation_destroy(Lottie_Animation_S *animation)
{
if (animation) {
+ if (animation->mMarkerList) {
+ for(size_t i = 0; i < animation->mMarkerList->size; i++) {
+ if (animation->mMarkerList->ptr[i].name) free(animation->mMarkerList->ptr[i].name);
+ }
+ delete[] animation->mMarkerList->ptr;
+ delete animation->mMarkerList;
+ }
+
if (animation->mRenderTask.valid()) {
animation->mRenderTask.get();
}
}
va_end(prop);
}
+
+LOT_EXPORT const LOTMarkerList*
+lottie_animation_get_markerlist(Lottie_Animation_S *animation)
+{
+ if (!animation) return nullptr;
+
+ auto markers = animation->mAnimation->markers();
+ if (markers.size() == 0) return nullptr;
+ if (animation->mMarkerList) return (const LOTMarkerList*)animation->mMarkerList;
+
+ animation->mMarkerList = new LOTMarkerList();
+ animation->mMarkerList->size = markers.size();
+ animation->mMarkerList->ptr = new LOTMarker[markers.size()]();
+
+ for(size_t i = 0; i < markers.size(); i++) {
+ animation->mMarkerList->ptr[i].name = strdup(std::get<0>(markers[i]).c_str());
+ animation->mMarkerList->ptr[i].startframe= std::get<1>(markers[i]);
+ animation->mMarkerList->ptr[i].endframe= std::get<2>(markers[i]);
+ }
+ return (const LOTMarkerList*)animation->mMarkerList;
+}
+
}