platform/core/graphics/tizenvg.git
3 years agocapi: Added doxygen comments and doxygen config file.
Michal Szczecinski [Tue, 19 Jan 2021 20:48:30 +0000 (21:48 +0100)]
capi: Added doxygen comments and doxygen config file.

Change-Id: I2ffa5d201d6af4fe0fd353ed04736638fcf9bf19

3 years agocommon picture: fix minor logic.
Hermet Park [Wed, 20 Jan 2021 14:29:15 +0000 (23:29 +0900)]
common picture: fix minor logic.

missing nulling pointer,
also return value properly.

3 years agocommon canvas: fix non-updated paints.
Hermet Park [Wed, 20 Jan 2021 13:57:29 +0000 (22:57 +0900)]
common canvas: fix non-updated paints.

When shapes are poped from canvas while retaining shapes instances,
they have no chances to redraw after pushed again due to missing flag.

This patch fixes it by forcely updating flag on pushing time.

@Issues: 181

3 years agocommon paint: duplicate composition target. submit/tizen/20210117.211744
Hermet Park [Sun, 10 Jan 2021 14:34:22 +0000 (23:34 +0900)]
common paint: duplicate composition target.

composition target also copied in duplication.

added missing part.

Change-Id: I3ea084de1b5b27f72a80f34c74580d12b0962cc4

3 years agosw_engine composition: enhance image masking
Hermet Park [Sun, 10 Jan 2021 11:37:20 +0000 (20:37 +0900)]
sw_engine composition: enhance image masking

composition alpha masking supports scene/paints targets.

@Examples: Masking

@Issues: 31

Change-Id: I7aed18172fab54a2e31ccf8894fcb6fb6925a8a8

3 years agosw_engine: optimize raster image.
Hermet Park [Sun, 10 Jan 2021 10:54:05 +0000 (19:54 +0900)]
sw_engine: optimize raster image.

added a routine that draw non-transformed translucent image.
composition images will use this routine to draw faster.

Also added optimization point comments in raster image.

Change-Id: Ibffb6b9fe06d39b5e1ba342f693f9fc64ccb7314

3 years agocommon paint: code refactoring.
Hermet Park [Sun, 10 Jan 2021 08:53:16 +0000 (17:53 +0900)]
common paint: code refactoring.

remove the opacity argument in the render method.

Considered again, this opacity value is not commonly used yet.
we can introduce it when it's necessary.

Change-Id: I1acaab3b46c9269fa72e1cb9d92d0667d203d3fd

3 years agosw_engine renderer: fix invalid rle issue.
Hermet Park [Sun, 10 Jan 2021 08:24:55 +0000 (17:24 +0900)]
sw_engine renderer: fix invalid rle issue.

if shape rendering is failed, all the prepared data must be reset
because those are invalid.

@Issues: 180

Change-Id: Iaa187d1fac1e3f4fa0106d0b5e499cac0c7ef207

3 years agocommon sw_engine: revise the masking implementation. accepted/tizen/unified/20210112.123540 submit/tizen/20210110.221552
Hermet Park [Sun, 3 Jan 2021 15:46:59 +0000 (00:46 +0900)]
common sw_engine: revise the masking implementation.

We re-implement the masking feature with image composition method.

This patch is working only for single shape but settle up coming extensions.

3 years agocommon: keep consistency file permissions => 664 accepted/tizen/unified/20210104.130303 submit/tizen/20210103.044544 submit/tizen/20210103.212140
Hermet Park [Wed, 30 Dec 2020 04:25:38 +0000 (13:25 +0900)]
common: keep consistency file permissions => 664

Change-Id: I9acae8d5e75f05a3d2d741855724062c76f83725

3 years agogl_engine: fix coding convention.
Hermet Park [Wed, 30 Dec 2020 03:40:54 +0000 (12:40 +0900)]
gl_engine: fix coding convention.

no logical changes.

Change-Id: I3daa0840e1b49bb6344e1137434d0d5f5ebe1aee

3 years agoCapi: Shape bounds binding
mmaciola [Wed, 30 Dec 2020 03:40:03 +0000 (04:40 +0100)]
Capi: Shape bounds binding

Change-Id: I25d7abb67b71007be3aa86d70c6fb1c73af08caf
Co-authored-by: Michal Maciola <m.maciola@samsung.com>
3 years agosw_engine: apply opacity to graident fill case.
Hermet Park [Wed, 30 Dec 2020 03:38:32 +0000 (12:38 +0900)]
sw_engine: apply opacity to graident fill case.

previously, opacity value is ignored to gradient fill.

This patch implements that case.

Change-Id: Iaaba617659e708d1484ca9b2256395397cc95a33

3 years agocommon gl_engine: transformation support
pankajkumar20 [Wed, 30 Dec 2020 03:23:22 +0000 (08:53 +0530)]
common gl_engine: transformation support

support transformation of shapes some partial cases.

Change-Id: Ib2ca857dfda26cf63d9548af9f584a2152eaf363

