blob: d6ca9122e662f20276b60176d1530eab27c49d74 [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00003 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00004 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00006 */
7
8#ifndef SkDashPathEffect_DEFINED
9#define SkDashPathEffect_DEFINED
10
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkPathEffect.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000012
Mike Reed76f70622017-05-23 23:00:14 -040013class SK_API SkDashPathEffect {
reed@android.com8a1c16f2008-12-17 15:59:43 +000014public:
epoger@google.com20bf4ca2012-04-27 13:34:52 +000015 /** intervals: array containing an even number of entries (>=2), with
16 the even indices specifying the length of "on" intervals, and the odd
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040017 indices specifying the length of "off" intervals. This array will be
18 copied in Make, and can be disposed of freely after.
rmistry@google.comfbfcd562012-08-23 18:09:54 +000019 count: number of elements in the intervals array
epoger@google.com20bf4ca2012-04-27 13:34:52 +000020 phase: offset into the intervals array (mod the sum of all of the
21 intervals).
22
23 For example: if intervals[] = {10, 20}, count = 2, and phase = 25,
24 this will set up a dashed path like so:
25 5 pixels off
26 10 pixels on
27 20 pixels off
28 10 pixels on
29 20 pixels off
30 ...
31 A phase of -5, 25, 55, 85, etc. would all result in the same path,
32 because the sum of all the intervals is 30.
33
34 Note: only affects stroked paths.
reed@android.com8a1c16f2008-12-17 15:59:43 +000035 */
reeda4393342016-03-18 11:22:57 -070036 static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase);
reed@android.com8a1c16f2008-12-17 15:59:43 +000037};
38
39#endif