blob: 4c8908575db241f581e3c9f6e5fd857f69f7cdfb [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 SkCornerPathEffect_DEFINED
9#define SkCornerPathEffect_DEFINED
10
11#include "SkPathEffect.h"
12
13/** \class SkCornerPathEffect
14
15 SkCornerPathEffect is a subclass of SkPathEffect that can turn sharp corners
16 into various treatments (e.g. rounded corners)
17*/
ctguil@chromium.org7ffb1b22011-03-15 21:27:08 +000018class SK_API SkCornerPathEffect : public SkPathEffect {
reed@android.com8a1c16f2008-12-17 15:59:43 +000019public:
20 /** radius must be > 0 to have an effect. It specifies the distance from each corner
21 that should be "rounded".
22 */
reed2d6ba662015-12-20 20:08:42 -080023 static SkCornerPathEffect* Create(SkScalar radius) { return new SkCornerPathEffect(radius); }
24 virtual ~SkCornerPathEffect();
reed@android.com8a1c16f2008-12-17 15:59:43 +000025
reed@google.com548a1f32012-12-18 16:12:09 +000026 virtual bool filterPath(SkPath* dst, const SkPath& src,
mtklein36352bf2015-03-25 18:17:31 -070027 SkStrokeRec*, const SkRect*) const override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000028
robertphillips42dbfa82015-01-26 06:08:52 -080029 SK_TO_STRING_OVERRIDE()
djsollen@google.comba28d032012-03-26 17:57:35 +000030 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect)
reed@google.com6bac9472011-06-21 19:24:00 +000031
tomhudson64de1e12015-03-05 08:01:07 -080032#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
mtklein36352bf2015-03-25 18:17:31 -070033 bool exposedInAndroidJavaAPI() const override { return true; }
tomhudson64de1e12015-03-05 08:01:07 -080034#endif
35
reed@android.com8a1c16f2008-12-17 15:59:43 +000036protected:
commit-bot@chromium.orgbd0be252014-05-15 15:40:41 +000037 explicit SkCornerPathEffect(SkScalar radius);
mtklein36352bf2015-03-25 18:17:31 -070038 void flatten(SkWriteBuffer&) const override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000039
40private:
41 SkScalar fRadius;
rmistry@google.comfbfcd562012-08-23 18:09:54 +000042
reed@android.com8a1c16f2008-12-17 15:59:43 +000043 typedef SkPathEffect INHERITED;
44};
45
46#endif