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

@ -18,6 +18,7 @@ extern const internal::ItemVTable RectangleVTable;
extern const internal::ItemVTable TextVTable;
extern const internal::ItemVTable TouchAreaVTable;
extern const internal::ItemVTable ImageVTable;
extern const internal::ItemVTable PathVTable;
}
// Bring opaque structure in scope
@ -47,6 +48,7 @@ private:
using internal::EvaluationContext;
using internal::Image;
using internal::Path;
using internal::Rectangle;
using internal::Text;
using internal::TouchArea;

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