tvg_saver: introduce a new module tvg saver
authorHermet Park <chuneon.park@samsung.com>
Wed, 21 Jul 2021 08:31:42 +0000 (17:31 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 22 Jul 2021 08:24:22 +0000 (17:24 +0900)
commitb75c8ee506ca03eb59120069ea84b19928f67735
treead73351e15b1413ad5a57ecbdffd6e28a49c35da
parent64fea7580d238cd976c3542d75b71b675bb29f26
tvg_saver: introduce a new module tvg saver

tvg saver is a new module to export tvg files.

In this patch, it also contains the infrastructure of saver module
to expand other types of savers such as png, jpg, etc.

To save the tvg file from a paint, you can use the Saver feature, for example:

auto saver = tvg::Saver::gen();
saver->save(paint, "sample.tvg");
saver->sync();

Later, you can read the "sample.tvg" using Picture.

auto picture = tvg::Picture::gen();
picture->load("sample.tvg");
...

The behavior of the saver will work on sync/async based on the threading setting of the initializer.
Thus if you wish to have a benefit of it, you must call sync() after the save() in the proper delayed time.

Otherwise, you can call sync() immediately.

Note that, the asynchronous tasking is depent on the saver module implementation.
Also, you need to enable tvg saver/loader modules from meson option. (yet this feature is under the beta)

@API Addition:
Result Saver::save(std::unique_ptr<Paint> paint, const std::string& path) noexcept;
Result Saver::sync() noexcept;

@Examples: tvgSaver

@Co-author: Mira Grudzinska <m.grudzinska@samsung.com>
19 files changed:
inc/thorvg.h
meson.build
meson_options.txt
src/examples/TvgSaver.cpp
src/lib/meson.build
src/lib/tvgCommon.h
src/lib/tvgLoaderMgr.h
src/lib/tvgPaint.cpp
src/lib/tvgPaint.h
src/lib/tvgPictureImpl.h
src/lib/tvgSaver.cpp
src/lib/tvgSaver.h [new file with mode: 0644]
src/lib/tvgSaverImpl.h [deleted file]
src/loaders/meson.build
src/meson.build
src/savers/meson.build [new file with mode: 0644]
src/savers/tvg/meson.build [new file with mode: 0644]
src/savers/tvg/tvgTvgSaver.cpp [new file with mode: 0644]
src/savers/tvg/tvgTvgSaver.h [new file with mode: 0644]