2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkCornerPathEffect_DEFINED
|
|
|
|
#define SkCornerPathEffect_DEFINED
|
|
|
|
|
2018-05-21 15:56:57 +00:00
|
|
|
#include "SkFlattenable.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
#include "SkPathEffect.h"
|
|
|
|
|
|
|
|
/** \class SkCornerPathEffect
|
|
|
|
|
|
|
|
SkCornerPathEffect is a subclass of SkPathEffect that can turn sharp corners
|
|
|
|
into various treatments (e.g. rounded corners)
|
|
|
|
*/
|
2011-03-15 21:27:08 +00:00
|
|
|
class SK_API SkCornerPathEffect : public SkPathEffect {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
|
|
|
/** radius must be > 0 to have an effect. It specifies the distance from each corner
|
|
|
|
that should be "rounded".
|
|
|
|
*/
|
2016-03-18 18:22:57 +00:00
|
|
|
static sk_sp<SkPathEffect> Make(SkScalar radius) {
|
2018-05-01 03:08:15 +00:00
|
|
|
return radius > 0 ? sk_sp<SkPathEffect>(new SkCornerPathEffect(radius)) : nullptr;
|
2016-03-18 18:22:57 +00:00
|
|
|
}
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
protected:
|
2017-03-22 16:05:03 +00:00
|
|
|
~SkCornerPathEffect() override;
|
2015-12-21 16:52:45 +00:00
|
|
|
|
2014-05-15 15:40:41 +00:00
|
|
|
explicit SkCornerPathEffect(SkScalar radius);
|
2015-03-26 01:17:31 +00:00
|
|
|
void flatten(SkWriteBuffer&) const override;
|
2018-08-16 17:22:16 +00:00
|
|
|
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
private:
|
2018-10-18 21:27:16 +00:00
|
|
|
SK_FLATTENABLE_HOOKS(SkCornerPathEffect)
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
SkScalar fRadius;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
typedef SkPathEffect INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|