blob: d97d9fbaacc3481f7766ea51e9c2e189618699f4 [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/* libs/graphics/animator/SkMatrixParts.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 SkMatrixParts_DEFINED
19#define SkMatrixParts_DEFINED
20
21#include "SkDisplayable.h"
22#include "SkMemberInfo.h"
23#include "SkPathMeasure.h"
24
25class SkDrawPath;
26class SkDrawRect;
27class SkPolygon;
28
29class SkDrawMatrix;
30// class SkMatrix;
31
32class SkMatrixPart : public SkDisplayable {
33public:
34 SkMatrixPart();
35 virtual bool add() = 0;
36 virtual void dirty();
37 virtual SkDisplayable* getParent() const;
38 virtual bool setParent(SkDisplayable* parent);
39#ifdef SK_DEBUG
40 virtual bool isMatrixPart() const { return true; }
41#endif
42protected:
43 SkDrawMatrix* fMatrix;
44};
45
46class SkRotate : public SkMatrixPart {
47 DECLARE_MEMBER_INFO(Rotate);
48 SkRotate();
49protected:
50 virtual bool add();
51 SkScalar degrees;
52 SkPoint center;
53};
54
55class SkScale : public SkMatrixPart {
56 DECLARE_MEMBER_INFO(Scale);
57 SkScale();
58protected:
59 virtual bool add();
60 SkScalar x;
61 SkScalar y;
62 SkPoint center;
63};
64
65class SkSkew : public SkMatrixPart {
66 DECLARE_MEMBER_INFO(Skew);
67 SkSkew();
68protected:
69 virtual bool add();
70 SkScalar x;
71 SkScalar y;
72 SkPoint center;
73};
74
75class SkTranslate : public SkMatrixPart {
76 DECLARE_MEMBER_INFO(Translate);
77 SkTranslate();
78protected:
79 virtual bool add();
80 SkScalar x;
81 SkScalar y;
82};
83
84class SkFromPath : public SkMatrixPart {
85 DECLARE_MEMBER_INFO(FromPath);
86 SkFromPath();
87 virtual ~SkFromPath();
88protected:
89 virtual bool add();
90 int32_t mode;
91 SkScalar offset;
92 SkDrawPath* path;
93 SkPathMeasure fPathMeasure;
94};
95
96class SkRectToRect : public SkMatrixPart {
97 DECLARE_MEMBER_INFO(RectToRect);
98 SkRectToRect();
99 virtual ~SkRectToRect();
100#ifdef SK_DUMP_ENABLED
101 virtual void dump(SkAnimateMaker* );
102#endif
103 virtual const SkMemberInfo* preferredChild(SkDisplayTypes type);
104protected:
105 virtual bool add();
106 SkDrawRect* source;
107 SkDrawRect* destination;
108};
109
110class SkPolyToPoly : public SkMatrixPart {
111 DECLARE_MEMBER_INFO(PolyToPoly);
112 SkPolyToPoly();
113 virtual ~SkPolyToPoly();
114#ifdef SK_DUMP_ENABLED
115 virtual void dump(SkAnimateMaker* );
116#endif
117 virtual void onEndElement(SkAnimateMaker& );
118 virtual const SkMemberInfo* preferredChild(SkDisplayTypes type);
119protected:
120 virtual bool add();
121 SkPolygon* source;
122 SkPolygon* destination;
123};
124
125// !!! add concat matrix ?
126
127#endif // SkMatrixParts_DEFINED