3 years agosw_engine renderer: fix a regression bug.
Hermet Park [Sun, 27 Dec 2020 15:22:24 +0000 (00:22 +0900)]
sw_engine renderer: fix a regression bug.

recover a broken shape+stroking opacity that introduced in ealier refactoring...

Change-Id: Ie40bd81c06d094118c34a1686adb57a91c4330ce

3 years agoexample ClipPath: ++coverage
Hermet Park [Sun, 27 Dec 2020 15:19:51 +0000 (00:19 +0900)]
example ClipPath: ++coverage

Apply gradient usage in clip path.

Change-Id: I6e520fba896ed2f75089acc73a2f5fe20fc82e5e

3 years agocommon sw_engine: code refactoring
Hermet Park [Fri, 25 Dec 2020 11:44:07 +0000 (20:44 +0900)]
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.

Change-Id: I1eff72e5fe719b6e8b49c22dda53c0a365c6a2a0

3 years agotools format: remove tizen specific
Hermet Park [Fri, 25 Dec 2020 11:05:42 +0000 (20:05 +0900)]
tools format: remove tizen specific

When ready, we will use this c++ formatter...

Change-Id: I12a66e1ea1f9946c964acd39b5212b1ad5c26cd1

3 years agocommon composite: code refactoring
Hermet Park [Fri, 25 Dec 2020 10:47:01 +0000 (19:47 +0900)]
common composite: code refactoring

Splited out ClipPath routine from other pixel compositions'
since yet it's unlikely compatible...

Also revise internal engine interfaces to be simpler.

This is a step forward to enhance masking feature.

Change-Id: Ic86983f0701defd6ef4c9cc4b7bb795753b0266e

3 years agocommon shape: code refactoring
Hermet Park [Wed, 23 Dec 2020 06:37:38 +0000 (15:37 +0900)]
common shape: code refactoring

don't convert data type(float-double) during computation.

Change-Id: Iaeb2d1de54505456bb0e5ae6f587b99fa2022154

3 years agosw_engine shape: expand the algorithm to draw arcs with negative angles
Mira Grudzinska [Tue, 22 Dec 2020 12:12:58 +0000 (13:12 +0100)]
sw_engine shape: expand the algorithm to draw arcs with negative angles

The _appendArc function allows to draw angles only in a clockwise direction.
The introduced improvement allows to change this direction by giving the 'sweep' argument
with a negative value.

Change-Id: I2546f4d5214d315dff33e7ed4161848af1f0b0b3

3 years agosw_engine renderer: fix wrong conditional check.
Hermet Park [Tue, 22 Dec 2020 02:09:48 +0000 (11:09 +0900)]
sw_engine renderer: fix wrong conditional check.

unsigned int won't be less than 0.

Change-Id: Ib9462f2d11168d794e93a66ea052c1fb6e05ebd5

3 years agosvg_loader: fixed wrong boundary check
Hermet Park [Tue, 22 Dec 2020 02:03:13 +0000 (11:03 +0900)]
svg_loader: fixed wrong boundary check

sz must be less than 20 to append 'carriage return'

Change-Id: Idee7610af58082e18edaf4db30e06566d2600ac2

3 years agoraw_loader: remove unnecessary declaration.
Hermet Park [Tue, 22 Dec 2020 01:55:23 +0000 (10:55 +0900)]
raw_loader: remove unnecessary declaration.

Change-Id: Ifc284ef639649b8f2a9e336ef192dadf7e3bb7ed

3 years agosw_engine raster: fix incorrect condition check.
Hermet Park [Tue, 22 Dec 2020 01:46:51 +0000 (10:46 +0900)]
sw_engine raster: fix incorrect condition check.

These values won't be less than zero since they are unsigned types.

Change-Id: I8b6e4c2c7fed230fd25cc43614ac0cb8148b6ac4

3 years agocommon shape: ++safety
Hermet Park [Tue, 22 Dec 2020 01:42:11 +0000 (10:42 +0900)]
common shape: ++safety

null check after memory allocation.

Change-Id: I38c8021442e9eed5059143e1655256f2cd353b3d

3 years agosw_engine log: adding missed line wrap.
Hermet Park [Mon, 21 Dec 2020 09:38:12 +0000 (18:38 +0900)]
sw_engine log: adding missed line wrap.

Change-Id: Iabaee4fd0336ae0e44e812afbaed95f66dcc72a7

3 years agosw_engine log: + log clipPath case.
Hermet Park [Mon, 21 Dec 2020 09:35:11 +0000 (18:35 +0900)]
sw_engine log: + log clipPath case.

These functions are one of special compositions.

Change-Id: I5f992ddec04d0cde064dede1465c4658a25862d1

3 years agosvg_loader SvgLoader: Add memory allocation failed check
JunsuChoi [Fri, 18 Dec 2020 03:20:01 +0000 (12:20 +0900)]
svg_loader SvgLoader: Add memory allocation failed check

