blob: 6b75da66e3fb1d7d7d07b575026466d41fb3a294 [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 */
commit-bot@chromium.org0a2bf902014-02-20 20:40:19 +000023 static SkCornerPathEffect* Create(SkScalar radius) {
24 return SkNEW_ARGS(SkCornerPathEffect, (radius));
25 }
reed@android.com8a1c16f2008-12-17 15:59:43 +000026 virtual ~SkCornerPathEffect();
27
reed@google.com548a1f32012-12-18 16:12:09 +000028 virtual bool filterPath(SkPath* dst, const SkPath& src,
reed@google.com4bbdeac2013-01-24 21:03:11 +000029 SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000030
djsollen@google.comba28d032012-03-26 17:57:35 +000031 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect)
reed@google.com6bac9472011-06-21 19:24:00 +000032
reed@android.com8a1c16f2008-12-17 15:59:43 +000033protected:
commit-bot@chromium.orgbd0be252014-05-15 15:40:41 +000034 explicit SkCornerPathEffect(SkScalar radius);
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000035 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000036
37private:
38 SkScalar fRadius;
rmistry@google.comfbfcd562012-08-23 18:09:54 +000039
reed@android.com8a1c16f2008-12-17 15:59:43 +000040 typedef SkPathEffect INHERITED;
41};
42
43#endif