mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-27 12:29:41 +00:00
Rename PathElements to PathData
as it can now consists of elements or events.
This commit is contained in:
parent
69325a1a5b
commit
1f7ae1b318
11 changed files with 48 additions and 47 deletions
56
api/sixtyfps-cpp/include/sixtyfps_pathdata.h
Normal file
56
api/sixtyfps-cpp/include/sixtyfps_pathdata.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
#pragma once
|
||||
#include <initializer_list>
|
||||
#include <string_view>
|
||||
#include "sixtyfps_pathdata_internal.h"
|
||||
|
||||
namespace sixtyfps {
|
||||
|
||||
using internal::types::PathArcTo;
|
||||
using internal::types::PathElement;
|
||||
using internal::types::PathEvent;
|
||||
using internal::types::PathLineTo;
|
||||
using internal::types::Point;
|
||||
|
||||
struct PathData
|
||||
{
|
||||
public:
|
||||
using Tag = internal::types::PathData::Tag;
|
||||
|
||||
PathData() : data(Data::None()) { }
|
||||
PathData(const PathElement *firstElement, size_t count)
|
||||
: data(Data::SharedElements(elements_from_array(firstElement, count)))
|
||||
{
|
||||
}
|
||||
|
||||
PathData(const PathEvent *firstEvent, size_t event_count, const Point *firstCoordinate,
|
||||
size_t coordinate_count)
|
||||
: data(events_from_array(firstEvent, event_count, firstCoordinate, coordinate_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;
|
||||
}
|
||||
|
||||
static internal::types::PathData events_from_array(const PathEvent *firstEvent,
|
||||
size_t event_count,
|
||||
const Point *firstCoordinate,
|
||||
size_t coordinate_count)
|
||||
{
|
||||
SharedArray<PathEvent> events;
|
||||
SharedArray<Point> coordinates;
|
||||
sixtyfps_new_path_events(&events, &coordinates, firstEvent, event_count, firstCoordinate,
|
||||
coordinate_count);
|
||||
return Data::PathEvents(events, coordinates);
|
||||
}
|
||||
|
||||
using Data = internal::types::PathData;
|
||||
Data data;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue