* common Picture : Introduce Picture's size setter, getter APIs
If picture or file loaded by picture has an explicit Size(width, height),
it is transformed to fit the size.
* sw_engine raster: code refactoring & optimize code.
1. move the computation out of rolling if possible.
2. renamed internal variables & function prototypes.
Scene::clear() API allows users to remove shapes on their own, without
a crash in paint->dispose() or tvg_paint_del() methods. This case is
needed especially when thorvg is used to draw frames, when in one frame
we have scene with shape, and in next frames (future time stamps) user
deletes shapes
@API additions
Result Scene::clear();
Tvg_Result tvg_scene_clear(Tvg_Paint *scene);
Example:
```c
Tvg_Paint *scene = tvg_scene_new();
Tvg_Paint *shape = tvg_shape_new();
tvg_scene_push(scene, shape);
tvg_scene_clear();
//Now we can safelly free resources manually
tvg_paint_del(scene);
//Without tvg_scene_clear() memory allocatad for shape was double released
tvg_paint_del(shape);
```
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 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
Fill rule is used to select how paths are filled.
For both fill rules, wheter or not a point is included in the fill is determined by taking a ray
from that point to infinity and looking at intersections with the path. The ray can be in any
direction, as long as it doens't pass through the end point of a segment or have a tricky
intersection such as intersecting tangent to the path.
@API Addtions:
enum class TVG_EXPORT FillRule { Winding = 0, EvenOdd };
Result Fill::rule(FillRule r) noexcept;
FillRule Fill::rule() const noexcept;
@Examples:
shape->rule(FillRule::EvenOdd);
@issue: 97
Canvas::clear() introduces a new argument "free" that deterimes freeing the retained paints.
If free is true, Canvas won't delete the retained paints so that user keep paints valid.
In this scenario, user must have paints pointers, free them manually or push them again to the canvas.
This scenario is useful if user wants to re-organize paints order in the list or reuse them.
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
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
initialization interfaces has been changed for threads count.
if you want to set concrete threads count by system, please specify thread count with it.
std threads:
tvg::Initializer::init(tvg::CanvasEngine::Sw, std:🧵:hardware_concurrency());
if your system provides designed threads info, you can use it.
efl:
tvg_engine_init(TVG_ENGINE_SW, eina_cpu_count());
I recommend to avoid max threads usage for better performance.
Change-Id: I22cfa315768f73fa941be136956cdbb2cf837c20
Actually Dali rendering system requires abgr8888.
We could add more colorspaces if it's necessary.
Change-Id: Ia42a6575d1313629e55efc3077e302992c47b6c0
We can use RGBA colorspace rather ARGB for pixel data.
This would be better for many rendering system,
since it's more widely preferred than ARGB including opengl.
Change-Id: Ibbfe6a511d77bf0ef30ce261995467c11164d306
picture now affords the memory data as input source so that
user can pass svg data memory directly.
Change-Id: I246c09b682a2d60e53ad556ce0c90337142ee4f1
Introduce internal PaintMethod since there more derived paint classes are coming.
This PaintMethod is a sort of Strategy Pattern method.
Change-Id: I29c49f5d4ddbfb9e429d4976636b20b39914ee20
1. removed async option which doesn't work currently,
rather than it, we can add async option in initiailizer class.
2. removed update() method.
Instead, we can call update(paint = nullptr); which has exactly same behavior.
Change-Id: I7909a50d804b97baf413a2ff6365a3cf79a3689e
transform interfaces are getting duplicated in derived classes.
we moved to the super for smaller apis count.
Applied strategy pattern to hide the inheritance.
Change-Id: I7b0c3ff9317e9bf3c97bb0c849bf55e79ee9a591