Commit graph

66 commits

Author SHA1 Message Date
Hermet Park
24711e485c infra: renames the source folders
lib -> renderer
bin -> tools
utils -> common
2023-08-28 13:11:24 +09:00
Hermet Park
07069f6640 loader/lottie: introduce chaining maskings more effectively. 2023-08-28 11:55:17 +09:00
Hermet Park
624b275628 sw_engine: improve the masking methods
Corrected subtract/intersect masking behaviors that were inaccurately functioning
within chain-masking.

This also helps to enhance the masking performance by reducing the
masking region when applying subtract/intersect.

@Issue: https://github.com/thorvg/thorvg/issues/1606
2023-08-28 11:55:01 +09:00
Hermet Park
c50d2fde5f common sw_engine: support blending methods.
The blending feature allows user to combine colors to create visually appealing effects,
including transparency, lighting, shading, and color mixing, among others.

Its process involves the combination of colors or images from the source paint object
with the destination (the lower layer image) using blending operations.

The blending operation is determined by the chosen @p BlendMethod,
which specifies how the colors or images are combined.

@APIs:
 - enum class BlendMethod::Normal, Add, Screen, Multiply, Overlay, Lighten, Difference, Exclusion, SrcOver, Darken, Lighten, ColorDodge, ColorBurn
 - BlendMethod Paint::blend() const noexcept;
 - Result Paint::blend(BlendMethod method) const noexcept;

@Issue: https://github.com/thorvg/thorvg/issues/307

Co-authored-by: Peter Vullings <peter@projectitis.com>
Co-authored-by: Hermet Park <hermetpark@lottiefiles.com>
2023-06-20 11:30:18 +09:00
Hermet Park
eea54f5fea sw_engine: code chores & fix gradient filling bugs.
renaming internal methods for integrating with upcoming blending features.
this also fixes minor wrong gradient filling blending equations.
2023-06-20 11:30:18 +09:00
Hermet Park
b60a291edc sw_engine: code refactoring
Removed the fake blender structure.
Unified matting and join as Surface methods.
2023-06-20 11:30:18 +09:00
Hermet Park
814d87626c common engines: optimizing data packing for compactness.
Standardized the opacity data type to use 1 byte
across all instances to maintain consistency and reduce scattered usage.
2023-06-15 10:35:34 +09:00
Hermet Park
3399da198f sw_engine fill: code clean up.
eliminate logic duplication by introducing direct blend operation.
2023-06-05 16:52:57 +09:00
Hermet Park
86d287038b sw_engine: minor code clean up
keep code consistency, no logical changes.
2023-05-30 20:07:34 +09:00
Hermet Park
eb8539e0b4 sw_engine fill: optimize linear/radial fill fetching.
Save the separated for-loop by
unifying the blending/composition in one fetching stage.
2023-05-29 09:45:21 +09:00
Hermet Park
ee9b947c0c sw_engine: optimize alpha blending operation.
Compact blending instructions by distinquish the
shape & images. since we gurantee the shape color is
premultiplied alpha.

As a result, this enhanced performance by 0.002s in examples/Performance
on my local machine.

