blob: f82aa74531ad67edb714f49f5b1ea29fb22a47d9 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#ifndef SkPathParts_DEFINED
11#define SkPathParts_DEFINED
12
13#include "SkDisplayable.h"
14#include "SkMemberInfo.h"
15#include "SkPath.h"
16
17class SkDrawPath;
18class SkDrawMatrix;
19
20class SkPathPart : public SkDisplayable {
21public:
22 SkPathPart();
23 virtual bool add() = 0;
24 virtual void dirty();
25 virtual SkDisplayable* getParent() const;
26 virtual bool setParent(SkDisplayable* parent);
27#ifdef SK_DEBUG
28 virtual bool isPathPart() const { return true; }
29#endif
30protected:
31 SkDrawPath* fPath;
32};
33
34class SkMoveTo : public SkPathPart {
35 DECLARE_MEMBER_INFO(MoveTo);
36 SkMoveTo();
37 virtual bool add();
38protected:
39 SkScalar x;
40 SkScalar y;
41};
42
43class SkRMoveTo : public SkMoveTo {
44 DECLARE_MEMBER_INFO(RMoveTo);
45 virtual bool add();
46private:
47 typedef SkMoveTo INHERITED;
48};
49
50class SkLineTo : public SkPathPart {
51 DECLARE_MEMBER_INFO(LineTo);
52 SkLineTo();
53 virtual bool add();
54protected:
55 SkScalar x;
56 SkScalar y;
57};
58
59class SkRLineTo : public SkLineTo {
60 DECLARE_MEMBER_INFO(RLineTo);
61 virtual bool add();
62private:
63 typedef SkLineTo INHERITED;
64};
65
66class SkQuadTo : public SkPathPart {
67 DECLARE_MEMBER_INFO(QuadTo);
68 SkQuadTo();
69 virtual bool add();
70protected:
71 SkScalar x1;
72 SkScalar y1;
73 SkScalar x2;
74 SkScalar y2;
75};
76
77class SkRQuadTo : public SkQuadTo {
78 DECLARE_MEMBER_INFO(RQuadTo);
79 virtual bool add();
80private:
81 typedef SkQuadTo INHERITED;
82};
83
84class SkCubicTo : public SkPathPart {
85 DECLARE_MEMBER_INFO(CubicTo);
86 SkCubicTo();
87 virtual bool add();
88protected:
89 SkScalar x1;
90 SkScalar y1;
91 SkScalar x2;
92 SkScalar y2;
93 SkScalar x3;
94 SkScalar y3;
95};
96
97class SkRCubicTo : public SkCubicTo {
98 DECLARE_MEMBER_INFO(RCubicTo);
99 virtual bool add();
100private:
101 typedef SkCubicTo INHERITED;
102};
103
104class SkClose : public SkPathPart {
105 DECLARE_EMPTY_MEMBER_INFO(Close);
106 virtual bool add();
107};
108
109class SkAddGeom : public SkPathPart {
110 DECLARE_PRIVATE_MEMBER_INFO(AddGeom);
111 SkAddGeom();
112protected:
113 int /*SkPath::Direction*/ direction;
114};
115
116class SkAddRect : public SkAddGeom {
117 DECLARE_MEMBER_INFO(AddRect);
118 SkAddRect();
119 virtual bool add();
120protected:
121 SkRect fRect;
122private:
123 typedef SkAddGeom INHERITED;
124};
125
126class SkAddOval : public SkAddRect {
127 DECLARE_MEMBER_INFO(AddOval);
128 virtual bool add();
129private:
130 typedef SkAddRect INHERITED;
131};
132
133class SkAddCircle : public SkAddGeom {
134 DECLARE_MEMBER_INFO(AddCircle);
135 SkAddCircle();
136 virtual bool add();
137private:
138 SkScalar radius;
139 SkScalar x;
140 SkScalar y;
141 typedef SkAddGeom INHERITED;
142};
143
144class SkAddRoundRect : public SkAddRect {
145 DECLARE_MEMBER_INFO(AddRoundRect);
146 SkAddRoundRect();
147 virtual bool add();
148private:
149 SkScalar rx;
150 SkScalar ry;
151 typedef SkAddRect INHERITED;
152};
153
154class SkAddPath : public SkPathPart {
155 DECLARE_MEMBER_INFO(AddPath);
156 SkAddPath();
157 virtual bool add();
158private:
159 typedef SkPathPart INHERITED;
160 SkDrawMatrix* matrix;
161 SkDrawPath* path;
162};
163
164#endif // SkPathParts_DEFINED