import-svg.h 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include <cstddef>
  3. #include "../core/Shape.h"
  4. #ifndef MSDFGEN_DISABLE_SVG
  5. #ifndef MSDFGEN_EXT_PUBLIC
  6. #define MSDFGEN_EXT_PUBLIC // for DLL import/export
  7. #endif
  8. namespace msdfgen {
  9. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_FAILURE;
  10. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_SUCCESS_FLAG;
  11. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_PARTIAL_FAILURE_FLAG;
  12. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_INCOMPLETE_FLAG;
  13. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_UNSUPPORTED_FEATURE_FLAG;
  14. extern MSDFGEN_EXT_PUBLIC const int SVG_IMPORT_TRANSFORMATION_IGNORED_FLAG;
  15. /// Builds a shape from an SVG path string
  16. bool buildShapeFromSvgPath(Shape &shape, const char *pathDef, double endpointSnapRange = 0);
  17. /// Reads a single <path> element found in the specified SVG file and converts it to output Shape
  18. bool loadSvgShape(Shape &output, const char *filename, int pathIndex = 0, Vector2 *dimensions = NULL);
  19. /// 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
  20. int loadSvgShape(Shape &output, Shape::Bounds &viewBox, const char *filename);
  21. }
  22. #endif