samsung / rlottie Goto Github PK
View Code? Open in Web Editor NEWA platform independent standalone library that plays Lottie Animation.
License: Other
A platform independent standalone library that plays Lottie Animation.
License: Other
is there any way to build lib and release so lib?
As drawBitmap() api dosen't use any brush for getting fill information . it dosen't update the brush data.
If the last drawing has some brush data like transform matrix it affects the drawBitmap() implementaion.
So clear the previous brush data by setting a empty brush before rendering bitmap
Bodymovin 5.5.2 version is released, there is a report rlottie doens't work on it.
Need to verify rlottie with any sample resource exported that version whether it's working or not
../src/vector/vimageloader.cpp:53:79: error: cast between incompatible function types from 'FARPROC' {aka 'long long int ()()'} to 'lottie_image_load_f' {aka 'unsigned char ()(const char, int*, int*, int*, int)'} [-Werror=cast-function-type]
Add WINAPI in front of the function, like that :
using lottie_image_load_f = unsigned char *(WINAPI *)(const char *filename, int *x,
int *y, int *comp, int req_comp);
using lottie_image_load_data_f = unsigned char *(WINAPI *)(const char *data, int len,
int *x, int *y, int *comp,
int req_comp);
using lottie_image_free_f = void (WINAPI *)(unsigned char *);
opacity property is not used while rendering the animation.
../example/lottie2gif.cpp:97:20: error: 'realpath' was not declared in this scope
use _fullpath instead :
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fullpath-wfullpath?view=vs-2019
We need a way to load the external resource (like image , font) when calling loadFromData api.
As we are directly giving the file content the api has no way of knowing where to load the external resource referenced by the json .
Would like to have similar web interface like in skia lottie.
https://skottie.skia.org
hello
meson .. --prefix=/opt/rlotti --buildtype=debug --default-library shared
gives
src/vector/meson.build:33:0: ERROR: C++ library 'dl' not found
ex) www.rlottie.io
One requested lottie renders the frame image to the exact surface size.
There may be the case when the surface size and the required rendering size is different.
So planning to add a viewport api which will set the viewport area of the surface.
Now lottie will use the viewport size to generate the image for that frame and render it in the viewport area
of the surface
Currently we build the image loader as a separate module and use it through dlopen interface.
Provide compilation option to to include to library or create separate module.
Currently rlottie supports multi thread rendering. and there is no way of turn it off during compile time.
Refactor the code to provide compile time switch to enable/disable thread support.
Dependency threads found: YES
Program cmake found: YES (E:\Documents\programmes_x64\msys2\usr\bin/cmake.EXE)
Program cmake found: YES (E:\Documents\programmes_x64\msys2\usr\bin/cmake.EXE)
error retrieving cmake informations: returnCode=255 stdout= stderr=System is unknown to cmake, create:
Platform/MINGW64_NT-6.1-7601 to use this system, please send your config file to [email protected] so it can be added to cmake
System is unknown to cmake, create:
Platform/MINGW64_NT-6.1-7601 to use this system, please send your config file to [email protected] so it can be added to cmake
CMake Error at /usr/share/cmake-3.14.5/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/mingw64/bin/cc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/vtorri/gitroot_64/rlottie_vtorri/builddir/__cmake_systeminformation/CMakeFiles/CMakeTmp
Run Build Command(s):/mingw64/bin/ninja.exe cmTC_4b2cb
[1/2] Building C object CMakeFiles/cmTC_4b2cb.dir/testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_4b2cb.dir/testCCompiler.c.obj
/mingw64/bin/cc.exe -o CMakeFiles/cmTC_4b2cb.dir/testCCompiler.c.obj -c testCCompiler.c
CreateProcess failed: The system cannot find the file specified.
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:6 (project)
Error: --system-information failed on internal CMake!
meson.build:58:10: ERROR: Unable to find cmake
in src/vector/vimageloader.cpp, Windows.h is included.
When cross-compilation is done on Unix (case sensitive file system), then the compilation will fail, as windows.h and not Windows.h is provided
On Windows M_PI is defined only if
#define _USE_MATH_DEFINES
is called just before #include in src/lottie/lottiemodel.cpp, src/vector/vdasher.cpp, vbezier.cpp and vpath.cpp too. See
https://docs.microsoft.com/fr-fr/cpp/c-runtime-library/math-constants?view=vs-2019
you can, if you want, embed this macro in a #ifdef_WIN32
/TEST Rlottie/
#include "unistd.h"
#include "stdlib.h"
#include "stdio.h"
#include "rlottie_capi.h"
int main ()
{
double duration;
size_t i, k, frame, frame_number, width = 64U, height = 64U, bytes_per_line = width * sizeof(uint32_t);
uint32_t* p_render;
uint32_t* buffer;
Lottie_Animation* animation = lottie_animation_from_file("example/resource/abstract_circle.json");
if (animation == NULL)
{
perror("Lottie animation is NULL.\n");
return 1;
}
lottie_animation_get_size(animation, &width, &height);
if ((width > 1024) || (height > 1024))
{
perror("Returned size too large\n");
return 1;
}
buffer = (uint32_t*)calloc(bytes_per_line * height, sizeof(uint32_t));
duration = lottie_animation_get_duration(animation);
frame_number = lottie_animation_get_totalframe(animation);
frame = lottie_animation_get_frame_at_pos(animation, 1);
if (frame_number == 0U)
{
perror("Lottie resource have no animation.\n");
return 1;
}
printf ("Sufrace Buffer = %p\n", buffer);
printf ("Running test app... animation ptr (%p) duration [%lf] frame [%lu]\n", animation, duration, frame);
for (i = 0; i < frame_number; i++)
{
lottie_animation_render_async(animation, i, &buffer[0], width, height, bytes_per_line);
p_render = lottie_animation_render_flush(animation);
if (p_render != buffer)
{
perror ("Render flash mismatch output\n");
}
for (k = 0U; k < bytes_per_line * height; k++)
{
if (buffer[k] != 0U)
{
printf("Buffer Delta found at idx %lu.\n", k);
break;
}
}
}
printf ("\n");
return 0;
}
commit 8b5851c must be reverted
Indeed, on Windows, both / and \ are path separators
bool LOTCompItem::update(int frameNo)
{
// check if cached frame is same as requested frame.
if (!mUpdateViewBox && (mCurFrameNo == frameNo)) return false;
/*
* if viewbox dosen't scale exactly to the viewport
* we scale the viewbox keeping AspectRatioPreserved and then align the
* viewbox to the viewport using AlignCenter rule.
*/
VSize viewPort = mViewSize;
VSize viewBox = mCompData->size();
float sx = float(viewPort.width()) / viewBox.width();
float sy = float(viewPort.height()) / viewBox.height();
float scale = fmin(sx, sy);
float tx = (viewPort.width() - viewBox.width() * sx) * 0.5;
float ty = (viewPort.height() - viewBox.height() * sy) * 0.5;
VMatrix m;
m.translate(tx, ty).scale(sx, sy);
mRootLayer->update(frameNo, m, 1.0);
mCurFrameNo = frameNo;
mUpdateViewBox = false;
return true;
}
rlottie crashes with SIGSEGV on specifically crafted json files like the one below:
{
"fr":1,
"op":1,
"w":1,
"h":1,
"layers":[{}]
}
LOT_BUILD should not be defined for the entire project :
LOT_BUILD must be defined for the library and NOT the programs.
in addition DLL_EXPORT must be defined only when the shared library is built, though, on Windows, only shared lib should be built
I have a patch for this, i will create a PR
make -j 2
Scanning dependencies of target rlottie-image-loader
Scanning dependencies of target rlottie
[ 2%] Building CXX object src/vector/stb/CMakeFiles/rlottie-image-loader.dir/stb_image.cpp.o
[ 5%] Building CXX object CMakeFiles/rlottie.dir/src/vector/freetype/v_ft_math.cpp.o
[ 8%] Building CXX object CMakeFiles/rlottie.dir/src/vector/freetype/v_ft_raster.cpp.o
[ 10%] Linking CXX shared library librlottie-image-loader.dylib
[ 10%] Built target rlottie-image-loader
[ 13%] Building CXX object CMakeFiles/rlottie.dir/src/vector/freetype/v_ft_stroker.cpp.o
[ 16%] Building CXX object CMakeFiles/rlottie.dir/src/vector/pixman/vregion.cpp.o
[ 18%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vrect.cpp.o
[ 21%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdasher.cpp.o
[ 24%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vbrush.cpp.o
[ 27%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vbitmap.cpp.o
[ 29%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vpainter.cpp.o
[ 32%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vcompositionfunctions.cpp.o
[ 35%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdrawhelper.cpp.o
[ 37%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdrawhelper_sse2.cpp.o
[ 40%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdrawhelper_neon.cpp.o
[ 43%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vrle.cpp.o
[ 45%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vpath.cpp.o
[ 48%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vpathmesure.cpp.o
[ 51%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vmatrix.cpp.o
[ 54%] Building CXX object CMakeFiles/rlottie.dir/src/vector/velapsedtimer.cpp.o
[ 56%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdebug.cpp.o
[ 59%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vinterpolator.cpp.o
[ 62%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vbezier.cpp.o
[ 64%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vraster.cpp.o
[ 67%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdrawable.cpp.o
[ 70%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vimageloader.cpp.o
[ 72%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieitem.cpp.o
[ 75%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieloader.cpp.o
[ 78%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottiemodel.cpp.o
[ 81%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieproxymodel.cpp.o
[ 83%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieparser.cpp.o
[ 86%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieanimation.cpp.o
[ 89%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottiekeypath.cpp.o
[ 91%] Building CXX object CMakeFiles/rlottie.dir/src/binding/c/lottieanimation_capi.cpp.o
[ 94%] Linking CXX shared library librlottie.dylib
ld: unknown option: --no-undefined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [librlottie.0.0.1.dylib] Error 1
make[1]: *** [CMakeFiles/rlottie.dir/all] Error 2
make: *** [all] Error 2
main.zip
Attached the test source code.
Expectation: After executing the code, I expect to see some pixel data in the surface buffer.
Actual behaviour: After flushing the rendering data, the buffer content is still zero.
See attached GDB picture.
To build the source code:
gcc -Lbuild/src/ -Wall -g -Og -o vtest main.c -lrlottie
Is it any way to somehow wipe current cache in rlottie's public API?
It can be useful in the case of preventing memory leakage in long-running apps, or, say, in the case of a need to forcefully reload cached animation with new data.
When opacity is applied to mask, transparency is not applied.
I have attached a test file.
I want to show text by this lottie lib.
Hi there!
I faced broken compilation because of forced -Werror
and the fact that clang throwing a -Wdefaulted-function-deleted
warning:
../rlottie-715c8450bf995f6a92fac1b64df77bd16effc7b0/src/vector/vbrush.h:41:5: error: explicitly defaulted default constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
VGradient() = default;
^
../rlottie-715c8450bf995f6a92fac1b64df77bd16effc7b0/src/vector/vbrush.h:57:16: note: default constructor of 'VGradient' is implicitly deleted because variant field 'linear' has a non-trivial default constructor
Linear linear;
^
1 error generated.
Well, adding -Wno-error
to CXXFLAGS allows me to build the library, but since you forcing -Werror
, I guess you'd like to know about such warning.
The request scenario is, app and designers could make consensus that a special design,
let's say it's "button"
And this resource may have 3 states: normal, focus in, focus out and the animation frame would be,
0 : normal
1 - 100 : focus in
101 - 200 : focus out
If specific layers could contain focus in, focus out animation frame, app doesn't need to hard code for these focus in/out animation implementation. They just read each layer's frame start/end and play those animation with them.
This is a example why they want layers' frame info.
We could discuss whether we will support or not, how to support it.
See Samples:
'F Masks_All_02_1920x1080.json'
https://lottiefiles.com/share/4dIjaX
This Sample result is not properly displayed.
the macro must be _WIN32 (an underscore before WIN32)
I'm try build it by cmake on my win10。but it error form this install command of cmake.here is the error infomation.
and the official documents of cmake (https://cmake.org/cmake/help/v3.14/command/install.html) say to us,
For DLL platforms (all Windows-based systems including Cygwin), the DLL import library is treated as an ARCHIVE target. For non- DLL platforms shared libraries are treated as LIBRARY targets.
so this cmake code change to
`IF(WIN32)
install(TARGETS rlottie-image-loader
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
ELSE(WIN32)
install(TARGETS rlottie-image-loader
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
)
ENDIF(WIN32)`
^_^ the last command : cmake .. -Dexample=true -DLIB_INSTALL_DIR="D:/out"
it's work well
UX Samples Masking result (Color RGB values) is a little different with Online Lottie viewer.
F Masks_All_01_1920x1080.json
F Masks_All_02_1920x1080.json
Please take a screenshot and pick any pixels with an image editor tools.
Currently we only support subsurface rendering in the (0,0) location.
with this feature we can render arbitrary region of the surface.
we found that,the new designed lottie, can not rend pictures.can you fix this? I can send you my json documents.
hello
do you think that you will proveide a release tarball soon ?
thank you
hello
currently, the code is written in C++. Do you think that C could improve the speed of the rendering ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.