GrDistanceFieldGenFromVector.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright 2017 ARM Ltd.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #ifndef GrDistanceFieldGenFromVector_DEFINED
  8. #define GrDistanceFieldGenFromVector_DEFINED
  9. #include "include/core/SkPath.h"
  10. class SkMatrix;
  11. #ifndef SK_USE_LEGACY_DISTANCE_FIELDS
  12. #define SK_USE_LEGACY_DISTANCE_FIELDS
  13. #endif
  14. /** Given a vector path, generate the associated distance field.
  15. * @param distanceField The distance field to be generated. Should already be allocated
  16. * by the client with the padding defined in "SkDistanceFieldGen.h".
  17. * @param path The path we're using to generate the distance field.
  18. * @param matrix Transformation matrix for path.
  19. * @param width Width of the distance field.
  20. * @param height Height of the distance field.
  21. * @param rowBytes Size of each row in the distance field, in bytes.
  22. */
  23. bool GrGenerateDistanceFieldFromPath(unsigned char* distanceField,
  24. const SkPath& path, const SkMatrix& viewMatrix,
  25. int width, int height, size_t rowBytes);
  26. inline bool IsDistanceFieldSupportedFillType(SkPath::FillType fFillType)
  27. {
  28. return (SkPath::kEvenOdd_FillType == fFillType ||
  29. SkPath::kInverseEvenOdd_FillType == fFillType);
  30. }
  31. #endif