Mira Grudzinska
568846491d
build: enforcing saver/loader usage for given tool
...
Selecting a tool without choosing the required tools
resulted in a usage error. Now, the activation
of the appropriate saver/loader for a given tool
is enforced.
2024-04-19 10:01:30 +09:00
Hermet Park
1228f52dc9
renderer/saver: enhanced safety
...
enhanced safety by taking into account the object reference counting.
2024-04-05 01:10:39 +09:00
Hermet Park
7dd709b4b8
saver/tvg: removed an unstable condition.
...
this optimization breaks the scene composition, remove it.
Issue: https://github.com/thorvg/thorvg/issues/1750
2024-01-03 16:45:33 +09:00
Jinny You
2c6c8d3b21
updated copyright date ( #1866 )
2023-12-28 10:43:25 +09:00
Vincent Torri
edf1f56c67
include missing headers for strcmp(), strdup() and realloc()
2023-12-13 10:33:52 +09:00
Hermet Park
0aa39111ad
common/array: code refactoring.
...
Use a default constructor with reservation.
2023-12-13 09:34:44 +09:00
Hermet Park
6d59bc6c66
gif/saver: fix a invalid memory access
2023-11-17 21:28:45 +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
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
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
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
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
JunsuChoi
d03bf7a089
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-11-02 17:50:27 +09:00
Hermet Park
d3c60955fa
tvg: revise the tvg binary format for 1.0 release
...
- The TVG binary format now consistently compresses the data.
- Removed redundant internal properties as part of this change.
Please note that this change will break compatibility with the TVG file format from version 1.0 onward.
Issue: https://github.com/thorvg/thorvg/issues/1372
2023-11-02 11:58:23 +09:00
Hermet Park
d879e56856
saver: Revised the API for the 1.0 release
...
replaced the 'compress' option with 'quality'
API changes:
Result Saver::save(std::unique_ptr<Paint> paint, const std::string& path, bool compress) ->
Result Saver::save(std::unique_ptr<Paint> paint, const std::string& path, uint32_t quality = 100)
TVG_API Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, bool compress) ->
Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, uint32_t quality)
Issue: #1372
2023-11-02 11:58:23 +09:00
Mira Grudzinska
25a1321243
common: stroke dash offset support with new apis.
...
This change just allows users to use the offset of the stroke dash.
Actually feature enhacement has been introduced by
478e45f9f3
.
@APIs:
uint32_t Shape::strokeDash(const float** dashPattern) ->
uint32_t Shape::strokeDash(const float** dashPattern, float* offset = nullptr)
Result Shape::strokeDash(const float* dashPattern, uint32_t cnt) ->
Result Shape::strokeDash(const float* dashPattern, uint32_t cnt, float offset = 0.0f)
Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt) ->
Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt, float offset)
Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt) ->
Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt, float* offset)
@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-10-30 11:47:51 +09:00
Hermet Park
db55481e97
renamed stroke apis family.
...
float Shape::stroke(float width) -> float Shape::strokeWidth(float width)
Result Shape::stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) -> Result Shape::strokeFill(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255)
Result Shape::stroke(std::unique_ptr<Fill> f) -> Result Shape::strokeFill(std::unique_ptr<Fill> f)
Result Shape::stroke(const float* dashPattern, uint32_t cnt, float offset = 0.0f) -> Result Shape::strokeDash(const float* dashPattern, uint32_t cnt, float offset = 0.0f)
Result Shape::stroke(StrokeCap cap) -> Result Shape::strokeCap(StrokeCap cap)
Result Shape::stroke(StrokeJoin join) -> Result Shape::strokeJoin(StrokeJoin join)
Result Shape::strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const -> Result Shape::strokeFill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const
@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-10-27 11:46:51 +09:00
Hermet Park
74b67919e0
tvg: support radial gradient focal properties
...
properly store/restore the radial gradient focal properties
from the tvg loader and saver
2023-09-26 13:05:27 +09:00
Hermet Park
ed23b432bb
tvg: support dash offset property
...
properly store/restore the dash offset property
from the tvg loader and saver
Issue: https://github.com/thorvg/thorvg/issues/1617
2023-09-26 13:05:27 +09:00
Hermet Park
e0d1c947e6
infra: renamed the files for the consistency.
2023-09-04 17:26:43 +09:00
Hermet Park
e7d29e166b
loaders: unify duplicated b64 decoders.
...
- move the svg/lottie b64 decoders to tvgLzw.
- renames tvgLzw -> tvgCompressor
2023-08-17 21:28:58 +09:00
Hermet Park
9e0a3aa678
loader lottie: tiny data copy optimization.
...
This patch tries to skip the matrix data copy as possible.
2023-08-15 15:48:48 +09:00
Hermet Park
c0cb8c0ce8
apis: remove a beta api.
...
- const uint32_t* Picture::data(uint32_t* w, uint32_t* h) const
Returning pixel data is not guaranteed as the picture may contain vector resources.
Remove it unless it's absolutely necessary.
@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-08-08 10:47:37 +09:00
Hermet Park
3e8225a5ba
common math: promote matrix functions.
...
comparing matrices is a common mathmatical operation.
2023-07-28 21:57:40 +09:00
Hermet Park
a74062d5f1
loader tvg: add missing strokeFirst property.
...
tvg binary missed the stroke order,
this patch implements the missing condition.
@Issue: https://github.com/thorvg/thorvg/issues/1499
2023-07-28 21:57:40 +09:00
Hermet Park
b876427325
common array: revise the interface.
...
Implement a pair of access methods: last() and first().
2023-06-29 20:40:16 +09:00
Hermet Park
4482664740
common array: ++enhance the usability.
...
+ end() which indicates the end of the data pointer.
2023-06-26 14:58:30 +09:00
Hermet Park
bd87f1398c
common array: ++enhance the usability.
...
add last() which indicates the last element pointer.
2023-06-23 16:49:39 +09:00
Hermet Park
075e3e6b2a
tvg: support stroke miterlimit property.
...
implement the miterlimit property that was introduced by
44a750ee5d
@Issue: https://github.com/thorvg/thorvg/issues/1490
2023-06-14 10:46:12 +09:00
Hermet Park
8398fdbca7
tvg: recover the broken compatibility.
...
The issue was introduced by b214fd23bc
2023-06-13 12:23:17 +09:00
Hermet Park
9d9f38c875
common: code refactoring
...
Replace standard casting with tvg::cast()
2023-05-15 12:07:55 +09:00
Mira Grudzinska
77114a8ac8
tvg_saver: fixing unwanted merging
...
Similar shapes are merged to improve
performance. This should not be the case
with a semi-transparent fill, different
shapes' fill-rule or fill-rule set to evenodd.
@Issue: https://github.com/thorvg/thorvg/issues/1440
2023-05-11 01:57:19 +09:00
Mira Grudzinska
bce5aef068
tvg_saver: fixing file opening mode
...
Opening files in text mode on windows can
cause issues. Fixed by changeing the mode
to binary.
@Issue: https://github.com/thorvg/thorvg/issues/957
@Issue: https://github.com/thorvg/thorvg/issues/1380
2023-04-27 23:35:32 +09:00
Hermet Park
084e78d98d
common: code refactoring for the IteractorAccessor.
...
The instantiation of the accessor is unnecessary
as it does not require any internal context.
Simplifying its usage would be beneficial.
2023-04-07 18:24:24 +09:00
Hermet Park
b2692484b7
infra - add 'all' option for savers.
...
ex) meson . build -Dsavers="all", ...
2023-04-07 13:54:29 +09:00
Hermet Park
9b3c34c3b1
updated copyright.
2023-01-14 13:48:11 +09:00
Hermet Park
d958fc7971
saver/loader tvg: support picture mesh properties.
...
this mesh properites newly introduced in v0.8
(see: 3dd65dfed0
)
tvg saver/loader should implement mesh support to
properly capture/replay the scene snapshot.
@Issue: https://github.com/Samsung/thorvg/issues/1242
2022-12-08 22:29:29 +09:00
Omar Polo
53074d250f
fix OpenBSD compile issue
...
Linux seems the only system AFAICS to have alloca.h. All the BSDs have
the declaration in stdlib.h
2022-07-13 10:28:46 +09:00
Rémi Verschelde
becb70f09d
Cleanup FreeBSD preprocessor checks (if vs ifdef)
...
Should be equivalent but checking if the value is defined (`#ifdef`) is cleaner
than checking if it is set to something different from 0 (`#if`).
2022-05-24 10:32:53 +09:00
Hermet Park
0e8cd1e525
fix FreeBSD compile issue.
...
alloca is defined in stdlib.h on [freeBSD](https://www.freebsd.org/cgi/man.cgi?alloca )
additional fix to 75c1314ab0
2022-05-17 22:05:10 +09:00
Rémi Verschelde
0c6c37b616
build: Add missing <cstring> includes for MinGW compatibility
2022-01-19 16:40:30 +09:00
Hermet Park
f0141e63de
updated copyright date.
2022-01-12 14:08:48 +09:00
Michal Maciola
282b9288ab
all: fix compilation errors on non-windows clang
...
Thorvg couldn't be compiled on macos as non-portable microsoft calls used.
Changed definitions checking to Visual Studio only.
2021-11-17 20:55:26 +09:00
Hermet Park
0fcdba8a4b
common math: code refactoring
...
introduced mathZero(), mathEqual() for floating variables.
2021-11-15 17:10:54 +09:00
Mira Grudzinska
14c1562b36
tvg_saver: fix memory leaks
...
In the cae when Result::InsufficientCondition was retured by the save()
api, the user had to remember to delete the passed paint - fixed.
Also path was not released.
2021-11-09 20:15:06 +09:00