1 | |
2 | #pragma once |
3 | |
4 | #include "Vector2.h" |
5 | #include "Projection.h" |
6 | #include "Shape.h" |
7 | #include "BitmapRef.hpp" |
8 | #include "generator-config.h" |
9 | |
10 | namespace msdfgen { |
11 | |
12 | /// Predicts potential artifacts caused by the interpolation of the MSDF and corrects them by converting nearby texels to single-channel. |
13 | void msdfErrorCorrection(const BitmapRef<float, 3> &sdf, const Shape &shape, const Projection &projection, double range, const MSDFGeneratorConfig &config = MSDFGeneratorConfig()); |
14 | void msdfErrorCorrection(const BitmapRef<float, 4> &sdf, const Shape &shape, const Projection &projection, double range, const MSDFGeneratorConfig &config = MSDFGeneratorConfig()); |
15 | |
16 | /// Applies the simplified error correction to all discontiunous distances (INDISCRIMINATE mode). Does not need shape or translation. |
17 | void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, double range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio); |
18 | void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, double range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio); |
19 | |
20 | /// Applies the simplified error correction to edges only (EDGE_ONLY mode). Does not need shape or translation. |
21 | void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, double range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio); |
22 | void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, double range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio); |
23 | |
24 | /// The original version of the error correction algorithm. |
25 | void msdfErrorCorrection_legacy(const BitmapRef<float, 3> &output, const Vector2 &threshold); |
26 | void msdfErrorCorrection_legacy(const BitmapRef<float, 4> &output, const Vector2 &threshold); |
27 | |
28 | } |
29 | |