This also contains code cleanup chores.
2023-05-29 09:45:21 +09:00
Hermet Park
9b3c34c3b1 updated copyright. 2023-01-14 13:48:11 +09:00
Rémi Verschelde
46c3fc1f94 Format code files with dos2unix, ensure newline at EOF 2022-07-10 23:21:05 +09:00
Hermet Park
f0141e63de updated copyright date. 2022-01-12 14:08:48 +09:00
Hermet Park
eddaf615c3 sw_engine: code refactoring
unified the two color interpolate methods.
2021-11-25 20:04:37 +09:00
Hermet Park
0fcdba8a4b common math: code refactoring
introduced mathZero(), mathEqual() for floating variables.
2021-11-15 17:10:54 +09:00
Hermet Park
c3a29bd648 common math: code refactoring
introduce common math functions to improve the reusability.
2021-11-04 17:11:27 +09:00
Mira Grudzinska
a9990be54c sw_engine: incorrect matrix used
The invTransform should be used instead of transform - missed during
all the gradient changes.
2021-10-29 15:04:52 +02:00
Mira Grudzinska
5ca50a28a2 sw_engine: variables names changed
Rasial gradient variables names changed to be more descriptive.
2021-10-29 10:55:06 +09:00
Mira Grudzinska
07c42cb32d sw_engine: gradient transformation combined with the shape transformation
The gradient transformation has to be included in the last step
of gradient preparation (and combined with a shape transformation).
2021-10-29 10:55:06 +09:00
Mira Grudzinska
ae3d1e1b80 sw_engine: proper radial gradient transformation 2021-10-29 10:55:06 +09:00
Mira Grudzinska
8cfe4ef708 sw_engine: including gradient transformation into gradient preparation
The gradient transformation has to be taken into account as the last
step of the gradient preparation.
2021-10-25 19:31:38 +09:00
Mira Grudzinska
7b778cd878 sw_engine: proper linear gradient transformation
In the case of any shape transformation, the gradient fill
was not correct.
2021-10-25 19:31:38 +09:00
Hermet Park
36270f588e common: replace the id() -> identifier() 2021-10-22 18:47:05 +09:00
Mira Grudzinska
a16e91b441 all: fix compiler warnings
pow->powf and sqrt->sqrtf
2021-10-07 14:49:00 +09:00
Hermet Park
44768e7125 sw_engine: fix compiler a warning
handle them double type values.
2021-09-24 12:13:11 +09:00
Mira Grudzinska
4589196689
common: preventing msvc compiler warnings (#817) 2021-09-20 13:54:06 +02:00
Hermet Park
b13dec31cd common: code refactoring
unify tvg class identifiers
2021-07-19 20:12:14 +09:00
Hermet Park
925b9c8ba9 sw_engine fill: correct the range of opacity,
also some minor code refactors.
2021-07-06 10:44:56 +09:00
Mira Grudzinska
a40d3f6fd7 sw_engine: stop-opacity value should be interpolated between stops
The opacity value is interpolated as are all color channels.
It's similar to the reverted commit ac95433, but with two slight changes
(alpha_blend was missing in the ctable init and 'a' was used in an if
statement instead of 'a2').
2021-07-06 10:33:02 +09:00
Hermet Park
e1eabf7dc3 Revert "sw_engine: stop-opacity value should be interpolated between stops"
This reverts commit ac95433b53.

Ahh this breaks examples/images/rg1024_eggs.svg
2021-07-01 17:34:59 +09:00
Mira Grudzinska
ac95433b53 sw_engine: stop-opacity value should be interpolated between stops
The opacity value is interpolated as are all color channels.
2021-06-30 19:32:52 +09:00
Mira Grudzinska
a0f28d0db4 sw_engine fill: fixing gradient calculations for 'repeat' spread value
There was a call to the ctable element from outside its boundaries, because
the check was misplaced.
2021-06-23 13:01:10 +09:00
Mira Grudzinska
d999a05750 sw_engine: 'inv2a' variable from the SwRadial struct replaced by 'inva'
This change reduces the number of multiplications in the fillFetchRadal function.
2021-05-18 11:38:57 +09:00
Mira Grudzinska
8284b3fdfc sw_engine: removed unnecessary function parameter
In the fillFetchLinear function the offset parameter was removed.
The destination address may be shifted directly in the dst parameter,
it doesn't need to be passed separately.
2021-04-08 13:54:38 +09:00
Hermet Park
1a7d41ce71 updated copyright 2021-03-23 14:31:58 +09:00
Hermet Park
0984241954 sw_engine fill: correct value loss by data conversion. 2021-03-11 20:10:11 +09:00
Mira Grudzinska
07e6c476a8 sw_engine fill: fixing the infinite loop condition
Fixed in the fillFetchLinear() function.
2021-03-03 17:46:33 +09:00
Hermet Park
d522c9d45e
sw_engine fill: fix wrong gradient transformation
There transformation logic was not identical between shape & gradient

gradient transform was applied into center of gradient world,
while shape wasn't. So... we correct gradient transform metric to shape like.

@Issues: 255
2021-03-03 10:53:32 +09:00
JunsuChoi
08c37978a9 common: Pointer that can declare const are refactored to use const
Pointer and reference parameters should be "const" if the corresponding object is not modified
2021-02-19 16:51:50 +09:00
Hermet Park
cfa2d187bf
sw_engine: apply opacity to graident fill case.
previously, opacity value is ignored to gradient fill.

This patch implements that case.
2020-12-30 12:38:32 +09:00
Hermet Park
7d9023ac5c common sw_engine: code refactoring
Renamed internal interfaces.

We need both blender & compositor interfaces.

Renamed SwCompositor -> SwBlender which is for pixel joining methods.

Added (SwCompositor, Compositor) which is designed for compositing images.
2020-12-25 20:54:56 +09:00
Hermet Park
740c59debd sw_engine: code refactoring.
clean code for compaction.
2020-10-07 10:36:59 +09:00
Mateusz Palkowski
3314df89ae gradient: added check for gradient start and end set for 0 2020-10-07 10:28:41 +09:00
Hermet Park
6365d02a96 optimization: cut off file dependencies.
we should avoid code insertion during file dependencies,
such as #include "xxx.h" which has implementations.

This could increase binary size, we can avoid it as possible.

Current patch improves binary size like this:

From: file(2059008) = text(120360) data(8096) bss(80) dec(128536)
To  : file(1921832) = text(118429) data(7872) bss(56) dec(126357)

More additional patches will come in to optmize binary size.
2020-09-23 20:57:30 +09:00
Hermet Park
ac90ea302d sw_engine: fix build warning
warning: absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value [-Wabsolute-value]
2020-09-15 12:32:22 +09:00
Hermet Park
04c6295974 code refactoring
remove unnecessary condition.
implementation won't be included multiple times not like headers.

Thus this condition is unnecessary.

Change-Id: Id37e675c40ce7213a06c950da8e5ca17ff7245c9
2020-08-20 16:16:46 +09:00
Hermet Park
06d8d06993 sw_engine: replace rgba8888 with abgr8888
Actually Dali rendering system requires abgr8888.

We could add more colorspaces if it's necessary.

Change-Id: Ia42a6575d1313629e55efc3077e302992c47b6c0
2020-08-19 18:39:23 +09:00
Hermet Park
ffa4a7248b code refactoring
Now, stabilizing is pretty enough.

Remove assert code so that we never abort process in any cases.
This also reduce the binary size.

Change-Id: Ia7d2d5c5a0757b12481eaebad7a86aade6a89c1e
2020-08-19 14:53:38 +09:00
Hermet Park
70b4703707 remove print/cout logs.
we need a comprehensive logging interface for this.

right now, leave as "LOG:" to replace later.

Change-Id: I25321223cd48ec13a1de5e4140cfea75a2f42866
2020-08-18 20:35:13 +09:00