| 1 | |
| 2 | #pragma once |
| 3 | |
| 4 | #include "Shape.h" |
| 5 | |
| 6 | #define MSDFGEN_EDGE_LENGTH_PRECISION 4 |
| 7 | |
| 8 | namespace msdfgen { |
| 9 | |
| 10 | /** Assigns colors to edges of the shape in accordance to the multi-channel distance field technique. |
| 11 | * May split some edges if necessary. |
| 12 | * angleThreshold specifies the maximum angle (in radians) to be considered a corner, for example 3 (~172 degrees). |
| 13 | * Values below 1/2 PI will be treated as the external angle. |
| 14 | */ |
| 15 | void edgeColoringSimple(Shape &shape, double angleThreshold, unsigned long long seed = 0); |
| 16 | |
| 17 | /** The alternative "ink trap" coloring strategy is designed for better results with typefaces |
| 18 | * that use ink traps as a design feature. It guarantees that even if all edges that are shorter than |
| 19 | * both their neighboring edges are removed, the coloring remains consistent with the established rules. |
| 20 | */ |
| 21 | void edgeColoringInkTrap(Shape &shape, double angleThreshold, unsigned long long seed = 0); |
| 22 | |
| 23 | /** The alternative coloring by distance tries to use different colors for edges that are close together. |
| 24 | * This should theoretically be the best strategy on average. However, since it needs to compute the distance |
| 25 | * between all pairs of edges, and perform a graph optimization task, it is much slower than the rest. |
| 26 | */ |
| 27 | void edgeColoringByDistance(Shape &shape, double angleThreshold, unsigned long long seed = 0); |
| 28 | |
| 29 | } |
| 30 | |