reed | 8b57524 | 2014-12-17 01:47:32 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 13 | class SK_API SkArcToPathEffect : public SkPathEffect { |
| 14 | public: |
| 15 | /** radius must be > 0 to have an effect. It specifies the distance from each corner |
| 16 | that should be "rounded". |
| 17 | */ |
reed | a439334 | 2016-03-18 11:22:57 -0700 | [diff] [blame^] | 18 | static sk_sp<SkPathEffect> Make(SkScalar radius) { |
reed | 8b57524 | 2014-12-17 01:47:32 -0800 | [diff] [blame] | 19 | if (radius <= 0) { |
| 20 | return NULL; |
| 21 | } |
reed | a439334 | 2016-03-18 11:22:57 -0700 | [diff] [blame^] | 22 | return sk_sp<SkPathEffect>(new SkArcToPathEffect(radius)); |
reed | 8b57524 | 2014-12-17 01:47:32 -0800 | [diff] [blame] | 23 | } |
| 24 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 25 | bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; |
reed | 8b57524 | 2014-12-17 01:47:32 -0800 | [diff] [blame] | 26 | |
robertphillips | 42dbfa8 | 2015-01-26 06:08:52 -0800 | [diff] [blame] | 27 | SK_TO_STRING_OVERRIDE() |
reed | 8b57524 | 2014-12-17 01:47:32 -0800 | [diff] [blame] | 28 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArcToPathEffect) |
| 29 | |
| 30 | protected: |
| 31 | explicit SkArcToPathEffect(SkScalar radius); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 32 | void flatten(SkWriteBuffer&) const override; |
reed | 8b57524 | 2014-12-17 01:47:32 -0800 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | SkScalar fRadius; |
| 36 | |
| 37 | typedef SkPathEffect INHERITED; |
| 38 | }; |
| 39 | |
| 40 | #endif |