Prevent to null access when out of memory.

Change-Id: If322dfbcb91c3d5549d849702b174e1d71fd0242

3 years agoraw_loader RawLoader: Add initialize
JunsuChoi [Fri, 18 Dec 2020 02:08:42 +0000 (11:08 +0900)]
raw_loader RawLoader: Add initialize

Add initialization to 'copy' member

Change-Id: Ie593ceb1ae0d0c8368bd1ce720e2ce565ef3dbb4

3 years agosvg_loader SvgLoader: Prevent array overflow
JunsuChoi [Fri, 18 Dec 2020 02:05:22 +0000 (11:05 +0900)]
svg_loader SvgLoader: Prevent array overflow

Since tagName array set '\0' at the end,
it may overflow when sz reaches 20.
So make it a maximum of 19.

Change-Id: I26e85aa8a3b7e2aad1ec849d14a8b4da6e1bcbf7

3 years agoinc header: remove unnecessary declaration.
Hermet Park [Fri, 18 Dec 2020 10:24:36 +0000 (19:24 +0900)]
inc header: remove unnecessary declaration.

This log tag is not used. We can introduce it when it's necessary.

Change-Id: I8fb8fcd5f006b44d2339dd999c474577be6e17be

3 years agoexamples mask: revise the example code.
Hermet Park [Fri, 18 Dec 2020 10:21:34 +0000 (19:21 +0900)]
examples mask: revise the example code.

Yet, this isn't work properly but it supposed to do

We need to fix alpha mask logic.

Change-Id: I1cef63c96663e35214e995c81c140d2cc0266bbc

3 years agocommon sw_engine: fix build break.
Hermet Park [Fri, 18 Dec 2020 08:44:59 +0000 (17:44 +0900)]
common sw_engine: fix build break.

some wrong merge conflicts left. resolve them.

Change-Id: I3f0a04fcf72089c7b0637347b4b05c90b51fbeae

3 years agocommon composition: support Masking method
Patryk Kaczmarek [Fri, 18 Dec 2020 08:40:54 +0000 (09:40 +0100)]
common composition: support Masking method

New feature - CompositeMethod::MaskAlpha

Newly Support AlphaMask. but it's unstable.

@Issues: 31

Change-Id: I86827870ed0c040ffc676569df13f4bd8c6e9348

3 years agosvg_loader XmlParser: code refactoring. submit/tizen/20201220.213638
Hermet Park [Thu, 17 Dec 2020 07:11:09 +0000 (16:11 +0900)]
svg_loader XmlParser: code refactoring.

just renamed _nodeTypeToString() -> xmlParserNodeTypeToString()

+ print meson message if log is enabled.

Change-Id: Ic7593daaad93518d9a77d3bccdf3fbb6d802ca8d

3 years agosvg_loader SvgLoader: Print inefficient elements
JunsuChoi [Thu, 17 Dec 2020 04:03:52 +0000 (13:03 +0900)]
svg_loader SvgLoader: Print inefficient elements

Opacity is 0
both Fill.Opacity and Stroke Opacity are 0
point is 0 in Path
declared display="none"
width or height of bounds becomes 0

Change-Id: I99f49551d7f70d9066493607e3eb5c98fd64c08f

3 years agofix typo
Shinwoo Kim [Tue, 15 Dec 2020 08:58:09 +0000 (17:58 +0900)]
fix typo

Change-Id: I78d025c6cc6d0a6949f5050385fa6333967ddcaf

3 years agofix mistake
Shinwoo Kim [Tue, 15 Dec 2020 09:01:01 +0000 (18:01 +0900)]
fix mistake

Change-Id: If23aa5db27617b1e11105ad9b56eea311c84061b

3 years agowasm: update picture size for file loading
Shinwoo Kim [Tue, 15 Dec 2020 08:16:33 +0000 (17:16 +0900)]
wasm: update picture size for file loading

The width and height was not changed, if there is newly loaded file.
As a result, the scale was not correct after loading a file.

Change-Id: I7a0cd943228f985447458527234467a794264b0e

3 years agowasm: work with log option
Shinwoo Kim [Tue, 15 Dec 2020 07:21:18 +0000 (16:21 +0900)]
wasm: work with log option

The wasm is using the ThorVG output starting whith "SVG:" to show
unsupported element and attribute of svg file.
This patch updates wasm_build.sh to make ThorVG prints log,
and removes build errors.

  - Following commit needs to include 'algorithm'
    1ed6113 common sw_engine: code refactoring & stabilizing.

  - Following commit needs to include 'string'
    5481633 svg_loader XmlParser: Print unsupported elements, ...

Change-Id: I46bee4588d84b2a647455ac831644f88d2e358cb

3 years agocommon log: notify opacity composition usage log.
Hermet Park [Tue, 15 Dec 2020 05:29:52 +0000 (14:29 +0900)]
common log: notify opacity composition usage log.

replaced [XXX] log prefix with XXX:

