rasterization.h 924 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include "Vector2.h"
  3. #include "Shape.h"
  4. #include "BitmapRef.hpp"
  5. namespace msdfgen {
  6. /// Fill rule dictates how intersection total is interpreted during rasterization.
  7. enum FillRule {
  8. FILL_NONZERO,
  9. FILL_ODD, // "even-odd"
  10. FILL_POSITIVE,
  11. FILL_NEGATIVE
  12. };
  13. /// Rasterizes the shape into a monochrome bitmap.
  14. void rasterize(const BitmapRef<float, 1> &output, const Shape &shape, const Vector2 &scale, const Vector2 &translate, FillRule fillRule = FILL_NONZERO);
  15. /// Fixes the sign of the input signed distance field, so that it matches the shape's rasterized fill.
  16. void distanceSignCorrection(const BitmapRef<float, 1> &sdf, const Shape &shape, const Vector2 &scale, const Vector2 &translate, FillRule fillRule = FILL_NONZERO);
  17. void distanceSignCorrection(const BitmapRef<float, 3> &sdf, const Shape &shape, const Vector2 &scale, const Vector2 &translate, FillRule fillRule = FILL_NONZERO);
  18. }