Sergii Liebodkin
5374155048
Add support for textures color space formats
...
[Issues 1479: pictures](https://github.com/thorvg/thorvg/issues/1479 )
Formats supported:
ABGR8888
ARGB8888
ABGR8888S
ARGB8888S
2023-11-20 17:25:40 +09:00
Hermet Park
28b26796c8
Update README.md
...
updated sample code
2023-11-20 13:43:20 +09:00
Hermet Park
1a4d533ce1
Update README.md
...
updated thorvg viewer video
2023-11-18 00:17:09 +09:00
Hermet Park
6d59bc6c66
gif/saver: fix a invalid memory access
2023-11-17 21:28:45 +09:00
Hermet Park
10e566edc1
sw_engine: fixed a bug where strokes were not showing.
...
Basic shapes were trimmed entirely when they were outside of the canvas,
even if they had a big enough stroke to be partially on the canvas.
This fixes the issue.
Issue: https://github.com/thorvg/thorvg/issues/1785
2023-11-17 21:28:45 +09:00
Sergii Liebodkin
9afa1742be
examples: fixed manual loading of binary data (jpg, png, raw ect)
...
To load binary data operations must be performed in binary mode rather than text.
The issue appears on windows platform, especially for PNG loading
2023-11-17 20:46:28 +09:00
Hermet Park
f081e1f6ae
gif/encoder: fixed memory violation.
...
There was an invalid palette data access
when no frame data had been changed, detected by memory sanitizer.
2023-11-17 20:44:53 +09:00
Hermet Park
ab35ab2171
test: added gif save test
...
Skipped capi tests this time, since it has no saver api now.
2023-11-17 20:44:53 +09:00
Sergii Liebodkin
25513b591a
wg_engine: introduced images drawing support
...
[issues 1479: pictures](https://github.com/thorvg/thorvg/issues/1479 )
auto picture = tvg::Picture::gen();
picture->load("images/test.png");
picture->translate(0, 0);
picture->size(100, 100);
picture->opacity(255);
canvas->push(std::move(picture));
2023-11-17 19:34:32 +09:00
Hermet Park
ba46790b78
lottie/parser: Fix the shapes parsing logic.
...
Currently, it assumes "ty":"gr" for the related shapes children,
which can be skipped since the children will be in the "it" scope.
Some Lottie data is missing the "ty":"gr" field,
and ThorVG couldn't display the content properly.
It can ignore it with the context understanding.
2023-11-17 14:12:46 +09:00
Hermet Park
41a3702f19
gif/encoder: adjusted alpha transparent threshold 255 -> 127
...
More than half-transparent(50%) pixels will be encoded as well.
2023-11-17 13:28:41 +09:00
Hermet Park
092da69003
saver/gif: memory usage optimization.
...
Use a cache to store the intermediate palette data.
2023-11-17 13:28:41 +09:00
Hermet Park
314c0a0351
saver/gif: code refactoring
...
Revised the code to keep the thorvg convention consistency.
2023-11-17 13:28:41 +09:00
Hermet Park
d46176f830
gif: fixed a regresion bug by clear() change
...
by 66305f3e6d
2023-11-17 13:28:41 +09:00
Hermet Park
cc868e2248
infra: fix git-action ios break
2023-11-16 15:37:30 +09:00
Hermet Park
4cf2cc6707
Update README.md
2023-11-15 23:58:31 +09:00
Hermet Park
9752644220
gif: support transparent gif animation
...
if no background is set, gif will generate transparent version.
Issue: https://github.com/thorvg/thorvg/issues/1769
2023-11-15 23:51:33 +09:00
Hermet Park
3999762d3b
saver/gif: code refactoring
...
Remove unused dithering logics for reducing binary size.
This is not quite effective for vector images.
2023-11-15 23:51:33 +09:00
Hermet Park
6e6dd8a97e
gl_engine/renderer: skip sync if nothing should be done.
...
update by 66305f3e6d
2023-11-15 22:33:39 +09:00
Hermet Park
66305f3e6d
sw_engine: Clear buffer at the proper time.
...
Clear the buffer when canvas->clear() is called.
TODO: We need to add a color value parameter to clear it.
2023-11-15 21:12:24 +09:00
Jinny You
0c9827a9ed
infra: fix macos build crash
2023-11-15 13:45:38 +09:00
Hermet Park
92e6538b62
Update README.md
2023-11-14 21:26:28 +09:00
Hermet Park
2d2a8a7df8
tools/lottie2gif: support background color setting.
...
A white background will be set by default.
Usage:
$lottie2gif test.lottie -b ff0000 //red background color
2023-11-14 10:47:52 +09:00
Hermet Park
08252990a6
wasm: Set a GIF background color.
...
Use a white background by default.
2023-11-14 10:47:52 +09:00
Hermet Park
1fddcd3af2
examples/GifSaver: updated with a background usage
2023-11-14 10:47:52 +09:00
Hermet Park
561a6d8935
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-11-14 10:47:52 +09:00
Hermet Park
0611e7088c
lottie/parser: ++ blending options
...
thorvg blending is quite buggy,
the feature needs a verification.
2023-11-13 13:53:50 +09:00
Hermet Park
86bdf30479
examples: show users the best practice usage.
2023-11-10 13:56:11 +09:00
Hermet Park
33a2ef0b2d
sw_engine: ++null safety
2023-11-10 12:12:39 +09:00
Hermet Park
b133b2a8ae
lottie/builder: Fix a broken animation
...
The animation couldn't be triggered on a single thread.
Regression bug introduced by 29b5bc372d
2023-11-10 09:45:13 +09:00
Hermet Park
29b5bc372d
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-11-09 21:41:35 +09:00
Hermet Park
84f683d087
renderer/loader: code refactoring
...
Move the raw image loading interface to the RawImageLoader.
it is only valid for this component.
2023-11-09 14:46:32 +09:00
Hermet Park
2082343463
doc: make it up missing parameter information.
2023-11-09 14:46:14 +09:00
Hermet Park
d1bae0b44c
capi: udpated the doc.
...
BETA_API -> Experimental API
2023-11-08 10:53:39 +09:00
Sergii
4da90b2847
picture: added ability to support premultiplied for picture raw loader
...
[issues 1479: picture raw loader to support premultiplied](https://github.com/thorvg/thorvg/issues/1764 )
api changes:
Result Picture::load(uint32_t* data, uint32_t w, uint32_t h, bool copy);
Result Picture::load(uint32_t* data, uint32_t w, uint32_t h, bool premultiplied, bool copy);
capi changes
TVG_API Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool copy);
TVG_API Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool premultiplied, bool copy);
2023-11-08 10:46:23 +09:00
Hermet Park
9b3b4b1c63
example: renamed a sample, Svg2 -> DataLoad
...
The sample actually intends to test Picture::load() with a data.
2023-11-07 19:43:15 +09:00
Sergii Liebodkin
52eca9630c
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-11-06 20:35:26 +09:00
Sergii Liebodkin
a3adbef2c2
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-11-06 20:35:26 +09:00
Hermet Park
2f8c920654
gif: corrected the wrong aspect ratio scaling.
2023-11-06 20:18:13 +09:00
Hermet Park
ebe4672eff
saver/gif: Fix a clipping issue.
...
The Lottie loader missed handling the base clipper resizing.
This patch addresses the issue.
2023-11-06 17:47:14 +09:00
Hermet Park
f71aa2e300
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-11-06 17:47:14 +09:00
Hermet Park
7bf958e913
binding/wasm: remove layer functionality.
...
We will revisit this function later with a proper design.
2023-11-06 16:54:01 +09:00
Hermet Park
12534e6934
binding/wasm: updated save features
...
- removed the compression option
- added an animation save function.
2023-11-06 16:54:01 +09:00
Hermet Park
07a6b9cbe4
Update README.md
2023-11-04 21:40:50 +09:00
Hermet Park
4208278bb1
Update README.md
2023-11-04 21:36:57 +09:00
Hermet Park
0687b09c72
doc: keep the style clean & neat
2023-11-03 23:54:58 +09:00
Hermet Park
0819fc9058
binding/wasm: updated save features
...
- removed the compression option
- added an animation save function.
2023-11-03 23:54:58 +09:00
Hermet Park
4bfdac7140
Update README.md
2023-11-03 17:29:17 +09:00
Hermet Park
024e879ee6
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-11-03 17:19:05 +09:00
Jinny You
a60c881b60
docs: Remove all warnings from doxygen
2023-11-03 12:05:21 +09:00