Commit graph

639 commits

Author SHA1 Message Date
Hermet Park
52426c56e6 res: adds working-flow picture.
this picture will be used in README.
2020-11-04 11:29:13 +09:00
Michal Szczecinski
882188c752 common capi: Added opacity C bindings.
Added opacity setter/getter to CAPI. They will be useful to simplify
code responsible for set visiblility of paint.

@API Additions:
Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity)
Tvg_Result tvg_paint_get_opacity(Tvg_Paint* paint, uint8_t* opacity)
2020-11-04 10:37:55 +09:00
Hermet Park
ec2ec6e9c6
Update README.md 2020-11-03 16:23:29 +09:00
Hermet Park
acd17e449f
Update README.md 2020-11-03 14:48:40 +09:00
Hermet Park
9aa4d6b309 res: updated example screenshot resources 2020-11-03 14:46:16 +09:00
Hermet Park
8fdc24d88c
Update README.md 2020-11-03 14:45:44 +09:00
Hermet Park
8eeb8685ed
Update README.md 2020-11-03 14:42:33 +09:00
Hermet Park
eb6b5d10ce res: replaced primitive example screenshot. 2020-11-03 14:40:51 +09:00
Hermet Park
e02d3c30e9
Update README.md 2020-11-03 14:26:05 +09:00
Hermet Park
88cd205b16
Update README.md 2020-11-03 14:25:00 +09:00
Hermet Park
200016fea0 common LoaderMgr: code refactoring
keep clean & neat thorvg coding style.
2020-11-03 14:21:19 +09:00
Hermet Park
e9d1d13edd res: adds primitive example screenshot. 2020-11-03 14:20:42 +09:00
Hermet Park
0549bc5cb9
Update README.md 2020-11-03 14:07:58 +09:00
JunsuChoi
af85eb22ad svg_loader LoaderMgr: Delegates file validation check to LoaderMgr.
Delegates extension string check and header(open) check
for file to LoaderMgr.
This makes it easy to add a loader afterwards.
2020-11-03 12:15:12 +09:00
Hermet Park
627579522d sw_engine shape: code refactoring.
thorvg always prefer simpler code, less LOC.
2020-11-02 19:25:36 +09:00
Mira Grudzinska
a96037cd57 sw_engine shape: change of the rectangle fast tracking algorithm
The algorithm erroneously treated some shapes (like isosceles trapezoids
and specifically arranged zero width parallelograms) as rectangles,
which causes the whole bbox to be filled.
2020-11-02 19:23:44 +09:00
JunsuChoi
dc822174e8 svg_loader: Fixed a typo
lenght ->length
2020-11-02 14:16:13 +09:00
JunsuChoi
9859a48714 test Canvas: Set up unit test based on gtest.
In test directory, set up unit_test based on gtest
First, add a test for SwCanvas generate.
2020-11-02 14:15:50 +09:00
JunsuChoi
d4e9450ec1 common lib/loaders: Fix missing space for coding convention
Correct missing or incorrect spaces according to coding convention.
2020-11-02 14:15:05 +09:00
JunsuChoi
1bf123ff46 svg_loader SvgLoader: Fix wrong indentation
indent 3 -> 4
2020-11-02 14:14:36 +09:00
JunsuChoi
6cf2d89571 svg_loader SvgLoader: Prevent memory overflow for tagName
When copying tagName, if length of referenced string is longer
than general case, it is not used as tagName.
2020-10-30 17:06:06 +09:00
Hermet Park
0399d84478 common paint: introduce opacity() method.
We introduced separate opacity interface to adjust alpha value by paint.
This opacity will affect to whole paint image if paint is a group of paints.

Also, this opacity is to multipy with fill/stroke alpha values.
This means if the opacity is valid, the paint might deal with a composition step,
which is very expensive due to additional rendering step.

One tip is, if you want to toggle on/off for a certian paint,
you can set opacity to 255 or 0.

@API Additions:

Result Paint::opacity(uint8_t o) noexcept;
uint8_t Paint::opacity() const noexcept;

@Examples: examples/Opacity

@Issues: 94
2020-10-26 19:23:54 +09:00
Hermet Park
da4b57e763 examples fillrule: revise code.
just adjusted start points for better visual.
2020-10-26 17:13:02 +09:00
Hermet Park
73c7782749 examples svgs: replace logo design resource.
White background is our official thorvg logo,
cyan is for Tizen customed.
2020-10-26 16:52:52 +09:00
Mira Grudzinska
34a832d033 sw_engine shape: adding a dash pattern switch condition
Preventing switching to the next dash pattern for a line with a length of zero.
2020-10-26 16:40:42 +09:00
Mira Grudzinska
4b58c5a5de common shape: handling dash patterns < 1
For the dash pattern values (both, length and gap) < 1 the program crashed.
curLen - variable type changed from int to float.
2020-10-23 17:42:13 +09:00
Hermet Park
0b767750e6 common api: interface refactoring
returning color fill() method renamed to fillColor() as like others-strokeXXX, fillRule- do.

