SkShadowTessellator.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright 2017 Google Inc.
  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 SkShadowTessellator_DEFINED
  8. #define SkShadowTessellator_DEFINED
  9. #include "include/core/SkColor.h"
  10. #include "include/core/SkPoint.h"
  11. #include "include/core/SkRefCnt.h"
  12. class SkMatrix;
  13. class SkPath;
  14. struct SkPoint3;
  15. class SkVertices;
  16. namespace SkShadowTessellator {
  17. typedef std::function<SkScalar(SkScalar, SkScalar)> HeightFunc;
  18. /**
  19. * This function generates an ambient shadow mesh for a path by walking the path, outsetting by
  20. * the radius, and setting inner and outer colors to umbraColor and penumbraColor, respectively.
  21. * If transparent is true, then the center of the ambient shadow will be filled in.
  22. */
  23. sk_sp<SkVertices> MakeAmbient(const SkPath& path, const SkMatrix& ctm,
  24. const SkPoint3& zPlane, bool transparent);
  25. /**
  26. * This function generates a spot shadow mesh for a path by walking the transformed path,
  27. * further transforming by the scale and translation, and outsetting and insetting by a radius.
  28. * The center will be clipped against the original path unless transparent is true.
  29. */
  30. sk_sp<SkVertices> MakeSpot(const SkPath& path, const SkMatrix& ctm, const SkPoint3& zPlane,
  31. const SkPoint3& lightPos, SkScalar lightRadius, bool transparent);
  32. }
  33. #endif