SkCornerPathEffect.h revision fe17456d5e528078ce69b5f15cf7adf1fab963f9
1/* 2 * Copyright 2006 The Android Open Source Project 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 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*/ 18class SK_API SkCornerPathEffect : public SkPathEffect { 19public: 20 /** radius must be > 0 to have an effect. It specifies the distance from each corner 21 that should be "rounded". 22 */ 23 static sk_sp<SkPathEffect> Make(SkScalar radius) { 24 return sk_sp<SkPathEffect>(new SkCornerPathEffect(radius)); 25 } 26 27 virtual bool filterPath(SkPath* dst, const SkPath& src, 28 SkStrokeRec*, const SkRect*) const override; 29 30 SK_TO_STRING_OVERRIDE() 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect) 32 33#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 34 bool exposedInAndroidJavaAPI() const override { return true; } 35#endif 36 37protected: 38 ~SkCornerPathEffect() override; 39 40 explicit SkCornerPathEffect(SkScalar radius); 41 void flatten(SkWriteBuffer&) const override; 42 43private: 44 SkScalar fRadius; 45 46 typedef SkPathEffect INHERITED; 47}; 48 49#endif 50