import-svg.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <cstddef>
  3. #include "../core/types.h"
  4. #include "../core/Shape.h"
  5. #ifndef MSDFGEN_DISABLE_SVG
  6. #ifndef MSDFGEN_EXT_PUBLIC
  7. #define MSDFGEN_EXT_PUBLIC // for DLL import/export
  8. #endif
  9. namespace msdfgen {
  10. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_FAILURE;
  11. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_SUCCESS_FLAG;
  12. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_PARTIAL_FAILURE_FLAG;
  13. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_INCOMPLETE_FLAG;
  14. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_UNSUPPORTED_FEATURE_FLAG;
  15. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_TRANSFORMATION_IGNORED_FLAG;
  16. /// Builds a shape from an SVG path string
  17. bool buildShapeFromSvgPath(Shape &shape, const char *pathDef, real endpointSnapRange = 0);
  18. /// Reads a single <path> element found in the specified SVG file and converts it to output Shape
  19. bool loadSvgShape(Shape &output, const char *filename, int pathIndex = 0, Vector2 *dimensions = NULL);
  20. /// New version - if Skia is available, reads the entire geometry of the SVG file into the output Shape, otherwise may only read one path, returns SVG import flags
  21. int loadSvgShape(Shape &output, Shape::Bounds &viewBox, const char *filename);
  22. }
  23. #endif