Samsung / rlottie

A platform independent standalone library that plays Lottie Animation.
Other
1.19k stars 228 forks source link

[rlottie] C API does not render pixel data in the surface buffer. #42

Closed boothub closed 5 years ago

boothub commented 5 years ago

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

BufferContentAfterRendering

boothub commented 5 years ago

Using full path instead of relative path,does not help.

smohantty commented 5 years ago

@boothub , Currently rlottie library can't render the resource abstract_circle.json (present in rlottie/example/resource directory) . i will try to fix the issue.

Have you tried with other resources ? did you face the same problem ?

Thanks Subhransu

smohantty commented 5 years ago

@boothub , you are right . currently in my test case abstract_circle.json dosen't render

boothub commented 5 years ago

@smohantty , Which example from rlottie/example/resource is rendering?Just for test? Many thanks!

smohantty commented 5 years ago

@boothub , Most of them are working . just try "ao.json"

To test easily if a resource can be renderer by rlottie library. just drag and drop the file to http://www.rlottie.com/ (this page will render the json using rlottie library )

boothub commented 5 years ago

I tried many of them... unfortunately I get same results.... zero buffer. With ao.json,I have the same problem.... Where should I set a breakpoint to see why the buffer could not be written? Thank you!

smohantty commented 5 years ago

test.zip

@boothub I have attached the modified code .. which uses absolute path of the resource . could you test this and see if it works for you. and could you send me the console logs what you are getting .

Thanks Subhransu

boothub commented 5 years ago

@smohantty Its modifiying the buffer now... The root cause was the relative path as you suggested at the beginning. My fault is that I checked your suggestion with abstract_circles.json, and I thought that this is not the problem.... Actually was my luck to not use a good JSO during the test.

Many thanks Subhransu! Valentin.

real path /home/valentin/test_rlottie/ao.json Sufrace Buffer = 0x7fdfd07e4010 Running test app... animation ptr (0x55d602151b90) duration [0.983333] frame [59], width [500], height [500] Buffer Delta found at idx 18699. Buffer Delta found at idx 18699. Buffer Delta found at idx 18699. Buffer Delta found at idx 18699. Buffer Delta found at idx 18699. Buffer Delta found at idx 18699. Buffer Delta found at idx 18699. Buffer Delta found at idx 18699. Buffer Delta found at idx 18699. Buffer Delta found at idx 17210. Buffer Delta found at idx 16222. Buffer Delta found at idx 15733. Buffer Delta found at idx 15744. Buffer Delta found at idx 15755. Buffer Delta found at idx 15767. Buffer Delta found at idx 16278. Buffer Delta found at idx 17289. Buffer Delta found at idx 18300. Buffer Delta found at idx 19811. Buffer Delta found at idx 21821. Buffer Delta found at idx 23832. Buffer Delta found at idx 26342. Buffer Delta found at idx 28853. Buffer Delta found at idx 31863. Buffer Delta found at idx 35373. Buffer Delta found at idx 38883. Buffer Delta found at idx 42392. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732. Buffer Delta found at idx 43732.

boothub commented 5 years ago

We could add an improvement in doxygen description of the API lottie_animation_from_file. More, we could probably add this test file in the examples? I can create a pull request with a nicer version that could be used by others. Many thanks, again!

smohantty commented 5 years ago

@boothub , Glad that the issue is resolved. Regarding Improving documentation , Please make a patch for the same.

Regarding adding this as example , It will be great if this test writes the buffer to an image file which user can view using any image viewing tool. will happy to add that in our demo.

I am planning to add an example in which it will out put the result of a json file into a gif. maybe you can contribute to that example.

boothub commented 5 years ago

I am planing to play the rendered output with GTK or something similar. Part with the GIF sounds nice as well. I will think of it.

smohantty commented 5 years ago

We already have some UI application in example folder which depends on ui toolkit like EFL.

So A demo without any dependency with other library will be great (like your single file demo example).

I like the GIF idea . I tried to find some single header library that could save the buffer to a GIF. but most of them don't support the alpha channel . You can have a look at stb_image_write.h which can save the argb buffer to png or jpg . something like that will be great . application can have command line Ui and user can choose which frame it wants to save and then it saves to a PNG file using any single header library.

smohantty commented 5 years ago

have added one example rlottie which renders the json file and outputs to GIF file.