Previously, translucent png images are not displayed properly
due to alpha channels premultiplication.
This patch implements that missing part to support it properly
by introducing the Surface data between canvas engine & rasterizer
@Issue: https://github.com/Samsung/thorvg/issues/655
There was a missing sorting between the left-top & right-bottom corner.
that results in the negative values of the viewport...
Now fixed it.
+ refactored to use math functions...
+ still it's a buggy, sometimes no draw at 90' in stress. don't know reason. :(
This reverts commit cd5116b053.
Ah this breaks the Stress example due to Picture::duplicate() is not available...
Need to consider and come back again.
* 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
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.
We can replace the system logger method by changing single line print source in common,
This also helps to remove the THORVG_LOG_ENABLED macro from each use-cases.
TVGLOG(): To print the hint & tip messages for users.
TVGERR(): To print the error message for debugging.
@Issues: https://github.com/Samsung/thorvg/issues/36
If ClipPath is a singular rectangle,
we don't need to apply this to all children nodes to adjust rle span regions.
Rather than its regular sequence,
we can adjust render region as merging viewport that is introduced internally,
All in all,
If a Paint has a single ClipPath that is Rectangle,
it sets viewport with Rectangle area that viewport is applied to
raster engine to cut off the rendering boundary.
In the normal case it brings trivial effects.
but when use SVGs which has a viewbox, it could increase the performance
up to 10% (profiled with 200 svgs rendering at the same time)
Note that, this won't be applied if the Paint has affine or rotation transform.
@Issues: 294
Introduced the reference counting for the backend engines so that
tvg prevents unpaired engine initialization/termination calls by user mistake.
@Issues: 296
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.
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.
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
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
this is an additional enhancement of af8c278c5e
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.
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;
we introduced shared memory pool for avoiding reallocate memory
while it process the stroke outlines, It experimentally increase
the outline data if we use the allocated memory for multiples shape strokes,
we don't need to alloc/free memory during the process.
This shared outline memory is allocated for threads count
so that we don't interrupt memory access during the tasks.
@Issues: 75
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
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
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.
remove unnecessary condition.
implementation won't be included multiple times not like headers.
Thus this condition is unnecessary.
Change-Id: Id37e675c40ce7213a06c950da8e5ca17ff7245c9