• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* 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 
25 class SkDrawPath;
26 class SkDrawRect;
27 class SkPolygon;
28 
29 class SkDrawMatrix;
30 // class SkMatrix;
31 
32 class SkMatrixPart : public SkDisplayable {
33 public:
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
isMatrixPart()40     virtual bool isMatrixPart() const { return true; }
41 #endif
42 protected:
43     SkDrawMatrix* fMatrix;
44 };
45 
46 class SkRotate : public SkMatrixPart {
47     DECLARE_MEMBER_INFO(Rotate);
48     SkRotate();
49 protected:
50     virtual bool add();
51     SkScalar degrees;
52     SkPoint center;
53 };
54 
55 class SkScale : public SkMatrixPart {
56     DECLARE_MEMBER_INFO(Scale);
57     SkScale();
58 protected:
59     virtual bool add();
60     SkScalar x;
61     SkScalar y;
62     SkPoint center;
63 };
64 
65 class SkSkew : public SkMatrixPart {
66     DECLARE_MEMBER_INFO(Skew);
67     SkSkew();
68 protected:
69     virtual bool add();
70     SkScalar x;
71     SkScalar y;
72     SkPoint center;
73 };
74 
75 class SkTranslate : public SkMatrixPart {
76     DECLARE_MEMBER_INFO(Translate);
77     SkTranslate();
78 protected:
79     virtual bool add();
80     SkScalar x;
81     SkScalar y;
82 };
83 
84 class SkFromPath : public SkMatrixPart {
85     DECLARE_MEMBER_INFO(FromPath);
86     SkFromPath();
87     virtual ~SkFromPath();
88 protected:
89     virtual bool add();
90     int32_t mode;
91     SkScalar offset;
92     SkDrawPath* path;
93     SkPathMeasure fPathMeasure;
94 };
95 
96 class 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);
104 protected:
105     virtual bool add();
106     SkDrawRect* source;
107     SkDrawRect* destination;
108 };
109 
110 class 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);
119 protected:
120     virtual bool add();
121     SkPolygon* source;
122     SkPolygon* destination;
123 };
124 
125 // !!! add concat matrix ?
126 
127 #endif // SkMatrixParts_DEFINED
128