When combining Shape, Stroke, and AlphaMasking, there is a missing
composition step which results in an incorrect output as expected by the user.
This problem is resolved by introducing shape fill and stroking composition.
@Issue: https://github.com/thorvg/thorvg/issues/209
Rule of thumb on Windows:
* for a DLL:
* if the library is built, set TVG_API to __declspec(dllexport)
* if the library is used, set TVG_API to __declspec(dllimport)
* for a static library, set TVG_API to nothing
To set TVG_API for a static library, TVG_STATIC is defined when the stataic library is built.
Otherwise, TVG_API is correctly set for a DLL.
Also sun and intel compilers are handled
@issue: https://github.com/thorvg/thorvg/issues/1446
The cast() method is a utility function used to
cast a 'Paint/Fill' to type 'T'.
This would help users to write code optimal.
@API Additions:
template<typename T> std::unique_ptr<T> cast(Paint* paint)
template<typename T> std::unique_ptr<T> cast(Fill* fill)
Remove extern "C specifier. ThorVG has the C binding,
C++ apis doesn't need to be compatibile with a C compiler.
This limits the C++ style template interface.
The previous meson script was incomplete,
therefore this change requires it to be revised.
To enable static linking use the next meson option.
"-Ddefault_library=static"
Issue: https://github.com/thorvg/thorvg/issues/1234
The new api is introduced to handle the rendering
order of a stroke and a fill. By default fill is
rendered as the first one, stroke as the second
one. This order can be reversed by calling
order(true).
@Issue: https://github.com/thorvg/thorvg/issues/1340
According to the svg specs clip's fill and opacity
should be ignored. Till now setting the alpha/opacity
value to zero resulted in the shape's rendering abort.
@Issue: https://github.com/Samsung/thorvg/issues/1192
the old version of Accessor::access() is redundant,
we replaced it with set().
It's still under the beta, we can remove it immediately.
Note that we've planned to promote them official APIs in v0.9.
Newly changed, tagging beta again...w
It supports data parameters that
can pass user data to the callback function.
std::unique_ptr<Picture> access(std::unique_ptr<Picture> picture, bool(*func)(const Paint* paint, void* data), void* data) noexcept;
Introduced CompositeMethod::LumaMask that converts the source pixels to the
grayscale (luma value) before alpha blending. Thanks to it, mask works more like
typical mask in graphics editor software.
Grayscale is calculated with weighted method:
(0.0721*B + 0.7154*G + 0.2125*R) * A
Introduced surface->blender.lumaValue function
Basically, this Accessor is a utility to debug the Scene structure,
by traversing the scene-tree by users.
You can search specific nodes to read the property information,
figure out the structure of the scene tree and its size.
We actually don't recommend you to touch the property unless you really
know the each paint's position and role because it's not visible, difficult to
understand its anatomy.
Also, You must underatnd that modifying the nodes of the scene will be going
well with both the art-design structure and the prorgram logic.
In this first version, Accessor only supports for the Picture class.
@example:
auto picture = tvg::Picture::gen();
picture->load("test.svg");
//The callback function from lambda expression.
//This function will be called for every paint nodes of the tree.
auto f = [](const tvg::Paint* paint) -> bool
{
if (paint->identifier() == Shape::identifier()) {
//override properties?
uint8_t r, g, b, a;
paint->fillColor(&r, &g, &b, &a);
paint->fill(r / 2, g / 2, b / 2, a);
}
//You can return false, to stop traversing immediately.
return true;
};
auto accessor = tvg::Accessor::gen();
picture = accessor->access(move(picture), f);
...
@Issue: https://github.com/Samsung/thorvg/issues/693
Migrate the id property to the base class internals
so that pimpl classes could access the data easier.
This is a sort of prerequisite change for the coming texmap anti-aliasing.
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
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
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
We missed the final keyword for the Saver,
This inheritance is out of our policy.
It might be break apis but Saver class is just opened,
and we're pretty sure that there is no any extension of this.
I know this is the bad decision, but we have a chance yet,
so we must correct it before further late.
This identifier is useful when user identify the instance type in runtime.
ThorVG basically don't prefer to dynamic_cast() nor typeid(),
it compiles with -fno-rtti option for the optimial size.
Here is an example for the simple usage.
if (paint->identifier() == Shape::identifier())
auto shape = static_cast<Shape*>(paint);
@Issue: https://github.com/Samsung/thorvg/issues/693
Current paint::bounds() returns the coordinates under the raw status,
the values are not quite useful if the paint object has the transformed children.
Thus, we extends the feature and give an additional parameter "transformed"
to return the coordinates values after transformation by user demands.
This is also necessary for tvg format, since we need the exact view size of the scene information.
The previous api is deprecated and we introduce a new api to replace it.
@APIs:
+ Result Paint::bounds(float* x, float* y, float* w, float* h, bool transformed) const noexcept;
- Result Paint::bounds(float* x, float* y, float* w, float* h) const noexcept;
@Issues: https://github.com/Samsung/thorvg/issues/746
tvg picture is going to be released, we need the Saver as well.
Also, two stable periperal apis are released in v0.5
@APIs:
Result Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false) noexcept;
CompositeMethod Paint::composite(const Paint** target) const noexcept;
Result Saver::save(std::unique_ptr<Paint> paint, const std::string& path, bool compress = true) noexcept;
Result Saver::sync() noexcept;
static std::unique_ptr<Saver> Saver::gen() noexcept;