estimate-sdf-error.h 1.3 KB

123456789101112131415161718192021
  1. #pragma once
  2. #include "Vector2.h"
  3. #include "Scanline.h"
  4. #include "Shape.h"
  5. #include "BitmapRef.hpp"
  6. namespace msdfgen {
  7. /// Analytically constructs a scanline at y evaluating fill by linear interpolation of the SDF.
  8. void scanlineSDF(Scanline &line, const BitmapConstRef<float, 1> &sdf, const Vector2 &scale, const Vector2 &translate, bool inverseYAxis, double y);
  9. void scanlineSDF(Scanline &line, const BitmapConstRef<float, 3> &sdf, const Vector2 &scale, const Vector2 &translate, bool inverseYAxis, double y);
  10. void scanlineSDF(Scanline &line, const BitmapConstRef<float, 4> &sdf, const Vector2 &scale, const Vector2 &translate, bool inverseYAxis, double y);
  11. /// Estimates the portion of the area that will be filled incorrectly when rendering using the SDF.
  12. double estimateSDFError(const BitmapConstRef<float, 1> &sdf, const Shape &shape, const Vector2 &scale, const Vector2 &translate, int scanlinesPerRow, FillRule fillRule = FILL_NONZERO);
  13. double estimateSDFError(const BitmapConstRef<float, 3> &sdf, const Shape &shape, const Vector2 &scale, const Vector2 &translate, int scanlinesPerRow, FillRule fillRule = FILL_NONZERO);
  14. double estimateSDFError(const BitmapConstRef<float, 4> &sdf, const Shape &shape, const Vector2 &scale, const Vector2 &translate, int scanlinesPerRow, FillRule fillRule = FILL_NONZERO);
  15. }