Hermet Park
b3e2c7e6b0
saver/gif: code refactoring
...
Revised the code to keep the thorvg convention consistency.
2023-12-26 18:36:18 +09:00
Hermet Park
2053bbbc37
gif: fixed a regresion bug by clear() change
...
by 66305f3e6d
2023-12-26 18:34:49 +09:00
Hermet Park
7272e8efd4
infra: fix git-action ios break
2023-12-26 18:34:22 +09:00
Hermet Park
2309648869
Update README.md
2023-12-26 18:33:52 +09:00
Hermet Park
34f47671b1
gif: support transparent gif animation
...
if no background is set, gif will generate transparent version.
Issue: https://github.com/thorvg/thorvg/issues/1769
2023-12-26 18:33:46 +09:00
Hermet Park
dfbb3893b0
saver/gif: code refactoring
...
Remove unused dithering logics for reducing binary size.
This is not quite effective for vector images.
2023-12-26 18:33:40 +09:00
Hermet Park
f58895a04a
gl_engine/renderer: skip sync if nothing should be done.
...
update by 66305f3e6d
2023-12-26 18:33:33 +09:00
Jinny You
b581cbb123
infra: fix macos build crash
2023-12-26 18:31:11 +09:00
Hermet Park
862a6662ee
Update README.md
2023-12-26 18:31:05 +09:00
Hermet Park
6387615a90
tools/lottie2gif: support background color setting.
...
A white background will be set by default.
Usage:
$lottie2gif test.lottie -b ff0000 //red background color
2023-12-26 18:30:50 +09:00
Hermet Park
750e4d6261
wasm: Set a GIF background color.
...
Use a white background by default.
2023-12-26 18:30:42 +09:00
Hermet Park
b1c1958c99
examples/GifSaver: updated with a background usage
2023-12-26 18:30:27 +09:00
Hermet Park
27843d2557
savers: provides a background setting.
...
Allow users to set a custom background with a saver.
API:
- Result Saver::background(std::unique_ptr<Paint> paint);
2023-12-26 18:30:06 +09:00
Hermet Park
5129b05023
lottie/parser: ++ blending options
...
thorvg blending is quite buggy,
the feature needs a verification.
2023-12-26 18:24:21 +09:00
Hermet Park
5401b1ae2e
examples: show users the best practice usage.
2023-12-26 18:24:04 +09:00
Hermet Park
39022851b7
sw_engine: ++null safety
2023-12-26 18:23:54 +09:00
Hermet Park
965e58806a
lottie/builder: Fix a broken animation
...
The animation couldn't be triggered on a single thread.
Regression bug introduced by 29b5bc372d
2023-12-26 18:23:46 +09:00
Hermet Park
4ba8ff1e11
lottie/loader: Corrected an issue with the return value when loading fails.
...
Previously, Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false)
would return 'Success' even when the data is invalid.
This issue only occurred when the number of threads is set to 0.
2023-12-26 18:23:40 +09:00
Hermet Park
042693ccfe
renderer/loader: code refactoring
...
Move the raw image loading interface to the RawImageLoader.
it is only valid for this component.
2023-12-26 18:23:25 +09:00
Hermet Park
a37649cd1f
doc: make it up missing parameter information.
2023-12-26 18:21:01 +09:00
Hermet Park
3efb659e48
capi: udpated the doc.
...
BETA_API -> Experimental API
2023-12-26 18:19:46 +09:00
Hermet Park
cd216a5235
example: renamed a sample, Svg2 -> DataLoad
...
The sample actually intends to test Picture::load() with a data.
2023-12-26 18:18:57 +09:00
Sergii Liebodkin
bad02c7de0
Added ability to draw solid strokes with dashes
...
[issues 1479: Shape](https://github.com/thorvg/thorvg/issues/1479 )
In order to build you need third party libraries. Before you start please read this: [LearnWebGPU](https://eliemichel.github.io/LearnWebGPU/getting-started/hello-webgpu.html )
Usage example:
// init glfw
glfwInit();
// create a windowed mode window and its opengl context
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
GLFWwindow* window = glfwCreateWindow(800, 800, "WebGPU base app", nullptr, nullptr);
// get window size
int width{}, height{};
glfwGetWindowSize(window, &width, &height);
// init engine webgpu
tvg::Initializer::init(tvg::CanvasEngine::Wg, 0);
// create wg canvas
auto canvasWg = tvg::WgCanvas::gen();
canvas_wg->target(glfwGetWin32Window(window), width, height);
//Test for Stroke Dash for Arc, Circle, Rect
auto shape = tvg::Shape::gen();
shape->appendArc(70, 600, 160, 10, 30, true);
shape->appendCircle(70, 700, 20, 60);
shape->appendRect(130, 710, 100, 40);
shape->strokeFill(255, 0, 0);
shape->strokeWidth(5);
shape->strokeJoin(tvg::StrokeJoin::Round);
shape->strokeCap(tvg::StrokeCap::Round);
float dashPattern[2] = {20, 10};
shape->strokeDash(dashPattern, 2);
if (canvas_wg->push(std::move(shape)) != tvg::Result::Success) return;
while (!glfwWindowShouldClose(window)) {
// webgpu
canvas_wg->draw();
canvas_wg->sync();
// pull events
glfwPollEvents();
}
// terminate engine and window
tvg::Initializer::term(tvg::CanvasEngine::Wg);
glfwDestroyWindow(window);
glfwTerminate();
2023-12-26 18:18:48 +09:00
Sergii Liebodkin
41ea198a5e
Added ability to draw solid strokes
...
[issues 1479: Shape](https://github.com/thorvg/thorvg/issues/1479 )
In order to build you need third party libraries. Before you start please read this: [LearnWebGPU](https://eliemichel.github.io/LearnWebGPU/getting-started/hello-webgpu.html )
Usage example:
// init glfw
glfwInit();
// create a windowed mode window and its opengl context
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
GLFWwindow* window = glfwCreateWindow(800, 800, "WebGPU base app", nullptr, nullptr);
// get window size
int width{}, height{};
glfwGetWindowSize(window, &width, &height);
// init engine webgpu
tvg::Initializer::init(tvg::CanvasEngine::Wg, 0);
// create wg canvas
auto canvasWg = tvg::WgCanvas::gen();
canvas_wg->target(glfwGetWin32Window(window), width, height);
//Test for Stroke Dash for Arc, Circle, Rect
auto shape = tvg::Shape::gen();
shape->appendArc(70, 600, 160, 10, 30, true);
shape->appendCircle(70, 700, 20, 60);
shape->appendRect(130, 710, 100, 40);
shape->strokeFill(255, 0, 0);
shape->strokeWidth(5);
shape->strokeJoin(tvg::StrokeJoin::Round);
shape->strokeCap(tvg::StrokeCap::Round);
if (canvas_wg->push(std::move(shape)) != tvg::Result::Success) return;
while (!glfwWindowShouldClose(window)) {
// webgpu
canvas_wg->draw();
canvas_wg->sync();
// pull events
glfwPollEvents();
}
// terminate engine and window
tvg::Initializer::term(tvg::CanvasEngine::Wg);
glfwDestroyWindow(window);
glfwTerminate();
2023-12-26 18:18:42 +09:00
Hermet Park
f5e6fce5c1
gif: corrected the wrong aspect ratio scaling.
2023-12-26 18:18:33 +09:00
Hermet Park
58311ee5c3
saver/gif: Fix a clipping issue.
...
The Lottie loader missed handling the base clipper resizing.
This patch addresses the issue.
2023-12-26 18:18:27 +09:00
Hermet Park
acb67dad8c
saver/gif: up to date the gif encoder.
...
this fixes the memory sanitizer report:
../src/savers/gif/gif.h:315:31: runtime error: index 255 out of bounds for type 'unsigned char [255]'
../src/savers/gif/gif.h:113:54: runtime error: index 255 out of bounds for type 'unsigned char [255]'
Issue: https://github.com/thorvg/thorvg/issues/1758
2023-12-26 18:18:21 +09:00
Hermet Park
875b623c95
binding/wasm: updated save features
...
- removed the compression option
- added an animation save function.
2023-12-26 18:17:41 +09:00
Hermet Park
3306f53a78
Update README.md
2023-12-26 18:17:41 +09:00
Hermet Park
f3a843f91d
Update README.md
2023-12-26 18:17:41 +09:00
Hermet Park
2c382e3d9b
doc: keep the style clean & neat
2023-12-26 18:17:41 +09:00
Hermet Park
40ff8592e5
binding/wasm: updated save features
...
- removed the compression option
- added an animation save function.
2023-12-26 18:17:41 +09:00
Hermet Park
ec958c5fec
Update README.md
2023-12-26 18:17:41 +09:00
Hermet Park
708e9a7c2a
tools/lottie2gif: introduce a new converter tool.
...
Usage:
lottie2gif [Lottie file] or [Lottie folder] [-r resolution] [-f fps]
Examples:
$ lottie2gif input.json
$ lottie2gif input.json -f 30
$ lottie2gif input.json -r 600x600 -f 30
$ lottie2gif lottiefolder
$ lottie2gif lottiefolder -r 600x600
$ lottie2gif lottiefolder -r 600x600 -f 30
2023-12-26 18:17:41 +09:00
Jinny You
059a950d42
docs: Remove all warnings from doxygen
2023-12-26 18:17:41 +09:00
RuiwenTang
f3a155bce8
gl_engine: fix memory out of bounds error in GlGpuBuffer
...
If buffer data is larger than memory alignment, need to make sure there
is enough memory in current stage buffer
2023-12-26 18:17:41 +09:00
Hermet Park
b9504ca9c2
renderer: maintain consistency in the logging domain.
2023-12-26 18:17:41 +09:00
Hermet Park
4dfb1a036e
Update AUTHORS
2023-12-26 18:17:41 +09:00
JunsuChoi
a20216045a
saver GifSaver: Introduce GifSaver for animation
...
Add save() API that takes tvg::Animation as a parameter.
This API uses gif.h to create each animation frame as a gif frame.
Gif creation do not support threads because they must be added sequentially.
Please see example/GifSaver.cpp
ex)
auto animation = tvg::Animation::gen();
auto picture = animation->picture();
picture->load(EXAMPLE_DIR"/walker.json");
auto saver = tvg::Saver::gen();
saver->save(std::move(animation), EXAMPLE_DIR"/test.gif");
saver->sync();
New API:
Result Saver::save(std::unique_ptr<Animation> animation, const std::string& path, uint32_t quality = 100, uint32_t fps = 0);
Issue: https://github.com/thorvg/thorvg/issues/1712
2023-12-26 18:17:38 +09:00
Hermet Park
43f0ba403c
loaders/png: fixed data conversion warnings on Windows
...
../src/loaders/external_png/tvgPngLoader.cpp(110): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
../src/loaders/external_png/tvgPngLoader.cpp(111): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
../src/loaders/external_png/tvgPngLoader.cpp(112): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
2023-12-26 18:06:58 +09:00
Hermet Park
b21c7f8302
example/capi: remove saver test.
...
This generated tvg often make us confused
when Tvg example doesn't show it properly.
It's too small circle.
2023-12-26 18:06:50 +09:00
Jinny You
45dfab5ef5
examples: Support mac os to execute all
2023-12-26 18:06:15 +09:00
Hermet Park
fba98c8cbf
renderer: ++safety
...
these member values can be accesssed without update() call.
2023-12-26 18:06:07 +09:00
Hermet Park
22c36b7069
wasm: fix a regression bug.
...
The Animation::frame() method has been modified.
It will now return InsufficientCondition,
if the frame value is the same as the previous one.
In addition to this change, we have also updated its usage accordingly.
2023-12-26 18:05:58 +09:00
Hermet Park
37a01b8735
portability: addressed all compilation warnings from MSVC
2023-12-26 18:05:36 +09:00
Hermet Park
c3d88b18fe
lottie: fixed all memory access violations.
2023-12-26 18:05:28 +09:00
Hermet Park
c8a8bb5af4
renderer/paint: added a blend update flag.
...
Keep track of the update changes accurately.
We can utilize this value change in the backend engine.
2023-12-26 18:05:22 +09:00
Hermet Park
29590b373f
lottie/builder: enable layer blending
...
Issue: https://github.com/thorvg/thorvg/issues/1737
2023-12-26 18:02:12 +09:00
Hermet Park
c18643f9b6
renderer: revise the internal paints structure.
...
Get rid of the polymorphism function table,
use the switch directly instead.
We profiled, both binary & performance is better than before.
Tested on a local machine (single thread):
- Lottie: 2ms improved
- Binary: -0.5kb
2023-12-26 18:01:57 +09:00
Hermet Park
ab8dd8a9c2
lottie: ++optimization with a caching effect.
...
reuse clippers if they are available.
Binary: +132
2023-12-26 18:01:51 +09:00