Change-Id: I75959711d8baed70cc723c3b1672b68e48bc5cf7

3 years agosvg_loader XmlParser: Print unsupported elements, attribute with log option
JunsuChoi [Mon, 14 Dec 2020 05:02:24 +0000 (14:02 +0900)]
svg_loader XmlParser: Print unsupported elements, attribute with log option

* Using printf is temporary. We are planning a proper way to print the log.
When parsing a Svg file, Loader print unsupported elements and attributes.

Change-Id: Ib63edf69e7a057e34050f5d8450fa5caddcad082

3 years agoexamples Opacity: Add close method
JunsuChoi [Mon, 14 Dec 2020 07:56:18 +0000 (16:56 +0900)]
examples Opacity: Add close method

Change-Id: Ia9dc20f21e746f82eca54dc7b166bdc829110d46

3 years agocommon sw_engine: apply partial composition.
Hermet Park [Mon, 14 Dec 2020 03:29:37 +0000 (12:29 +0900)]
common sw_engine: apply partial composition.

Introduce RendererMethod::renderRegion() to return acutal drawing region info.

That is used by scene composition to composite actual partial drawing region

for better performance.

@Issues: 173

Change-Id: I5b3bb6cc37c1bc25c6f9f284f13e60da811d267b

3 years agosw_engine renderer: optimize composition data usage. accepted/tizen/unified/20201214.124448 submit/tizen/20201213.212052
Hermet Park [Thu, 10 Dec 2020 10:21:31 +0000 (19:21 +0900)]
sw_engine renderer: optimize composition data usage.

Use cache mechanism for composition data so that we don't reallocate
composition memory several times in one frame rendering.

@Issues: 168

Change-Id: I9b10618855822ae03c8684423683739c6dc248f6

3 years agoexamples Svg: replace a few example svgs.
Hermet Park [Thu, 10 Dec 2020 10:53:40 +0000 (19:53 +0900)]
examples Svg: replace a few example svgs.

Change-Id: I99c44c334492b6f9fc3b9fd614e1e4b8a12519b9

3 years agoexamples capi: fix a memory leak.
Hermet Park [Thu, 10 Dec 2020 05:23:29 +0000 (14:23 +0900)]
examples capi: fix a memory leak.

a shape is not cleaned properly.

@Issues: 178

Change-Id: Ib492fe23726d83b41fdd7b6e97cf68224449b0e5

3 years agosw_engine rle: fix an invalid memory access.
Hermet Park [Thu, 10 Dec 2020 05:16:41 +0000 (14:16 +0900)]
sw_engine rle: fix an invalid memory access.

There is a mistake that over-access boundary.

This fix it.

@Issues: 178

Change-Id: I0f4d9f763eb75ebb16ccb89dedbb356e9833af97

3 years agoloaders: fix memory leak.
Hermet Park [Thu, 10 Dec 2020 02:57:38 +0000 (11:57 +0900)]
loaders: fix memory leak.

While looking for image loader, it occured memory leaks.
Fixed it properly.

@Issues: 178

Change-Id: If09be510b28a0c0374254779fe8a2f82c3251d6d

3 years agosw_engine stroke: fix memory leak.
Hermet Park [Thu, 10 Dec 2020 02:48:08 +0000 (11:48 +0900)]
sw_engine stroke: fix memory leak.

Properly free data after use.

@Issues: 178

Change-Id: I085fd936081c82f9ea4d332979a90fe276d0e0cc

3 years agotools: remove invalid file link.
Hermet Park [Thu, 10 Dec 2020 01:47:08 +0000 (10:47 +0900)]
tools: remove invalid file link.

Change-Id: If6595d2cec8cadf09b152a367196f99445a8236e

3 years agotools: Automatic code format tool added
pkosko [Thu, 10 Dec 2020 01:38:22 +0000 (02:38 +0100)]
tools: Automatic code format tool added

Tool allows auto formatting of code according to Google coding standard
for easier control and fixing formatting issues.

Change-Id: I1103cf899ff7ab0673faba02dbf2b588d1853593

3 years agocommon sw_engine: code refactoring & stabilizing. accepted/tizen/unified/20201210.124547 submit/tizen/20201210.014704
Hermet Park [Wed, 9 Dec 2020 10:56:59 +0000 (19:56 +0900)]
common sw_engine: code refactoring & stabilizing.

Apply tvg Array instead of std::vector

Also Fixed to compList in update() to passed by reference, not copying.
Also Fixed Composition Target memory leak

Here is the binary size result:

[libthorvg.so] 1785376 >> 1607416
[text] 121255 >> 118277
[data] 7792 >> 7736
[dec] 129119 >> 126085

Change-Id: I70ac0148ca69b4f38dd93099eab55259f9d5abe7

3 years agofix typo
Hermet Park [Wed, 9 Dec 2020 05:58:37 +0000 (14:58 +0900)]
fix typo

Change-Id: Iaeb329aff16c13ca6c625d83ee57a3970f991f3a