This change is for naming consistency.
2020-10-23 12:23:59 +09:00
Hermet Park
65cbbcf724 sw_engine shape: support fillRule method
this change supports EvenOdd fillrule in shape rendering

@Examples: examples/FillRule.cpp

@Isuses: 97
2020-10-22 17:29:39 +09:00
Hermet Park
46bd78a7c3 sw_engine renderer: fix aliasing shape outline result.
There a scenario detected that stroke 2 is not enough to cover
shape outlines. So make it bigger size.
2020-10-22 15:02:57 +09:00
Hermet Park
c807010554 examples FillRule: added shape::fillRule() example
one shape shows Winding, the other one shows EvenOdd.
2020-10-22 13:50:04 +09:00
Hermet Park
04aa038339 common fill: add fill-rule interface.
Fill rule is used to select how paths are filled.

For both fill rules, wheter or not a point is included in the fill is determined by taking a ray
from that point to infinity and looking at intersections with the path. The ray can be in any
direction, as long as it doens't pass through the end point of a segment or have a tricky
intersection such as intersecting tangent to the path.

@API Addtions:

enum class TVG_EXPORT FillRule { Winding = 0, EvenOdd };
Result Fill::rule(FillRule r) noexcept;
FillRule Fill::rule() const noexcept;

@Examples:

shape->rule(FillRule::EvenOdd);

@issue: 97
2020-10-20 20:10:59 +09:00
Mira Grudzinska
380450c95b Bezier curve: introducing BEZIER_EPSILON
BEZIER_EPSILON is used instead of EPSILON_FLT, because its
value was to small causing in some cases an infinite loop.
2020-10-20 16:12:59 +09:00
Hermet Park
389b028be4 svg_loader XmlParser: just renamed file name to simplify.
XmlParser without "Simple" is enough to address itself.
2020-10-15 20:44:53 +09:00
Shinwoo Kim
1e030004ed wasm test: update sample index.html
Update index.html according to updated wasm interface.
Missed chance to update index.html during review.
2020-10-15 15:09:10 +09:00
Hermet Park
0aaa04cd47
Update CONTRIBUTING.md 2020-10-15 12:14:50 +09:00
Hermet Park
5b36ce827d
Update CONTRIBUTING.md 2020-10-15 12:09:08 +09:00
Hermet Park
a16a9409e4
Update CONTRIBUTING.md 2020-10-15 12:04:05 +09:00
Hermet Park
9a9d29ede0
Create CONTRIBUTING.md
First guideline for contribution.
2020-10-15 12:01:01 +09:00
Shinwoo Kim
cc81e46343 thorvg viewer: fix scale problem
If viewer calls load() with a data which does not have size changes of both
viewbox and canvas, then load() does not set a scale value.
This makes incorrect result on viewer side.

So thorvg wasm should set a scale value, whenever load() is called.
2020-10-15 10:19:20 +09:00
Shinwoo Kim
acac884257 thorvg viewer: add getDefualtData interface
The 'getDefaultData' interface will be used when the svg data area
of thorvg viewer does not have any value.
2020-10-14 19:22:13 +09:00
Hermet Park
a4b828c556 svg_loader: fix wasm data type compile error. 2020-10-14 17:51:59 +09:00
Hermet Park
3e5d3b06c3 improve svg logo design quality. 2020-10-14 17:51:33 +09:00
Hermet Park
d3ec8ba16b
Update README.md 2020-10-13 19:15:17 +09:00
Hermet Park
1d76b3cd2a
Update README.md 2020-10-13 19:13:46 +09:00
Shinwoo Kim
0c68c45ef7 thorvg viewer: introduce thorvg viewer
Support Emscripten wasm build for thorvg viewer
2020-10-13 19:04:46 +09:00
Hermet Park
32f40bf7b0 re-tourched logo design for better quality. 2020-10-13 17:23:11 +09:00
Hermet Park
2a239714af sw_engine: fix missing shape update issue.
It missed to update shape data if visilibity is changed from false to true by alpha.

Also, it needs to update engine shape data for every requests.

There scenario can be allowed,

1. update shape
2. change shape property
3. update shape
4. draw

previously engine could skip step 3, its result was not properly expected.

@fix #84
2020-10-13 17:07:54 +09:00
JunsuChoi
77ccbcc6fe
tvgSvgLoader: Add points copy of missing polygon/polyline
When using <use> node, do atrribute copy.
At that time, when target(url) is polygon or polyline,
points array is not copied, causing a problem in output.
So, add missing array copy.
2020-10-13 13:45:40 +09:00
JunsuChoi
098c94819c tvgSvgLoader: Fix wrong bracket 2020-10-13 13:43:54 +09:00
JunsuChoi
e73cf7db60 tvgSvgLoader: Add "clip-path" attribute
Below node types support clip-path.
<circle>
<ellipse>
<g>
<path>
<polygon>
<polyline>
<rect>
2020-10-13 13:43:54 +09:00