blob: f7429563ada7121a3d68d58a7c4e3113cbd43e70 [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
11#include "SkPathEffect.h"
12
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
17 indices specifying the length of "off" intervals.
rmistry@google.comfbfcd562012-08-23 18:09:54 +000018 count: number of elements in the intervals array
epoger@google.com20bf4ca2012-04-27 13:34:52 +000019 phase: offset into the intervals array (mod the sum of all of the
20 intervals).
21
22 For example: if intervals[] = {10, 20}, count = 2, and phase = 25,
23 this will set up a dashed path like so:
24 5 pixels off
25 10 pixels on
26 20 pixels off
27 10 pixels on
28 20 pixels off
29 ...
30 A phase of -5, 25, 55, 85, etc. would all result in the same path,
31 because the sum of all the intervals is 30.
32
33 Note: only affects stroked paths.
reed@android.com8a1c16f2008-12-17 15:59:43 +000034 */
reeda4393342016-03-18 11:22:57 -070035 static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase);
reed@android.com8a1c16f2008-12-17 15:59:43 +000036};
37
38#endif