3 years agocommon array: Introduce Array function to common.
Hermet Park [Wed, 9 Dec 2020 05:48:48 +0000 (14:48 +0900)]
common array: Introduce Array function to common.

This Array is promoted from SvgVector to use it widely in tvg.
It's similar with std::vector, we can use it instead of it.

Also, svg_loader replaced with it subsequently.

Change-Id: I1ddca958508ed7ceae9f173c6f8167b5318e1604

3 years agosvg_loader: code refactoring
Hermet Park [Wed, 9 Dec 2020 05:07:13 +0000 (14:07 +0900)]
svg_loader: code refactoring

Use custom vector data algorithm for optimizing binary size.
Plus remove tuple usage since it leads unnecessary instance copying.

binary size comparison:

[libthorvg.so] 1811400 >> 1785448
[text] 122914 >> 121255
[data] 7824 >> 7792
[dec] 130810 >> 129119

Change-Id: Ie14679c886b42f7db0b4f612e7c6a62eaec8cb7b

3 years agosw_engine renderer: code refactoring.
Hermet Park [Tue, 8 Dec 2020 11:26:06 +0000 (20:26 +0900)]
sw_engine renderer: code refactoring.

Unify Shape+Stroke composition with CompositeCtx which is added for Scene Composition

This fixes clipping issue as well.

@Issues: 164

Change-Id: I34aaffcaea59b170c0ef3746af67294b2354e4d9

3 years agosvg_loader SceneBuilder: No propagate opacity to child accepted/tizen/unified/20201208.123147 submit/tizen/20201208.034059
JunsuChoi [Mon, 7 Dec 2020 08:35:26 +0000 (17:35 +0900)]
svg_loader SceneBuilder: No propagate opacity to child

Scene's opacity() propagates opacity value inside.
Therefore, unnecessary opacity calculation.

Change-Id: Ic7460c21b28aaa8bc1ed81272d63ef2931732b52

3 years agowasm: code refactoring.
Hermet Park [Mon, 7 Dec 2020 07:57:28 +0000 (16:57 +0900)]
wasm: code refactoring.

Use Picture::size() method instead of scale()

Picture newly supports size() method to resize image.
It's more convenient for users in its usage.

Change-Id: I78e7ba4487afc0654c757a6298b705cc3241e76d

3 years agopicture: replace size parameter to float.
Hermet Park [Tue, 8 Dec 2020 03:27:13 +0000 (12:27 +0900)]
picture: replace size parameter to float.

Considering smooth-resizing on sub-pixeling.

Change-Id: I3321e88a92b9af635f6ad3f7eb5bf89f2192f6d6

3 years agosw_engine renderer: fix a crash issue.
Hermet Park [Mon, 7 Dec 2020 10:52:56 +0000 (19:52 +0900)]
sw_engine renderer: fix a crash issue.

This stroking composition condition must be initialized
even when exceptional cases. We moved the condition setting to
handle it always.

Change-Id: I532b5819d3d560f51611c3be06101ecc7c9197a0

3 years agosw_engine renderer: support scene opacity composition 13/249113/1
Hermet Park [Mon, 7 Dec 2020 06:45:44 +0000 (15:45 +0900)]
sw_engine renderer: support scene opacity composition

this is an additional enhancement of af8c278c5e2a47c21f44440cdb0a7aaf6f6d3baa

Now scene opacity composition is supported.

Also, this implementaion fixes an incorrect scene bounding box computation.

Plus, adding stroking feathering to shape bounding box size.

Change-Id: Ic74f2667ca1858b32b67135b3da0354fd2f6bfc5

3 years agocommon picture: revise resize method.
Hermet Park [Fri, 4 Dec 2020 09:47:29 +0000 (18:47 +0900)]
common picture: revise resize method.

this implementation handles the center-aligned scale.
Also removed viewbox usage since we have size() method.

Change-Id: I9249c12d6eaf429e62ad8a8f0b776f00b50d779f

3 years agocommon Picture : Introduce Picture's size setter, getter APIs
JunsuChoi [Fri, 4 Dec 2020 06:03:25 +0000 (15:03 +0900)]
common Picture : Introduce Picture's size setter, getter APIs

* common Picture : Introduce Picture's size setter, getter APIs

If picture or file loaded by picture has an explicit Size(width, height),
it is transformed to fit the size.

Change-Id: Ie0b2530a5113b619f7de9d73197ddedb4ef13f99

3 years agosw_engine renderer: refactoring code & optimize composition. 70/248970/1 accepted/tizen/unified/20201208.123223 submit/tizen/20201206.210050
Hermet Park [Thu, 3 Dec 2020 06:29:40 +0000 (15:29 +0900)]
sw_engine renderer: refactoring code & optimize composition.

Move the prepare stage of shape & stroking composition stage to a separate function
this returns SwImage to use in composite stage.

Also clear partial region buffer since we know composition area.

