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
10namespace msdfgen {
11
12/// Predicts potential artifacts caused by the interpolation of the MSDF and corrects them by converting nearby texels to single-channel.
13void msdfErrorCorrection(const BitmapRef<float, 3> &sdf, const Shape &shape, const Projection &projection, double range, const MSDFGeneratorConfig &config = MSDFGeneratorConfig());
14void 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.
17void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, double range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
18void 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.
21void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, double range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
22void 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.
25void msdfErrorCorrection_legacy(const BitmapRef<float, 3> &output, const Vector2 &threshold);
26void msdfErrorCorrection_legacy(const BitmapRef<float, 4> &output, const Vector2 &threshold);
27
28}
29