blob: fcf4a3a5dc5cd1273971fbafdf159a53d2b98a1f [file] [log] [blame]
reed8b575242014-12-17 01:47:32 -08001/*
2 * Copyright 2014 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
8#ifndef SkArcToPathEffect_DEFINED
9#define SkArcToPathEffect_DEFINED
10
11#include "SkPathEffect.h"
12
13class SK_API SkArcToPathEffect : public SkPathEffect {
14public:
15 /** radius must be > 0 to have an effect. It specifies the distance from each corner
16 that should be "rounded".
17 */
reeda4393342016-03-18 11:22:57 -070018 static sk_sp<SkPathEffect> Make(SkScalar radius) {
reed8b575242014-12-17 01:47:32 -080019 if (radius <= 0) {
20 return NULL;
21 }
reeda4393342016-03-18 11:22:57 -070022 return sk_sp<SkPathEffect>(new SkArcToPathEffect(radius));
reed8b575242014-12-17 01:47:32 -080023 }
24
mtklein36352bf2015-03-25 18:17:31 -070025 bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
reed8b575242014-12-17 01:47:32 -080026
robertphillips42dbfa82015-01-26 06:08:52 -080027 SK_TO_STRING_OVERRIDE()
reed8b575242014-12-17 01:47:32 -080028 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArcToPathEffect)
29
30protected:
31 explicit SkArcToPathEffect(SkScalar radius);
mtklein36352bf2015-03-25 18:17:31 -070032 void flatten(SkWriteBuffer&) const override;
reed8b575242014-12-17 01:47:32 -080033
34private:
35 SkScalar fRadius;
36
37 typedef SkPathEffect INHERITED;
38};
39
40#endif