Change-Id: I68cf6c8a8e4ca36960c917b88fdd2c74f7a494a3

3 years agosvg_loader Loader,XmlParser: String that has not been parsed returns false 69/248969/1
JunsuChoi [Wed, 2 Dec 2020 08:32:58 +0000 (17:32 +0900)]
svg_loader Loader,XmlParser: String that has not been parsed returns false

Existing parser functions always return true.
Parser function's return value was not being properly used.
So, add a return to check whether it is parsed or not.

Change-Id: I7e8a0b02dd22858d2150ec711abc3ba890d9c884

3 years agosvg_loader SceneBuilder: Use opacity() without using alpha color
JunsuChoi [Thu, 3 Dec 2020 05:21:28 +0000 (14:21 +0900)]
svg_loader SceneBuilder: Use opacity() without using alpha color

If opacity value is set in node,
opacity() API is used without composing alpha color.

Change-Id: I949454a346b60eb5e32d828784a56c36c4c45977

3 years agosw_engine math: fix regression bug.
Hermet Park [Thu, 3 Dec 2020 09:26:21 +0000 (18:26 +0900)]
sw_engine math: fix regression bug.

There is 1 pixel misaligned issue observed.
Found out transform() increases 0.5 pt always.

This transform() logic was broken by this change - e00f94870510636789dce3702ab651b82b8047ee
and now recorvered to origin.

Change-Id: I05ca6cf4c20f952d8d4c3695a74abf275c1e1b53

3 years agosw_engine raster: support opacity composition.
Hermet Park [Wed, 2 Dec 2020 08:16:15 +0000 (17:16 +0900)]
sw_engine raster: support opacity composition.

This implementation supports shape + stroke opacity composition.

Currently, tvg shape provides individual alpha values for filling & stroking

These alpha values are working individually, meaning that if stroking is half translucent,
user can see that translucent stroking is crossed the shape outlines.

Sometimes this result can be expected but user also expects the shape filling is invisible
behind of translucent stroking.

For this reason, Paint provides an additional api opacity()
that applies opacity value to whole paint attributes.

This is a little expensive job, please consider if you can possibly avoid that usage.

See Opacity example.

@Issues: 94

Change-Id: I856a67a986e724cb83b484782ce3499aa95455d2

3 years agosw_engine raster: code refactoring & optimize code.
Hermet Park [Wed, 2 Dec 2020 07:49:53 +0000 (16:49 +0900)]
sw_engine raster: code refactoring & optimize code.

* sw_engine raster: code refactoring & optimize code.

1. move the computation out of rolling if possible.
2. renamed internal variables & function prototypes.

Change-Id: Ibfdf82a5b6a4f004f5a64c42d8cbea01c62943dc

3 years agogl_engine renderer: fix build break.
Hermet Park [Tue, 1 Dec 2020 07:13:51 +0000 (16:13 +0900)]
gl_engine renderer: fix build break.

interface has been changed. make it up-to-date

Change-Id: I92a7cb1a3df5e0df701bb30506f646c944a47e22

3 years agocommon capi: Added scene clear API
Michal Szczecinski [Thu, 26 Nov 2020 08:31:32 +0000 (09:31 +0100)]
common capi: Added scene clear API

Scene::clear() API allows users to remove shapes on their own, without
a crash in paint->dispose() or tvg_paint_del() methods. This case is
needed especially when thorvg is used to draw frames, when in one frame
we have scene with shape, and in next frames (future time stamps) user
deletes shapes

@API additions
Result Scene::clear();
Tvg_Result tvg_scene_clear(Tvg_Paint *scene);

Example:
```c
Tvg_Paint *scene = tvg_scene_new();
Tvg_Paint *shape = tvg_shape_new();

tvg_scene_push(scene, shape);
tvg_scene_clear();
//Now we can safelly free resources manually
tvg_paint_del(scene);
//Without tvg_scene_clear() memory allocatad for shape was double released
tvg_paint_del(shape);
```

Change-Id: I1b2a52262c0a5db723eba05ebc9867d901ac2932

3 years agocommon Scene: Fix validation check for child's bounds
JunsuChoi [Mon, 30 Nov 2020 05:51:04 +0000 (14:51 +0900)]
common Scene: Fix validation check for child's bounds

Fix typo. and Change return to continue.
Even if the child's boundary calculation is wrong,
other child's boundary should be calculated.

Change-Id: I7e3a73046bef3eee26592a66e0d46bff2a733c8f

3 years agocommon Test: Add Paint.bounds unit test
JunsuChoi [Mon, 30 Nov 2020 05:50:05 +0000 (14:50 +0900)]
common Test: Add Paint.bounds unit test

Change-Id: I0d99925afc9a942c65098a6f8c39c6ad9cb4d700

3 years agosw_engine Raster: Add null check for transform
JunsuChoi [Mon, 30 Nov 2020 06:20:49 +0000 (15:20 +0900)]
sw_engine Raster: Add null check for transform

