Commit graph

15 commits

Author SHA1 Message Date
Hermet Park
7968b9668e sw_engine: fixed a broken dropshadow
corrected a mismatched stride value of the
direct drawing target buffer.

issue: https://github.com/thorvg/thorvg/issues/3146
2025-03-12 02:10:32 +01:00
Hermet Park
89e98b6fcb sw_engine: Improved the blur performance by 12%
Applied the compromised approach for the gaussian blur
since the effect is a bit burdensome for cpu processing
as animatable effects.

- Optimized performance and quality with negligible observable differences.
- Disabled the border option until specific use cases are identified.
2025-01-30 20:24:20 +09:00
Hermet Park
819b93a9a4 renderer: improved engine for scalable effects
RenderMethod effects methods would have changes:
 + update()               //update the effects if any
 - prepare() -> region()  //update the effect drawing region
 - effect() -> render()   //draw the effect
2025-01-30 20:23:39 +09:00
Hermet Park
bed521a08c common: refactored the scene effect tint
Pre-convert the data type from float to uint8_t
2025-01-02 13:10:31 +01:00
Hermet Park
5131a8ba92 renderer: support Trintone SceneEffect
The Tritone effect maps the scene's shadows, midtones, and highlights
to three specific colors, allowing for more complex and artistic color grading.

Applied Tritone Formula:
if (L < 0.5) Result = (1 - 2L) * Shadow + 2L * Midtone
else Result = (1 - 2(L - 0.5)) * Midtone + (2(L - 0.5)) * Highlight
Where the L is Luminance.

issue: https://github.com/thorvg/thorvg/issues/2718
2024-12-20 00:38:15 +01:00
Hermet Park
4050d86f2e common: support Tint SceneEffect
The Tint effect in ThorVG is used to modify the overall color tone of a scene.
It works by blending a specified tint color with the existing colors of the scene.
This effect is useful for color grading, mood changes, or applying thematic filters
to vector graphics and animations.

Applied the equation is:
Result = (1 - L) * Black + L * White, where the L is Luminance.

issue: https://github.com/thorvg/thorvg/issues/2718
2024-12-20 00:35:40 +01:00
Hermet Park
adf32b5628 sw_engine: --compiler warnings on MSYS2
comparison of integer expressions of different signedness: 'uint32_t' {aka 'unsigned int'} and 'long int' [-Wsign-compare]
2024-12-19 16:18:49 +01:00
Hermet Park
5c129472ff renderer: add a new scene effect type - Fill
Fill is used for overriding the scene content color
with a given fill information. It's yet an Experimental API.

issue: https://github.com/thorvg/thorvg/issues/2718
2024-12-19 16:12:28 +01:00
Hermet Park
f05ee1ca63 renderer/sw_engine: fix omitted alpha multiplication in the dropshadow effect
When a scene has a valid opacity, it must be multiplied with the
direct dropshadow image to ensure correct rendering.
2024-11-26 01:19:28 +09:00
Hermet Park
f0d4e7a7c7 sw_engine: hotfix range broken
hotfix for release. need to review the logic again
2024-11-26 01:17:36 +09:00
Hermet Park
2324f6e75d renderer: support SceneEffect DropShadow
Apply a drop shadow effect with a Gaussian Blur filter.

API Addition:
 - enum class SceneEffect::DropShadow

Parameters:
 - color_R(int)[0 - 255]
 - color_G(int)[0 - 255]
 - color_B(int)[0 - 255]
 - opacity(int)[0 - 255]
 - angle(float)[0 - 360]
 - distance(float)
 - blur_sigma(float)[> 0]
 - quality(int)[0 - 100]

issue: https://github.com/thorvg/thorvg/issues/2718
2024-11-26 01:16:37 +09:00
Hermet Park
4d8c0e9a64 sw_engine: corrected the blur feathering region.
issue: https://github.com/thorvg/thorvg/issues/2892
2024-11-01 17:30:42 +09:00
Hermet Park
43cdd4c7ec lottie: Fine-tune for post-processing effect.
reduce quality for the post-processing effect to
improve general performance, while fine-tuning the quality
for lower resolutions.
2024-10-22 00:39:06 +09:00
Hermet Park
2972a631bd sw_engine: applied OpenMP to improve post-processing performance.
- OpenMp threads will be allocated alongside the TaskSculeduler::threads()
- Performance improved by 2x in a specific animation.
- Disable the thread feature in the Android build test due to system issues with OpenMP compilation.
2024-09-30 16:44:22 +09:00
Hermet Park
ad7c65d2ea renderer: introduced SceneEffect feature
Scene effects are typically applied to modify
the final appearance of a rendered scene,
such as adding a blur effect.

Each effect would have a different number of parameters
to control its visual properties. The Scene::push() interface
 uses variadic arguments to accommodate various cases.

Users should refer to the SceneEffect API documentation
and pass the parameters exactly as required for the specific
effect type. For instance, GaussianBlur expects 3 parameters
which are:

- sigma(float)[greater than 0]
- direction(int)[both: 0 / horizontal: 1 / vertical: 2]
- border(int)[extend: 0 / wrap: 1]
- quality(int)[0 ~ 100]

and, scene->push(SceneEffect::GaussianBlur, 5.0f, 0, 0, 100);

New Experimental APIs:
- SceneEffect::ClearAll
- SceneEffect::GaussianBlur
- Result Scene::push(SceneEffect effect, ...);

Example:
- examples/SceneEffect

issue: https://github.com/thorvg/thorvg/issues/374
2024-09-30 16:44:22 +09:00