cmake_minimum_required( VERSION 3.2 )
#declare project
-project( lottie-player VERSION 0.0.1 LANGUAGES C CXX ASM)
+project( rlottie VERSION 0.0.1 LANGUAGES C CXX ASM)
#declare target
-add_library( lottie-player SHARED "" )
+add_library( rlottie SHARED "" )
#declare version of the target
-set(player_version_major 0)
-set(player_version_minor 0)
-set(player_version_patch 1)
-set(player_version ${player_version_major}.${player_version_minor}.${player_version_patch} )
-set_target_properties(lottie-player PROPERTIES
- VERSION ${player_version}
- SOVERSION ${player_version_major}
+set(rlottie_version_major 0)
+set(rlottie_version_minor 0)
+set(rlottie_version_patch 1)
+set(rlottie_version ${rlottie_version_major}.${rlottie_version_minor}.${rlottie_version_patch} )
+set_target_properties(rlottie PROPERTIES
+ VERSION ${rlottie_version}
+ SOVERSION ${rlottie_version_major}
)
#declare alias so that library can be used inside the build tree, e.g. when testing
-add_library(lottie-player::lottie-player ALIAS lottie-player)
+add_library(rlottie::rlottie ALIAS rlottie)
#declare target compilation options
-target_compile_options(lottie-player
+target_compile_options(rlottie
PUBLIC
-std=c++14
PRIVATE
set( CMAKE_THREAD_PREFER_PTHREAD TRUE )
find_package( Threads )
-target_link_libraries(lottie-player
+target_link_libraries(rlottie
PUBLIC
"${CMAKE_THREAD_LIBS_INIT}"
)
# for dlopen, dlsym and dlclose dependancy
-target_link_libraries(lottie-player
+target_link_libraries(rlottie
PRIVATE
${CMAKE_DL_LIBS})
-target_link_libraries(lottie-player
+target_link_libraries(rlottie
PUBLIC
"-Wl,--no-undefined"
)
DESTINATION include)
#install lib
-install( TARGETS lottie-player EXPORT lottie-player-targets
+install( TARGETS rlottie EXPORT rlottie-targets
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
INCLUDES DESTINATION include
#install config file.
-install( EXPORT lottie-player-targets
- FILE lottie-playerTargets.cmake
- NAMESPACE lottie-player::
- DESTINATION ${LIB_INSTALL_DIR}/cmake/lottie-player
+install( EXPORT rlottie-targets
+ FILE rlottieTargets.cmake
+ NAMESPACE rlottie::
+ DESTINATION ${LIB_INSTALL_DIR}/cmake/rlottie
)
#Create a ConfigVersion.cmake file
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
- ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfigVersion.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/rlottieConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
-configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/lottie-playerConfig.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfig.cmake
- INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/lottie-player
+configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/rlottieConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/rlottieConfig.cmake
+ INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/rlottie
)
#Install the config, configversion and custom find modules
install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfig.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfigVersion.cmake
- DESTINATION ${LIB_INSTALL_DIR}/cmake/lottie-player
+ ${CMAKE_CURRENT_BINARY_DIR}/rlottieConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/rlottieConfigVersion.cmake
+ DESTINATION ${LIB_INSTALL_DIR}/cmake/rlottie
)
-export(EXPORT lottie-player-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerTargets.cmake NAMESPACE lottie-player::)
+export(EXPORT rlottie-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/rlottieTargets.cmake NAMESPACE rlottie::)
#Register package in user's package registry
-export(PACKAGE lottie-player)
+export(PACKAGE rlottie)
Licensing
-lottie-player basically comes with LGPL-v2.1 license(licenses/COPYING.LGPL)
+rlottie basically comes with LGPL-v2.1 license(licenses/COPYING.LGPL)
but some parts of shared code are covered by different licenses. Listed
below are the folder names and the license file covering it. Note that this
license would cover all of the source invovled in each folders, unless
BUILD WITH CMAKE
================
-liblottie-player can also be built using the cmake build system.
+librlottie can also be built using the cmake build system.
1. install cmake. (Follow instructions at https://cmake.org/download/)
2. create a new build/ directory
+++ /dev/null
-get_filename_component(lottie-player_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-include(CMakeFindDependencyMacro)
-
-list(APPEND CMAKE_MODULE_PATH ${lottie-player_CMAKE_DIR})
-
-# NOTE Had to use find_package because find_dependency does not support COMPONENTS or MODULE until 3.8.0
-
-#find_dependency(RapidJSON 1.0 REQUIRED MODULE)
-#find_package(Boost 1.55 REQUIRED COMPONENTS regex)
-list(REMOVE_AT CMAKE_MODULE_PATH -1)
-
-if(NOT TARGET lottie-player::lottie-player)
- include("${lottie-player_CMAKE_DIR}/lottie-playerTargets.cmake")
-endif()
-
-set(lottie-player_LIBRARIES lottie-player::lottie-player)
--- /dev/null
+get_filename_component(rlottie_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+include(CMakeFindDependencyMacro)
+
+list(APPEND CMAKE_MODULE_PATH ${rlottie_CMAKE_DIR})
+
+# NOTE Had to use find_package because find_dependency does not support COMPONENTS or MODULE until 3.8.0
+
+#find_dependency(RapidJSON 1.0 REQUIRED MODULE)
+#find_package(Boost 1.55 REQUIRED COMPONENTS regex)
+list(REMOVE_AT CMAKE_MODULE_PATH -1)
+
+if(NOT TARGET rlottie::rlottie)
+ include("${rlottie_CMAKE_DIR}/rlottieTargets.cmake")
+endif()
+
+set(rlottie_LIBRARIES rlottie::rlottie)
#include"lottieview.h"
-using namespace lottie;
+using namespace rlottie;
static Eina_Bool
animator(void *data , double pos)
mDirty = true;
auto buffer = (uint32_t *)evas_object_image_data_get(mImage, EINA_TRUE);
size_t bytesperline = evas_object_image_stride_get(mImage);
- lottie::Surface surface(buffer, width, height, bytesperline);
+ rlottie::Surface surface(buffer, width, height, bytesperline);
mRenderTask = mPlayer->render(mCurFrame, surface);
// to force a redraw
evas_object_image_data_update_add(mImage, 0 , 0, surface.width(), surface.height());
} else {
auto buffer = (uint32_t *)evas_object_image_data_get(mImage, EINA_TRUE);
size_t bytesperline = evas_object_image_stride_get(mImage);
- lottie::Surface surface(buffer, width, height, bytesperline);
+ rlottie::Surface surface(buffer, width, height, bytesperline);
mPlayer->renderSync(mCurFrame, surface);
evas_object_image_data_set(mImage, surface.buffer());
evas_object_image_data_update_add(mImage, 0 , 0, surface.width(), surface.height());
Evas_Object *mVg;
int mRepeatCount;
LottieView::RepeatMode mRepeatMode;
- std::unique_ptr<lottie::Animation> mPlayer;
+ std::unique_ptr<rlottie::Animation> mPlayer;
size_t mCurFrame{UINT_MAX};
Ecore_Animator *mAnimator{nullptr};
bool mLoop;
float mPos;
float mFrameRate;
long mTotalFrame;
- std::future<lottie::Surface> mRenderTask;
+ std::future<rlottie::Surface> mRenderTask;
//keep a segment of the animation default is [0, 1]
float mMinProgress{0};
-target_include_directories(lottie-player
+target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}"
)
\ No newline at end of file
struct LOTNode;
struct LOTLayerNode;
-namespace lottie {
+namespace rlottie {
class LOT_EXPORT Surface {
public:
+++ /dev/null
-<manifest>
- <request>
- <domain name="_"/>
- </request>
-</manifest>
+++ /dev/null
-prefix=@PREFIX@
-exec_prefix=@EXEC_DIR@
-apiversion=@player_version@
-libdir=@LIBDIR@
-includedir=@INCDIR@
-
-Name: lottie-player
-Description: A lottie-player library
-Version: @player_version@
-Requires:
-Libs: -L${libdir} -llottie-player
-Cflags: -I${includedir} -std=c++14
-Name: lottie-player
-Summary: lottie player library
+Name: rlottie
+Summary: lottie rendering library
Version: 0.0.1
Release: 1
Group: UI Framework/Services
%package devel
-Summary: lottie player library (devel)
+Summary: lottie rendering library (devel)
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
-lottie player library (devel)
+lottie rendering library (devel)
%prep
%files
%defattr(-,root,root,-)
-%{_libdir}/liblottie-player.so.*
-%manifest %{name}.manifest
+%{_libdir}/librlottie.so.*
+%manifest packaging/%{name}.manifest
%license COPYING licenses/COPYING*
%files devel
%defattr(-,root,root,-)
%{_includedir}/*.h
-%{_libdir}/liblottie-player.so
-%{_libdir}/cmake/lottie-player/*.cmake
-%{_libdir}/pkgconfig/lottie-player.pc
+%{_libdir}/librlottie.so
+%{_libdir}/cmake/rlottie/*.cmake
+%{_libdir}/pkgconfig/rlottie.pc
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@EXEC_DIR@
+apiversion=@rlottie_version@
+libdir=@LIBDIR@
+includedir=@INCDIR@
+
+Name: rlottie
+Description: A rlottie library
+Version: @rlottie_version@
+Requires:
+Libs: -L${libdir} -lrlottie
+Cflags: -I${includedir} -std=c++14
-target_sources(lottie-player
+target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/lottieanimation_capi.cpp"
)
-target_include_directories(lottie-player
+target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}"
)
#include "rlottie.h"
#include "vdebug.h"
-using namespace lottie;
+using namespace rlottie;
extern "C" {
{
if (!animation) return;
- lottie::Surface surface(buffer, width, height, bytes_per_line);
+ rlottie::Surface surface(buffer, width, height, bytes_per_line);
animation->mRenderTask = animation->mAnimation->render(frame_number, surface);
animation->mBufferRef = buffer;
}
-target_sources(lottie-player
+target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/lottieitem.cpp"
"${CMAKE_CURRENT_LIST_DIR}/lottieloader.cpp"
"${CMAKE_CURRENT_LIST_DIR}/lottieanimation.cpp"
)
-target_include_directories(lottie-player
+target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}"
)
#include <fstream>
-using namespace lottie;
+using namespace rlottie;
struct RenderTask {
RenderTask() { receiver = sender.get_future(); }
return mRootLayer->layerNode();
}
-bool LOTCompItem::render(const lottie::Surface &surface)
+bool LOTCompItem::render(const rlottie::Surface &surface)
{
VBitmap bitmap(reinterpret_cast<uchar *>(surface.buffer()),
surface.width(), surface.height(),
VSize size() const;
void buildRenderTree();
const LOTLayerNode * renderTree()const;
- bool render(const lottie::Surface &surface);
+ bool render(const rlottie::Surface &surface);
private:
VMatrix mScaleMatrix;
VSize mViewSize;
add_subdirectory(freetype)
add_subdirectory(pixman)
-target_sources(lottie-player
+target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/vrect.cpp"
"${CMAKE_CURRENT_LIST_DIR}/vdasher.cpp"
"${CMAKE_CURRENT_LIST_DIR}/vimageloader.cpp"
)
-target_include_directories(lottie-player
+target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}"
)
-target_sources(lottie-player
+target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/v_ft_math.cpp"
"${CMAKE_CURRENT_LIST_DIR}/v_ft_raster.cpp"
"${CMAKE_CURRENT_LIST_DIR}/v_ft_stroker.cpp"
)
-target_include_directories(lottie-player
+target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}"
)
\ No newline at end of file
-target_sources(lottie-player
+target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/vregion.cpp"
)
IF("${ARCH}" STREQUAL "arm")
SET(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp")
-target_sources(lottie-player
+target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/pixman-arm-neon-asm.S"
)
ENDIF("${ARCH}" STREQUAL "arm")
-target_include_directories(lottie-player
+target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}"
)
public:
void SetUp()
{
- animationInvalid = lottie::Animation::loadFromFile("wrong_file.json");
+ animationInvalid = rlottie::Animation::loadFromFile("wrong_file.json");
std::string filePath = DEMO_DIR;
filePath +="mask.json";
- animation = lottie::Animation::loadFromFile(filePath);
+ animation = rlottie::Animation::loadFromFile(filePath);
}
void TearDown()
}
public:
- std::unique_ptr<lottie::Animation> animationInvalid;
- std::unique_ptr<lottie::Animation> animation;
+ std::unique_ptr<rlottie::Animation> animationInvalid;
+ std::unique_ptr<rlottie::Animation> animation;
};
TEST_F(AnimationTest, loadFromFile_N) {