If transform is null, identify matrix is used.

Change-Id: Ia01b687c3894354cafd80fc4fe944c0b4756718d

3 years agoPicture capi binding
Michal Maciola [Thu, 26 Nov 2020 10:27:05 +0000 (11:27 +0100)]
Picture capi binding

Change-Id: I83af4cf0ee4452041057e097a1f64a08862607bf

3 years agocapi: Added fill rule API.
Michal Szczecinski [Mon, 30 Nov 2020 04:08:24 +0000 (05:08 +0100)]
capi: Added fill rule API.

Added capi binding for fill rule setter and getter.

@API changes:

enum Tvg_Fill_Rule {
  TVG_FILL_RULE_WINDING = 0,
  TVG_FILL_RULE_EVEN_ODD,
}

Tvg_Result     tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule rule)
Tvg_Fill_Rule  tvg_shape_get_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule* rule)

Change-Id: If83a08dfaceb4e861085de8a38d86d3e321cc64f

3 years agoexamples: ignore loading raw image file. accepted/tizen/unified/20201130.122949 submit/tizen/20201129.214353
Hermet Park [Mon, 23 Nov 2020 09:33:10 +0000 (18:33 +0900)]
examples: ignore loading raw image file.

in the last commit, it added a raw image file in the images folder.
It breaks Multicanvas, Svg which try to load all kinds of files in it.

We don't need to load all files by figuring out file extension name.

Change-Id: Iecea64379fabd85aa636158740a224a43ebc89c0

3 years agoraw_loader Loader: Introduce Raw image loader
JunsuChoi [Mon, 23 Nov 2020 09:12:36 +0000 (18:12 +0900)]
raw_loader Loader: Introduce Raw image loader

Add RawLoader class that loads and display raw images,
and adds a Rasterizer for image data.
Image data can be loaded via picture.
Loaded image supports Composition, Transformation and Alpha blending.

New API
Result load(uint32_t* data, uint32_t width, uint32_t height, bool isCopy) noexcept;

Change-Id: I180863466f833586df1fa47fee86dd72e45f1368

3 years agocapi: Added free flag to clear API. accepted/tizen/unified/20201124.123022 submit/tizen/20201122.211513
Michal Szczecinski [Thu, 19 Nov 2020 06:39:07 +0000 (07:39 +0100)]
capi: Added free flag to clear API.

Cpp implementaiton of library has free flag which was not used in
capi bindings.

@API changes
from: tvg_canvas_clear(Tvg_Canvas *canvas);
to: tvg_canvas_clear(Tvg_Canvas *canvas, bool free);

Change-Id: I4e7f5ced229dbd449dc5c2e2e1148f43d37bc50e

3 years agocommon taskScheduler: code refactoring accepted/tizen/unified/20201116.220339 submit/tizen/20201115.212153
Hermet Park [Wed, 11 Nov 2020 04:55:46 +0000 (13:55 +0900)]
common taskScheduler: code refactoring

removed unnecessary code.

Change-Id: I0e02fa8c2d8e33678b42bd88412b562afd551b86

3 years agocommon taskScheduler: fix a synchronization data race.
Subhransu Mohanty [Tue, 10 Nov 2020 07:43:19 +0000 (16:43 +0900)]
common taskScheduler: fix a synchronization data race.

std mutex shouldn't be used among threads. behavior is unexpected by implmentation.

This resolves it by introducing conditional value.

Change-Id: I276fab65919b979f0f4a882ef52214bda6a69bde

3 years agocapi examples: Added scene API C bindings.
Michal Szczecinski [Tue, 10 Nov 2020 03:13:48 +0000 (04:13 +0100)]
capi examples: Added scene API C bindings.

Scene CAPI allows to use scene functionaliy in C applications such as
set opacity to few shapes at one time or implement transparent layers.

@API Additions:
```c
Tvg_Paint* tvg_scene_new();
Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint *paint);
```

Examples:
```c
Tvg_Paint *scene = tvg_scene_new();

Tvg_Paint *shape1 = tvg_shape_new();
tvg_shape_append_rect(shape1, 10, 10, 100, 100, 0, 0);
tvg_shape_set_fill_color(shape1, 255, 0, 0, 255);

Tvg_Paint *shape2 = tvg_shape_new();
tvg_shape_append_rect(shape2, 120, 10, 100, 100, 0, 0);
tvg_shape_set_fill_color(shape2, 255, 0, 0, 255);

tvg_scene_push(scene, shape1);
tvg_scene_push(scene, shape2);

tvg_paint_set_opacity(scene, 100);

tvg_canvas_push(canvas, scene);
```

Change-Id: I0043826fbddd8aa5d523f68bb271144f8c39e35c
Co-authored-by: Michal Szczecinski <m.szczecinsk@partner.samsung.com>
3 years agoexamples capi: removed printf()
Hermet Park [Mon, 9 Nov 2020 05:43:15 +0000 (14:43 +0900)]
examples capi: removed printf()

