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