2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkDashPathEffect_DEFINED
|
|
|
|
#define SkDashPathEffect_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkPathEffect.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2017-05-24 03:00:14 +00:00
|
|
|
class SK_API SkDashPathEffect {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
2012-04-27 13:34:52 +00:00
|
|
|
/** intervals: array containing an even number of entries (>=2), with
|
|
|
|
the even indices specifying the length of "on" intervals, and the odd
|
2018-11-03 11:51:19 +00:00
|
|
|
indices specifying the length of "off" intervals. This array will be
|
|
|
|
copied in Make, and can be disposed of freely after.
|
2012-08-23 18:09:54 +00:00
|
|
|
count: number of elements in the intervals array
|
2012-04-27 13:34:52 +00:00
|
|
|
phase: offset into the intervals array (mod the sum of all of the
|
|
|
|
intervals).
|
|
|
|
|
|
|
|
For example: if intervals[] = {10, 20}, count = 2, and phase = 25,
|
|
|
|
this will set up a dashed path like so:
|
|
|
|
5 pixels off
|
|
|
|
10 pixels on
|
|
|
|
20 pixels off
|
|
|
|
10 pixels on
|
|
|
|
20 pixels off
|
|
|
|
...
|
|
|
|
A phase of -5, 25, 55, 85, etc. would all result in the same path,
|
|
|
|
because the sum of all the intervals is 30.
|
|
|
|
|
|
|
|
Note: only affects stroked paths.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
2016-03-18 18:22:57 +00:00
|
|
|
static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase);
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|