• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* libs/graphics/animator/SkPathParts.h
2 **
3 ** Copyright 2006, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 **     http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
18 #ifndef SkPathParts_DEFINED
19 #define SkPathParts_DEFINED
20 
21 #include "SkDisplayable.h"
22 #include "SkMemberInfo.h"
23 #include "SkPath.h"
24 
25 class SkDrawPath;
26 class SkDrawMatrix;
27 
28 class SkPathPart : public SkDisplayable {
29 public:
30     SkPathPart();
31     virtual bool add() = 0;
32     virtual void dirty();
33     virtual SkDisplayable* getParent() const;
34     virtual bool setParent(SkDisplayable* parent);
35 #ifdef SK_DEBUG
isPathPart()36     virtual bool isPathPart() const { return true; }
37 #endif
38 protected:
39     SkDrawPath* fPath;
40 };
41 
42 class SkMoveTo : public SkPathPart {
43     DECLARE_MEMBER_INFO(MoveTo);
44     SkMoveTo();
45     virtual bool add();
46 protected:
47     SkScalar x;
48     SkScalar y;
49 };
50 
51 class SkRMoveTo : public SkMoveTo {
52     DECLARE_MEMBER_INFO(RMoveTo);
53     virtual bool add();
54 private:
55     typedef SkMoveTo INHERITED;
56 };
57 
58 class SkLineTo : public SkPathPart {
59     DECLARE_MEMBER_INFO(LineTo);
60     SkLineTo();
61     virtual bool add();
62 protected:
63     SkScalar x;
64     SkScalar y;
65 };
66 
67 class SkRLineTo : public SkLineTo {
68     DECLARE_MEMBER_INFO(RLineTo);
69     virtual bool add();
70 private:
71     typedef SkLineTo INHERITED;
72 };
73 
74 class SkQuadTo : public SkPathPart {
75     DECLARE_MEMBER_INFO(QuadTo);
76     SkQuadTo();
77     virtual bool add();
78 protected:
79     SkScalar x1;
80     SkScalar y1;
81     SkScalar x2;
82     SkScalar y2;
83 };
84 
85 class SkRQuadTo : public SkQuadTo {
86     DECLARE_MEMBER_INFO(RQuadTo);
87     virtual bool add();
88 private:
89     typedef SkQuadTo INHERITED;
90 };
91 
92 class SkCubicTo : public SkPathPart {
93     DECLARE_MEMBER_INFO(CubicTo);
94     SkCubicTo();
95     virtual bool add();
96 protected:
97     SkScalar x1;
98     SkScalar y1;
99     SkScalar x2;
100     SkScalar y2;
101     SkScalar x3;
102     SkScalar y3;
103 };
104 
105 class SkRCubicTo : public SkCubicTo {
106     DECLARE_MEMBER_INFO(RCubicTo);
107     virtual bool add();
108 private:
109     typedef SkCubicTo INHERITED;
110 };
111 
112 class SkClose : public SkPathPart {
113     DECLARE_EMPTY_MEMBER_INFO(Close);
114     virtual bool add();
115 };
116 
117 class SkAddGeom : public SkPathPart {
118     DECLARE_PRIVATE_MEMBER_INFO(AddGeom);
119     SkAddGeom();
120 protected:
121     int /*SkPath::Direction*/ direction;
122 };
123 
124 class SkAddRect : public SkAddGeom {
125     DECLARE_MEMBER_INFO(AddRect);
126     SkAddRect();
127     virtual bool add();
128 protected:
129     SkRect fRect;
130 private:
131     typedef SkAddGeom INHERITED;
132 };
133 
134 class SkAddOval : public SkAddRect {
135     DECLARE_MEMBER_INFO(AddOval);
136     virtual bool add();
137 private:
138     typedef SkAddRect INHERITED;
139 };
140 
141 class SkAddCircle : public SkAddGeom {
142     DECLARE_MEMBER_INFO(AddCircle);
143     SkAddCircle();
144     virtual bool add();
145 private:
146     SkScalar radius;
147     SkScalar x;
148     SkScalar y;
149     typedef SkAddGeom INHERITED;
150 };
151 
152 class SkAddRoundRect : public SkAddRect {
153     DECLARE_MEMBER_INFO(AddRoundRect);
154     SkAddRoundRect();
155     virtual bool add();
156 private:
157     SkScalar rx;
158     SkScalar ry;
159     typedef SkAddRect INHERITED;
160 };
161 
162 class SkAddPath : public SkPathPart {
163     DECLARE_MEMBER_INFO(AddPath);
164     SkAddPath();
165     virtual bool add();
166 private:
167     typedef SkPathPart INHERITED;
168     SkDrawMatrix* matrix;
169     SkDrawPath* path;
170 };
171 
172 #endif // SkPathParts_DEFINED
173 
174