2
0

msdf-error-correction.h 1.9 KB

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