Commit graph

1340 commits

Author SHA1 Message Date
Hermet Park
04a27f383e doc: added c api documentation 2021-11-02 21:08:36 +09:00
Hermet Park
f85a9eb136 doc: up to date v0.6.0 2021-11-02 21:02:07 +09:00
Hermet Park
6f42007f29 infra: just released v0.6.0 2021-11-02 20:06:06 +09:00
Hermet Park
4d62108d81 update wasm build script
remove the deprecations and warnings.
2021-11-02 19:53:08 +09:00
Hermet Park
0f2d7e3eef jpg_loader: fix compiler warnings.
"warning: shifting a negative signed value is undefined [-Wshift-negative-value"
2021-11-02 19:49:57 +09:00
Hermet Park
c31c77c0fb tvg_loader interpreter: tiny optmization
skip memory copy as possible.
2021-11-02 19:47:08 +09:00
Mira Grudzinska
6b132d77e8 tvg_saver/tvg_loader: gradient fill in the tvg format
Introducing the gradient transform() apis and changing the grad
algorithms made it possible to apply the shape's transformation
before saving the tvg file, in case the shape (or its stroke)
has a fill.
2021-11-02 19:37:02 +09:00
Hermet Park
3b54e4797e sw_engine image: fix memory leak.
reset rle is supposed to be reused, image should keep its pointer.

@Issue: https://github.com/Samsung/thorvg/issues/982
2021-11-02 19:33:32 +09:00
Mira Grudzinska
7176a5ddd4 svg_loader: define the scaling factors for units changing
The values in absolute units are calculated based on the pixel unit.
Till now the default value of 90dpi was used. Since CSS3 (now CSS4 is
the most recent) 1 inch equals to 96 pixels. The necessary constants
are introduces in this commit.
2021-11-02 11:29:41 +01:00
Hermet Park
3c7d037841 jpg_loader: code refactoring
removed unused variables.
2021-11-02 19:02:07 +09:00
Hermet Park
c8e7bc9d43 png_loader: code refactoring
removed unused variables.
2021-11-02 18:57:55 +09:00
Hermet Park
e4ab100fb2 tools svg2tvg: ++exception handling.
skip to process if the input is invalid.
2021-11-02 14:38:09 +09:00
Hermet Park
3abf89a6ff examples: updated tvgs
re-compiled the tvgs with the latest tvg saver.
2021-11-02 14:32:29 +09:00
Hermet Park
4da5cbb322 infra: add tvg resource pack.
Keep v0.5 version of tvgs for checking compatibility.
2021-11-02 14:26:20 +09:00
Hermet Park
2d830eae8b infra: update meson option description 2021-11-02 13:18:17 +09:00
JunsuChoi
590381f68b infra meson: Add -Dstatic option
Add an option for use in environments where
the use of static libraries must be enforced.
2021-11-02 13:14:16 +09:00
Mira Grudzinska
abc3b40a37 sw_engine: var/funct renaming
Changed names:
shape->rect -> shape->fastTrack
_factTrack -> _axisAlignedRect
2021-11-02 11:41:14 +09:00
Mira Grudzinska
16a153c804 svg_loader: fix bounds for gradient
In the case when bounds should not include a stroke width, width
and height values were reduced by half of a stroke width, instead
of the full width.
2021-11-01 20:36:48 +01:00
Mira Grudzinska
26f99372b0 sw_engine: fastTrack with clips
After 362d2df the fastTrack cases were applied even for shapes with clips.
These changes fixed this - the check whether a shape is a rect should be done
only if it has no clips.
2021-11-01 22:21:17 +09:00
Hermet Park
3b2e1f4291 Revert "loaders: Consider colorspaces (#838)"
This reverts commit cd5116b053.

Ah this breaks the Stress example due to Picture::duplicate() is not available...

Need to consider and come back again.
2021-11-01 16:53:25 +09:00
Michal Maciola
cd5116b053
loaders: Consider colorspaces (#838)
* common: added colorSpace() function

This patch introduces colorSpace() function for SW and GL engine.

* infra: change LoadModule:read() into LoadModule:read(uint32_t colorspace)

This patch changes LoadModule:read() into LoadModule:read(uint32_t colorspace)

* picture: implement passing colorspace into loader

This patch implements passing colorspace into loaders.
Loader->read is now called on the first update.

* external_jpg_loader: support colorspaces

* external_png_loader: support colorspaces
2021-11-01 16:10:22 +09:00
Michal Maciola
479cea74cc common: Unmultiplicated colorspace
This patch introduces _STRAIGHT colorspaces (ABGR8888_STRAIGHT and
ARGB8888_STRAIGHT) whose colors are un-alpha-premultiplied. Unmultiplicated
colors are especially needed for wasm thorvg loader and svg2png / tvg2png.
Only C version now.

@issue: #791
2021-11-01 15:57:13 +09:00
Mira Grudzinska
86a8bbbb88 tvg_saver: preTransform condition
A stroke is irregularly scaled in case when:
1) m11 != m22
2) m11 == m22 == 0 and m12 != m21
The second case was missing in the code.
2021-11-01 15:52:20 +09:00
JunsuChoi
021b86a065 test Picture: Fix array release
fix code
2021-11-01 15:04:05 +09:00
Mira Grudzinska
b12421b4d1 tvg_loader: TVGLOG added in case an unknown fill or stroke tag used 2021-11-01 12:12:02 +09:00
Hermet Park
875e200767 common: code refactoring
removed invalid nullptr checks.

