mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +00:00
Add the rendering primitives for rendering a path
Right now the path is limited to polygons (only LineTo elements) and only the fill color can be specified.
This commit is contained in:
parent
e4ab64f858
commit
4e22c2839e
11 changed files with 335 additions and 54 deletions
34
api/sixtyfps-cpp/include/sixtyfps_pathelements.h
Normal file
34
api/sixtyfps-cpp/include/sixtyfps_pathelements.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
#include <initializer_list>
|
||||
#include <string_view>
|
||||
#include "sixtyfps_pathelements_internal.h"
|
||||
|
||||
namespace sixtyfps {
|
||||
|
||||
using internal::types::PathElement;
|
||||
|
||||
struct PathElements
|
||||
{
|
||||
public:
|
||||
using Tag = internal::types::PathElements::Tag;
|
||||
|
||||
PathElements() : data(Data::None()) { }
|
||||
PathElements(const PathElement *firstElement, size_t count)
|
||||
: data(Data::SharedElements(elements_from_array(firstElement, count)))
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
static SharedArray<PathElement> elements_from_array(const PathElement *firstElement,
|
||||
size_t count)
|
||||
{
|
||||
SharedArray<PathElement> tmp;
|
||||
sixtyfps_new_path_elements(&tmp, firstElement, count);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
using Data = internal::types::PathElements;
|
||||
Data data;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue