SkDashPathEffect.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright 2006 The Android Open Source Project
  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 SkDashPathEffect_DEFINED
  8. #define SkDashPathEffect_DEFINED
  9. #include "SkPathEffect.h"
  10. class SK_API SkDashPathEffect {
  11. public:
  12. /** intervals: array containing an even number of entries (>=2), with
  13. the even indices specifying the length of "on" intervals, and the odd
  14. indices specifying the length of "off" intervals. This array will be
  15. copied in Make, and can be disposed of freely after.
  16. count: number of elements in the intervals array
  17. phase: offset into the intervals array (mod the sum of all of the
  18. intervals).
  19. For example: if intervals[] = {10, 20}, count = 2, and phase = 25,
  20. this will set up a dashed path like so:
  21. 5 pixels off
  22. 10 pixels on
  23. 20 pixels off
  24. 10 pixels on
  25. 20 pixels off
  26. ...
  27. A phase of -5, 25, 55, 85, etc. would all result in the same path,
  28. because the sum of all the intervals is 30.
  29. Note: only affects stroked paths.
  30. */
  31. static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase);
  32. };
  33. #endif