New allocation doesn't gurantee that returns nullptr when it's failed.
It's useless on the modern compliers and our policy respects it.
2021-11-01 12:09:32 +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
Michal Maciola
00dfd55f18 SVG: Support geometry properties of use tag
This patch adds a support for geometry properties (x, y) of <use> tag
2021-10-29 14:10:44 +09:00
Mira Grudzinska
4db3087c45 svg_loader: gradient transformation properly applied
The final gradient transformation depends on the coordinate system.
It can not be applied during an svg loading. The transformation matrix
has to be passed via api for further gradient processing.
2021-10-29 10:58:43 +09: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
362d2dfd0f sw_engine: refactoring
The rasterization region was rearranged in the case of fastTrack,
but its validation and boundaries weren't check, causing segf in some
cases. Fixed.
2021-10-29 10:52:29 +09:00
Mira Grudzinska
ba25cb80eb svg_loader: shape's bounds without a stroke
A shape's bounds used for a gradient transformation shouldn't take
a stroke into account.
2021-10-28 12:18:17 +02:00
JunsuChoi
71324e2e1d infra action: Enable to run test(window build)
use static png, jpg library
2021-10-28 15:33:48 +09:00
JunsuChoi
f28a0d9b5c test Scene/Canvas: Fix maximum size for big size test
In some development environments, -1 of uint32_t may become 0.
2021-10-28 14:24:20 +09:00
Hermet Park
70840218d6 tools svg2tvg: support converting multiple files.
Usage:
   svg2tvg [SVG file] or [SVG folder]

Examples:
    $ svg2tvg input.svg
    $ svg2tvg svgfolder
2021-10-28 13:59:49 +09:00
JunsuChoi
5fd60e14a2 test Picture : Remove unnecessary namespace
Remove `std::`
2021-10-28 13:59:24 +09:00
JunsuChoi
a7f7cbd29a test Picture: Change file open of ifstream to binary(and readonly) type
When opening a file using ifstream, a different problem occurs for each platform.
To fix this, change to binary, readonly type.

refer to:
https://stackoverflow.com/questions/9817806/why-does-my-program-produce-different-results-on-windows-and-linux-about-file-r
2021-10-28 13:59:24 +09:00
Hermet Park
370b9b08ec sw_engine shape: code refactoring.
move the exceptional code for the coherency,
and ++ more history of the description.
2021-10-28 13:53:49 +09:00
Hermet Park
caf4d846fc
Update README.md 2021-10-27 20:58:45 +09:00
Hermet Park
3ba33382d7 tools svg2tvg: improve the usability.
Removed the .svg in the output name.

Before: tiger.svg -> tiger.svg.tvg
After:  tiger.svg -> tiger.tvg
2021-10-27 20:56:48 +09:00
Hermet Park
a4494919ac jpg_loader: support multi-thread and header reading in prior to decoding.
revise the code to support async loading of the static jpeg_loader,
also support header reading in prior to decoding.
2021-10-27 16:39:43 +09:00
Mira Grudzinska
babb10b7f3 sw_engine: rasterization region edited in the case of fast tracking
Since no antialiasing is applied for the fastTracking cases,
the shape's rasterization region needs to be edited. To establish
the rastered bbox, the rounding is performed before the bbox corners
are casted to the SwCoords.
2021-10-27 12:42:27 +09:00
Hermet Park
07d4db0555 jpg_loader: code refactoring
revise code to satisfy with the tvg world.
no logical changes.

 - modified file names
 - added the samsung copyright
 - removed unnecessary typedefs
 - ++indentation
 - --LOC
2021-10-26 21:16:02 +09:00
Mira Grudzinska
2780d77a52 capi: tvg_paint_transform -> tvg_paint_set_transform 2021-10-26 19:20:15 +09:00
Mira Grudzinska
0dab343ba1 example: gradtransf.svg
The file enables to check the correctness of the gradient transformations
and units.
Removed duplicate file.
2021-10-26 10:47:18 +02:00
Hermet Park
f8a16cf022
Update CONTRIBUTING.md 2021-10-26 15:52:24 +09:00
Michal Maciola
003f53376e jpg loader: support static jpeg loader using richgel999
Adds an alternative static jpg loader.

The jpg loader copied the jpeg decoding implementation from this open-source
repo: https://github.com/richgel999/jpeg-compressor
That opensource has the public-domain license, it doesn't have any restriction
of the copy.

note: jpgd.cpp is modified version (changed decompress_jpeg_image_from_stream)
for returning BGRA
2021-10-26 15:50:01 +09:00
Mira Grudzinska
8c52f2a870 capi: casting on 'const Paint*' instead of constness removing 2021-10-26 11:51:35 +09:00