Commit graph

3578 commits

Author SHA1 Message Date
Hermet Park
7a27ca3613 capi: correct interfaces.
put missing const parameter and correct set/get naming.

attention, these two apis are changed!

tvg_gradient_color_stops() => tvg_gradient_set_color_stops()
tvg_gradient_spread() = tvg_gradient_set_spread()
2020-09-16 17:56:47 +09:00
Piotr Kalota
7d08f202a8 bindings/capi: Added path getters + test in testCapi.c 2020-09-16 16:55:00 +09:00
Hermet Park
64c958cd2c bin svg2png: revise abe7187f5b
revise previous patch code.

1. turned off it in default.
2. + copyright declaration.
3. fix coding convention.
2020-09-16 11:22:54 +09:00
JunsuChoi
abe7187f5b
ThorVG/Utils: Convert svg to png (#8)
* thorVG/example: added thorVG example app to convert svg to png

Rasterazing the svg file and extracting it as a png file.
The png encoder uses the 'lodepng' library.
(https://lodev.org/lodepng/)

Usage:
   svg2png [svgFileName] [Resolution] [bgColor]

Examples:
    $ svg2png input.svg
    $ svg2png input.svg 200x200
    $ svg2png input.svg 200x200 ff00ff

* ThorVG/Utils: Change examples to utils

* ThorVG/Utils: Move svg2png from util to src/bin

Renamed the build option for svg2png.
2020-09-16 11:11:50 +09:00
Michal Szczecinski
438f3360b9 bindings/capi: Added stroke/gradient getters. 2020-09-15 19:32:00 +09:00
Hermet Park
b3f9f501f1 common: fix compiler warnings.
warning: some methods overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
2020-09-15 13:34:29 +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
c407d4d13d sw_engine: code refactoring.
removed unused macro.
2020-09-15 12:26:57 +09:00
JunsuChoi
855397be36 SvgLoader: Fix wrong display when dasharray size is 1
If dash array size is 1, it means that dash and gap size are the same.
2020-09-15 12:21:02 +09:00
JunsuChoi
a0cd190548
Update README.md
Add build status
2020-09-14 20:54:55 +09:00
JunsuChoi
0aef293c84 Add travis ci build 2020-09-14 20:50:09 +09:00
Hermet Park
db4256fbea
Update README.md
Fix typo
2020-09-11 19:49:22 +09:00
Mira Grudzinska
b8138d56c0 SvgLoader: Fixing issues with a A/a command
Cmd 'A' from an svg path should not be connected with any other commands via the control points.
2020-09-11 16:13:28 +09:00
Mira Grudzinska
fa26aa7e7b svg_loader: fixing issue with parsing an svg path (A/a cmd)
The large_arc and sweep flags should be type checked and
whether their value is 1 or 0.
2020-09-11 16:10:17 +09:00
Hermet Park
c055682724 updated AUTHORS 2020-09-11 11:15:00 +09:00
JunsuChoi
1280548cf1 SvgLoader: Fix missing doc.gradients update
When both <defs> and <svg> gradients are declared,
the update of gradient declared in <svg> is omitted.
Therefore, this patch fixes any missing gradient updates.
2020-09-11 11:11:13 +09:00
JunsuChoi
eb64428bde SvgLoader: Modify calculation formula of linear gradient matrix
When there is a matrix of linear gradient, the applied formula is this.
= T(x - cx, y - cy) x g->transform x T(cx, cy)
This patch has modified this formula to work properly.
2020-09-10 19:08:20 +09:00
Hermet Park
b1a91acd6a sw_engine: code refactoring.
use macro for single maintenance.
2020-09-10 15:30:38 +09:00
Mira Grudzinska
5a21b3bd68 sw_engine: the check if the stroke width > 0 after conversion its value from float to long
During stroke width interpolation, if the width value after conversion
to long was 0, the bbox size was undefined.
2020-09-10 15:23:01 +09:00
Hermet Park
7c31d3f1e7
Update README.md 2020-09-10 10:53:44 +09:00
JunsuChoi
68ce2dc7d8 SvgLoader: Supports case when only rx or ry is declared
In relation to the declaration of rx and ry attribute of rect, the following three cases occur.
rx="10" (or ry="10"
rx="10" ry = "0" (or rx="0" ry = "10")
rx="10" ry = "10"
To cover these case, we check the rx and ry declarations.
2020-09-10 10:31:31 +09:00
Hermet Park
bd18e29c39
Update README.md 2020-09-09 11:11:24 +09:00
Hermet Park
4c0bce3fdc sw_engine: fix shape rendering skip issue.
tvg canvas must draw retained shapes for every draw call
even though user missed call update() for shapes.

that case canvs must draw shapes without update,
it means drawing them within previous condition.
2020-09-09 11:02:56 +09:00
Hermet Park
e49c9eb459 changed file permission 2020-09-08 20:29:24 +09:00
Hermet Park
a61c8cc360 gl_engine: fix by coding convention.
A *a; (x)
A* a; (o)
A &a; (x)
A& a; (o)
2020-09-08 15:24:31 +09:00
Pranay Kumar Samanta
af190033bb gl_engine: gradient implementation
Change-Id: If2413328437847d52ba1badc3b5c510fdd47ccd3
2020-09-08 14:45:48 +09:00
Hermet Park
5f100b8cff
Update README.md 2020-09-08 12:27:30 +09:00
Hermet Park
c052db71d3
Update README.md
updated logo.
2020-09-08 12:26:23 +09:00
Hermet Park
3e63263646 svg_loader: refactoring code.
merge loader class with task to simplfy code.
2020-09-08 10:43:38 +09:00
Hermet Park
241c25d722 svg_loader: remove dead code.
default covers all left enumeration values.
2020-09-07 17:57:41 +09:00
Hermet Park
d4fce27909 sw_engine: fix memory leak.
free resources properly at exceptional case.
2020-09-07 17:40:39 +09:00
Hermet Park
0f07054924
Update README.md 2020-09-07 14:12:07 +09:00
Hermet Park
ea55deb5d0 README: introduced our new logo. 2020-09-07 14:09:31 +09:00
Hermet Park
56ff30adff test: +++ missing test file. 2020-09-05 19:05:17 +09:00
Hermet Park
8685c7e0f0 common: fix context corruption among the multiple canvases.
previous implementation didn't consider multiple canvases,
multiple canvas shared one renderer engine that brought corrupted contexts.
Thus, each canvas instances should have designated renderer engine instances.

Now fixed.
2020-09-05 18:55:51 +09:00
Hermet Park
56e474ffab
Update README.md
Update Sample code
2020-09-05 14:26:56 +09:00
JunsuChoi
801896cf8f SvgLoader: Add Mask, ClipPath nodees as dummy.
Mask and clippath TAG are not supported yet.
If this TAG is used, the Child TAG declared with this TAG may cause problems.
To prevent that, declare them as Unknown types until they are supported. (display=none)
2020-09-04 19:47:22 +09:00
JunsuChoi
bd36738011 SvgLoader: Support DashArray attribute for stroke
It supports stroke-dasharray, one of the stroke properties of svg.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray
2020-09-04 16:45:31 +09:00
JunsuChoi
497c1ef131 SvgLoader: Fix memory leak for loader's gradient
Release the memory that was not released.
2020-09-04 16:03:46 +09:00
JunsuChoi
c27a952f44 SvgLoader: Add null check
Since the pointer actually used inside the if condition is loader->def,
add a null check for this.
2020-09-04 16:03:07 +09:00
JunsuChoi
6768e11eed SvgLoaderCommon: Add initialization in SvgVector
A segfault occurs when calling clear() a list without push.
This patch prevents it.
2020-09-04 16:00:58 +09:00
JunsuChoi
0d2982ff76 SvgLoader: Gradient use non-premultipied color
Follow color policy of tvg:Shape.
2020-09-04 12:38:52 +09:00
Hermet Park
1f05c249af sw_engine: step backward optimization.
As profiled, raster parallelization is not so efficient,
we revert this behavior.

We will come again with a better fine-tuned method.
2020-09-04 12:36:19 +09:00
JunsuChoi
c7646d3f73 SvgLoader: Use non-premultipied color
Follow color policy of tvg:Shape.
2020-09-04 12:17:59 +09:00
Hermet Park
b40016c81d svg_loader: prevent dangling node in exception case.
We prefer the independent unit function behavior.
2020-09-04 11:49:08 +09:00
JunsuChoi
3018fe29cd SvgLoader: Remove unnecessary declaration
This declaration is no longer needed,
removing unnecessary actions.(69e8b54be2)
2020-09-04 11:45:45 +09:00
JunsuChoi
23fa5bba23 SvgLoader: Do not delete the cloned node
Reverted incorrectly modified code in 3b9bb51321.

The newly created node becomes a child of the parent parameter
and is deleted together when parsing ends.
2020-09-04 11:45:45 +09:00
JunsuChoi
7807814acb SvgLoader: Fix pointing to wrong parent
If defs type is open empty style, it is not included in stack.
2020-09-04 11:45:45 +09:00
JunsuChoi
c15103e033 SvgLoader: Prevent underflow when stack.cnt is 0
If graphic node is directly located in the <svg>(root) node,
it may cause underflow because stack.cnt is 0.
2020-09-02 18:23:04 +09:00
JunsuChoi
7aff026276 SvgLoader: Defs type nodes are not saved in loader's node list.
If there is an empty (unused) <defs /> inside the svg file, this can cause problems.
<defs> node is managed separately in loader->def.
So it doesn't have to be added to loader's list.
2020-09-02 18:23:04 +09:00