Shape.h 901 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <vector>
  3. #include "Contour.h"
  4. namespace msdfgen {
  5. /// Vector shape representation.
  6. class Shape {
  7. public:
  8. /// The list of contours the shape consists of.
  9. std::vector<Contour> contours;
  10. /// Specifies whether the shape uses bottom-to-top (false) or top-to-bottom (true) Y coordinates.
  11. bool inverseYAxis;
  12. Shape();
  13. /// Adds a contour.
  14. void addContour(const Contour &contour);
  15. #ifdef MSDFGEN_USE_CPP11
  16. void addContour(Contour &&contour);
  17. #endif
  18. /// Adds a blank contour and returns its reference.
  19. Contour & addContour();
  20. /// Normalizes the shape geometry for distance field generation.
  21. void normalize();
  22. /// Performs basic checks to determine if the object represents a valid shape.
  23. bool validate() const;
  24. /// Computes the shape's bounding box.
  25. void bounds(double &l, double &b, double &r, double &t) const;
  26. };
  27. }