This class serves as the base for Animation.
The main purpose of its APIs is to control the animation frames.
Its example will be provided in the upcoming commits.
@APIs:
Result Animation::frame(uint32_t no) noexcept;
Picture* Animation::picture() const noexcept;
uint32_t Animation::curFrame() const noexcept;
uint32_t Animation::totalFrame() const noexcept;
float Animation::duration() const noexcept;
static std::unique_ptr<Animation> Animation::gen() noexcept;
@Issue: https://github.com/thorvg/thorvg/pull/1450
The blending feature allows user to combine colors to create visually appealing effects,
including transparency, lighting, shading, and color mixing, among others.
Its process involves the combination of colors or images from the source paint object
with the destination (the lower layer image) using blending operations.
The blending operation is determined by the chosen @p BlendMethod,
which specifies how the colors or images are combined.
@APIs:
- enum class BlendMethod::Normal, Add, Screen, Multiply, Overlay, Lighten, Difference, Exclusion, SrcOver, Darken, Lighten, ColorDodge, ColorBurn
- BlendMethod Paint::blend() const noexcept;
- Result Paint::blend(BlendMethod method) const noexcept;
@Issue: https://github.com/thorvg/thorvg/issues/307
Co-authored-by: Peter Vullings <peter@projectitis.com>
Co-authored-by: Hermet Park <hermetpark@lottiefiles.com>
These new apis would enable users to easily modify the motion scene,
The data structure of the paints has been changed from an array to a list.
@APIs:
std::list<Paint*>& Canvas::paints() noexcept;
std::list<Paint*>& Scene::paints() noexcept;
@Deprecated:
Result Canvas::reserve(uint32_t size) noexcept;
Result Scene::reserve(uint32_t size) noexcept;
@Issue: https://github.com/thorvg/thorvg/issues/1203
The CompositeMethod now includes the newly supported InvLumaMask option:
The source pixels are converted to grayscale (luma values),
and the complement of the target's pixels is alpha blended.
As a result, only the part of the source where the grayscale
is not covered by the target is visible.
@APIs: CompositeMethod::InvLumaMask
@Example: examples/InvLumaMasking.cpp
@Issue: https://github.com/thorvg/thorvg/issues/404
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.