rasterization.h 886 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include "Vector2.h"
  3. #include "Shape.h"
  4. #include "Bitmap.h"
  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(Bitmap<float> &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(Bitmap<float> &sdf, const Shape &shape, const Vector2 &scale, const Vector2 &translate, FillRule fillRule = FILL_NONZERO);
  17. void distanceSignCorrection(Bitmap<FloatRGB> &sdf, const Shape &shape, const Vector2 &scale, const Vector2 &translate, FillRule fillRule = FILL_NONZERO);
  18. }