mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 05:44:52 +00:00
Add support for SVG commands in Path elements
Using the commands property we can just paste SVG paths. This makes it much easier to write examples/demos. A good online path designer is for example https://codepen.io/anthonydugois/pen/mewdyZ
This commit is contained in:
parent
be60079f21
commit
251ef7fc97
14 changed files with 433 additions and 89 deletions
|
@ -7,6 +7,12 @@ namespace sixtyfps {
|
|||
|
||||
using internal::types::PathArcTo;
|
||||
using internal::types::PathElement;
|
||||
using internal::types::PathEvent;
|
||||
using internal::types::PathEventBegin;
|
||||
using internal::types::PathEventCubic;
|
||||
using internal::types::PathEventEnd;
|
||||
using internal::types::PathEventLine;
|
||||
using internal::types::PathEventQuadratic;
|
||||
using internal::types::PathLineTo;
|
||||
|
||||
struct PathElements
|
||||
|
@ -20,6 +26,11 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
PathElements(const PathEvent *firstEvent, size_t count)
|
||||
: data(Data::PathEvents(events_from_array(firstEvent, count)))
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
static SharedArray<PathElement> elements_from_array(const PathElement *firstElement,
|
||||
size_t count)
|
||||
|
@ -29,6 +40,13 @@ private:
|
|||
return tmp;
|
||||
}
|
||||
|
||||
static SharedArray<PathEvent> events_from_array(const PathEvent *firstEvent, size_t count)
|
||||
{
|
||||
SharedArray<PathEvent> tmp;
|
||||
sixtyfps_new_path_events(&tmp, firstEvent, count);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
using Data = internal::types::PathElements;
|
||||
Data data;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue