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:
Simon Hausmann 2020-06-29 20:21:51 +02:00
parent e4ab64f858
commit 4e22c2839e
11 changed files with 335 additions and 54 deletions

View 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;
};
}