there is no point to print information.

Change-Id: Ic18abdf4da21d17d215384c1198c1e7732cb22d5

3 years agocommon taskScheduler: thread sync optmization
Hermet Park [Mon, 9 Nov 2020 05:36:22 +0000 (14:36 +0900)]
common taskScheduler: thread sync optmization

replaced future/promise with mutex since they use a lot of memory allocation number.

plus, binary size is reduced from 2094896 -> 1746864

Change-Id: Iea8cf9c8336e50d1272aa512f3a4d8b35d182534

3 years agoRevert "examples: revise example code." submit/tizen/20201108.215920
Hermet Park [Fri, 6 Nov 2020 06:37:17 +0000 (15:37 +0900)]
Revert "examples: revise example code."

This broke gl_engine rendering, revert it.

This reverts commit 9bb1972ef97e1ae3c83fe9e48c16262d9f246a4a.

Change-Id: I7304fd73c77ae3487681e2241a9d47f7c5b686f7

3 years agocommon renderer: code refactoring.
Hermet Park [Fri, 6 Nov 2020 06:19:52 +0000 (15:19 +0900)]
common renderer: code refactoring.

renamed internal methods from flush() to sync()
since flush() is reserved for caching flush.

Change-Id: I14c2f5b530907d573a2400f3cbd01dad1aaef0af

3 years agogl_engine renderer: fix build break.
Hermet Park [Fri, 6 Nov 2020 06:25:11 +0000 (15:25 +0900)]
gl_engine renderer: fix build break.

just found a missing change for the fillColor api.

Change-Id: Ife45e37a02ba7fb1beba324f81801ab0ea758548

3 years agosw_engine mempool: ++optimization
Hermet Park [Fri, 6 Nov 2020 04:38:00 +0000 (13:38 +0900)]
sw_engine mempool: ++optimization

These memory pools requires very simple mechanism.

Remove stl vector but use direct memory for less binary size.(2127696 -> 2094094)

@Issues: 75

Change-Id: Id13d3dc0b6425457858921e1f7b43c747af17272

3 years agocommon shape: memory optimization
Hermet Park [Fri, 6 Nov 2020 02:18:35 +0000 (11:18 +0900)]
common shape: memory optimization

All shapes will have path data,
avoid unnecesary dynamic memory allocation internally.

@Issues: 75

Change-Id: Ib3eefcf962ea391229668710aab364bd6cbd18c3

3 years agoupdated AUTHORS
Hermet Park [Fri, 6 Nov 2020 02:30:31 +0000 (11:30 +0900)]
updated AUTHORS

Change-Id: I978fe66900b8b15d93da79f3576843d9f08e4bd3

3 years agofix compilation on Windows
Vincent Torri [Thu, 5 Nov 2020 11:25:47 +0000 (12:25 +0100)]
fix compilation on Windows

Change-Id: I1afe19b0ed0a98c1488871e1ac3f0a4be8cde816

3 years agofix compilation on Windows
Vincent Torri [Thu, 5 Nov 2020 10:36:43 +0000 (11:36 +0100)]
fix compilation on Windows

Change-Id: Ie1cfe437abb250c87389e2f122cb2fda0c50e8dc

3 years agosw_engine rle: performance optimization.
Hermet Park [Thu, 5 Nov 2020 07:34:14 +0000 (16:34 +0900)]
sw_engine rle: performance optimization.

Tis is a subsequential trial of 1b8188ee676eae5c690b1b88bb823b6ad126bb78
for opimizing memory alloc count.

In this time, it concentrates on rle span.

@Issues: 75

Change-Id: Ie7a0324c33856b2ac938f4300a280b5fb6d3b39f

3 years agoUpdate README.md
Hermet Park [Thu, 5 Nov 2020 05:44:43 +0000 (14:44 +0900)]
Update README.md

Change-Id: I4022490bb0a206b5cbd77deeb0720de4d0b483dd

3 years agoUpdate README.md
Hermet Park [Thu, 5 Nov 2020 05:43:32 +0000 (14:43 +0900)]
Update README.md

Change-Id: I8f7343ae0c3b41f6c1672afda40d1de4f1a7bd91

3 years agoUpdate CONTRIBUTING.md
Hermet Park [Thu, 5 Nov 2020 04:57:21 +0000 (13:57 +0900)]
Update CONTRIBUTING.md

Change-Id: I5d7e3c08106c05912be07537fd7ddc09311da19b

3 years agoUpdate README.md
Hermet Park [Wed, 4 Nov 2020 12:01:22 +0000 (21:01 +0900)]
Update README.md

Change-Id: Iddf24b5580e6157a966d1c38fde40a16c93adb4c

3 years agores: updated thorvg card images.
Hermet Park [Wed, 4 Nov 2020 11:58:54 +0000 (20:58 +0900)]
res: updated thorvg card images.

Change-Id: Ic527aad2533ea9de0b15a7e6f8d164b5bda2e880