| 17 | } |
| 18 | |
| 19 | void distanceSignCorrection(BitmapSection<float, 1> sdf, const Shape &shape, const Projection &projection, float sdfZeroValue, FillRule fillRule) { |
| 20 | sdf.reorient(shape.getYAxisOrientation()); |
| 21 | float doubleSdfZeroValue = sdfZeroValue+sdfZeroValue; |
| 22 | Scanline scanline; |
| 23 | for (int y = 0; y < sdf.height; ++y) { |
| 24 | shape.scanline(scanline, projection.unprojectY(y+.5)); |
| 25 | for (int x = 0; x < sdf.width; ++x) { |
| 26 | bool fill = scanline.filled(projection.unprojectX(x+.5), fillRule); |
| 27 | float &sd = *sdf(x, y); |
| 28 | if ((sd > sdfZeroValue) != fill) |
| 29 | sd = doubleSdfZeroValue-sd; |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | template <int N> |
| 35 | static void multiDistanceSignCorrection(BitmapSection<float, N> sdf, const Shape &shape, const Projection &projection, float sdfZeroValue, FillRule fillRule) { |
no test coverage detected