| 1 |  | 
|---|
| 2 | #pragma once | 
|---|
| 3 |  | 
|---|
| 4 | #include "Shape.h" | 
|---|
| 5 | #include "edge-selectors.h" | 
|---|
| 6 |  | 
|---|
| 7 | namespace msdfgen { | 
|---|
| 8 |  | 
|---|
| 9 | /// Simply selects the nearest contour. | 
|---|
| 10 | template <class EdgeSelector> | 
|---|
| 11 | class SimpleContourCombiner { | 
|---|
| 12 |  | 
|---|
| 13 | public: | 
|---|
| 14 | typedef EdgeSelector EdgeSelectorType; | 
|---|
| 15 | typedef typename EdgeSelector::DistanceType DistanceType; | 
|---|
| 16 |  | 
|---|
| 17 | explicit SimpleContourCombiner(const Shape &shape); | 
|---|
| 18 | void reset(const Point2 &p); | 
|---|
| 19 | EdgeSelector & edgeSelector(int i); | 
|---|
| 20 | DistanceType distance() const; | 
|---|
| 21 |  | 
|---|
| 22 | private: | 
|---|
| 23 | EdgeSelector shapeEdgeSelector; | 
|---|
| 24 |  | 
|---|
| 25 | }; | 
|---|
| 26 |  | 
|---|
| 27 | /// Selects the nearest contour that actually forms a border between filled and unfilled area. | 
|---|
| 28 | template <class EdgeSelector> | 
|---|
| 29 | class OverlappingContourCombiner { | 
|---|
| 30 |  | 
|---|
| 31 | public: | 
|---|
| 32 | typedef EdgeSelector EdgeSelectorType; | 
|---|
| 33 | typedef typename EdgeSelector::DistanceType DistanceType; | 
|---|
| 34 |  | 
|---|
| 35 | explicit OverlappingContourCombiner(const Shape &shape); | 
|---|
| 36 | void reset(const Point2 &p); | 
|---|
| 37 | EdgeSelector & edgeSelector(int i); | 
|---|
| 38 | DistanceType distance() const; | 
|---|
| 39 |  | 
|---|
| 40 | private: | 
|---|
| 41 | Point2 p; | 
|---|
| 42 | std::vector<int> windings; | 
|---|
| 43 | std::vector<EdgeSelector> edgeSelectors; | 
|---|
| 44 |  | 
|---|
| 45 | }; | 
|---|
| 46 |  | 
|---|
| 47 | } | 
|---|
| 48 |  | 
|---|