The configuration of the MSDF error correction pass.
| 11 | |
| 12 | /// The configuration of the MSDF error correction pass. |
| 13 | struct ErrorCorrectionConfig { |
| 14 | /// The default value of minDeviationRatio. |
| 15 | static MSDFGEN_PUBLIC const double defaultMinDeviationRatio; |
| 16 | /// The default value of minImproveRatio. |
| 17 | static MSDFGEN_PUBLIC const double defaultMinImproveRatio; |
| 18 | |
| 19 | /// Mode of operation. |
| 20 | enum Mode { |
| 21 | /// Skips error correction pass. |
| 22 | DISABLED, |
| 23 | /// Corrects all discontinuities of the distance field regardless if edges are adversely affected. |
| 24 | INDISCRIMINATE, |
| 25 | /// Corrects artifacts at edges and other discontinuous distances only if it does not affect edges or corners. |
| 26 | EDGE_PRIORITY, |
| 27 | /// Only corrects artifacts at edges. |
| 28 | EDGE_ONLY |
| 29 | } mode; |
| 30 | /// Configuration of whether to use an algorithm that computes the exact shape distance at the positions of suspected artifacts. This algorithm can be much slower. |
| 31 | enum DistanceCheckMode { |
| 32 | /// Never computes exact shape distance. |
| 33 | DO_NOT_CHECK_DISTANCE, |
| 34 | /// Only computes exact shape distance at edges. Provides a good balance between speed and precision. |
| 35 | CHECK_DISTANCE_AT_EDGE, |
| 36 | /// Computes and compares the exact shape distance for each suspected artifact. |
| 37 | ALWAYS_CHECK_DISTANCE |
| 38 | } distanceCheckMode; |
| 39 | /// The minimum ratio between the actual and maximum expected distance delta to be considered an error. |
| 40 | double minDeviationRatio; |
| 41 | /// The minimum ratio between the pre-correction distance error and the post-correction distance error. Has no effect for DO_NOT_CHECK_DISTANCE. |
| 42 | double minImproveRatio; |
| 43 | /// An optional buffer to avoid dynamic allocation. Must have at least as many bytes as the MSDF has pixels. |
| 44 | byte *buffer; |
| 45 | |
| 46 | inline explicit ErrorCorrectionConfig(Mode mode = EDGE_PRIORITY, DistanceCheckMode distanceCheckMode = CHECK_DISTANCE_AT_EDGE, double minDeviationRatio = defaultMinDeviationRatio, double minImproveRatio = defaultMinImproveRatio, byte *buffer = NULL) : mode(mode), distanceCheckMode(distanceCheckMode), minDeviationRatio(minDeviationRatio), minImproveRatio(minImproveRatio), buffer(buffer) { } |
| 47 | }; |
| 48 | |
| 49 | /// The configuration of the distance field generator algorithm. |
| 50 | struct GeneratorConfig { |
no outgoing calls
no test coverage detected