SkCornerPathEffect.h revision 8a1c16ff38322f0210116fa7293eb8817c7e477e
1/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef SkCornerPathEffect_DEFINED
18#define SkCornerPathEffect_DEFINED
19
20#include "SkPathEffect.h"
21
22/** \class SkCornerPathEffect
23
24    SkCornerPathEffect is a subclass of SkPathEffect that can turn sharp corners
25    into various treatments (e.g. rounded corners)
26*/
27class SkCornerPathEffect : public SkPathEffect {
28public:
29    /** radius must be > 0 to have an effect. It specifies the distance from each corner
30        that should be "rounded".
31    */
32    SkCornerPathEffect(SkScalar radius);
33    virtual ~SkCornerPathEffect();
34
35    // overrides for SkPathEffect
36    //  This method is not exported to java.
37    virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
38
39    // overrides for SkFlattenable
40    //  This method is not exported to java.
41    virtual Factory getFactory();
42    //  This method is not exported to java.
43    virtual void flatten(SkFlattenableWriteBuffer&);
44
45protected:
46    SkCornerPathEffect(SkFlattenableReadBuffer&);
47
48private:
49    SkScalar    fRadius;
50
51    static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
52
53    // illegal
54    SkCornerPathEffect(const SkCornerPathEffect&);
55    SkCornerPathEffect& operator=(const SkCornerPathEffect&);
56
57    typedef SkPathEffect INHERITED;
58};
59
60#endif
61
62