Commit graph

2701 commits

Author SHA1 Message Date
Hermet Park
c6b3f78eca common bezier: code refactoring.
use a zero ranged macro.
2020-10-07 14:33:17 +09:00
Hermet Park
e358675d61
Bezier curve: improvement of the curve splitting algorithm (#86)
bezAt() function needed to be fixed.
Also the convergence in the while loop was sped up and
the break condition was changed.
2020-10-07 14:30:13 +09:00
Hermet Park
b5c301ba2d examples: add missing files. 2020-10-07 14:28:11 +09:00
Hermet Park
433746f2bd examples: removed test prefix 2020-10-07 14:04:08 +09:00
Hermet Park
4204030bbe examples: revise Stroke, StrokeLine 2020-10-07 13:48:09 +09:00
JunsuChoi
c70d1b1e45
SwRender & tvgPaint: Implement ClipPath feature (#68)
common sw_engine: Implement ClipPath feature

Paint object can composite by using composite API.
ClipPath composite is clipping by path unit of paint.
The following cases are supported.

Shape->composite(Shape);
Scene->composite(Shape);
Picture->composite(Shape);

Add enum
  enum CompMethod { None = 0, ClipPath };

Add APIs
  Result composite(std::unique_ptr<Paint> comp, CompMethod method) const noexcept;

* Example: Added testClipPath
2020-10-07 11:21:23 +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
Mira Grudzinska
910d45d93f shape: fixing 'pie' option
For a dashed arc with pie = 1 the closing line was missing.
2020-10-06 11:29:46 +09:00
Mira Grudzinska
48f1115b0b examples: testStrokeLine example expanded
Added dashed lines to circles and arcs.
2020-10-06 11:27:00 +09:00
Mira Grudzinska
9cd4d2b363 Bezier curve: improvement of the curve splitting algorithm
bezAt() function needed to be fixed.
Also the convergence in the while loop was sped up and
the break condition was changed.
2020-10-01 03:09:36 +02:00
Hermet Park
ea028a479c gl_engine: fix compile error.
After refactoring header includsion, gl_engine has a break at file dependencies.
now this fixes it.
2020-09-25 14:00:16 +09:00
Michal Szczecinski
74f8da845e gradient: Fixed radial gradient setter.
Removed check for gradient radius. Because of check, x and y values
was ignored when radius equals 0 and api was not usable
in integration with external libs which sets gradient center and
radius in separeted functions.
2020-09-25 13:58:30 +09:00
Hermet Park
56db18fbf1 common: code refactoring.
Merge shape internal bodies to one (ShapePath => ShapeImpl),
for keeping less files.
2020-09-24 17:06:16 +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
mmaciola
145bafbec8
bindings/capi: Added gradient getter
Co-authored-by: Michal Maciola <m.maciola@samsung.com>
2020-09-23 15:09:08 +09:00
Hermet Park
ce69dcd416 examples: added stress test. 2020-09-23 14:42:52 +09:00
JunsuChoi
cf4edcf593 SvgPath: When path end(Z,z), Current point are returned to starting point(M,m)
When path ends with 'z' or 'Z' command, if 'm' comes as next command,
the current point is incorrectly referenced.
Since 'Z', 'z' means to close the path,
so, Save point and reuse it when 'M' or 'm' is called.
2020-09-22 14:50:15 +09:00
Hermet Park
87a0666034 common picture: implement duplicate() method. 2020-09-22 13:55:25 +09:00
Hermet Park
c1827df0a3 common scene: implement duplicate() method. 2020-09-22 13:24:00 +09:00
Hermet Park
d601021b8f common fill: code refactoring
removed unique_ptr in the interface because it's hard to get polymorphism benefits in programming perspective.
2020-09-22 11:00:33 +09:00
Hermet Park
a85540397c examples: update testDuplicate.
Added shape gradient fill to check duplication feature.
2020-09-21 19:22:47 +09:00
Hermet Park
12cd858d72
common fill: implement duplicate() method. 2020-09-21 19:20:51 +09:00
Hermet Park
729fee5a23 examples: move tests to src/examples
tests is now officially placed in src/examples,
default is turned off, only necessaries turn it on.

ex) meson . build -Dexamples=true

+ this examples are required efl 'elementary' package.
2020-09-19 00:39:25 +09:00
Hermet Park
3e18b85f99
bindings/capi: fix c compatibility warnings.
warning: empty struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
2020-09-18 23:36:33 +09:00
Hermet Park
eef7620bc8
common: binary optimization. (#65)
removed unique_ptr usages from pImpl pattern.
that increased binary size.

2204082 -> 2045672
2020-09-18 16:34:12 +09:00
Hermet Park
87fbff63cb common: code refactoring.
revise duplicate() approach with stategy pattern.
2020-09-18 12:22:28 +09:00
Hermet Park
f11a4d9b7b build: renamed utilities to tools 2020-09-17 20:53:54 +09:00
Hermet Park
1a247fe1f7 common shape: fix grammar mistake.
array values are not copied by *a = *b;
2020-09-17 11:29:02 +09:00
Hermet Park
8d5e4e883d
common path: code refactoring.
revise duplicate() method for clean & neat code.
2020-09-17 11:28:05 +09:00
Michal Szczecinski
538db6e881 shape: added duplicate api.
Changes:
1. New shape->duplicate(Shape) api.
2. New example: testDuplicate
3. Added capi binding for duploicate api
4. Added capi duplication test in testCapi.c

Description:

Added implementation of duplicate api. For now it supports stroke
properties and shape properties (fill color, path) duplication.

TODO:
Implement gradient properties duplication
2020-09-17 11:01:52 +09:00
Hermet Park
afa7781e20
capi: code refactoring (#58)
* capi: refactoring code.

init/term method allows mixing enum values,
we don't need to call them separatetly.
2020-09-16 19:00:19 +09:00
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
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
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
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
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