blob: 3276d023d4e63ceeb8906fa6cccec9abd0ade18e [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 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:
mtklein36352bf2015-03-25 18:17:31 -070042 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000043 SkScalar degrees;
44 SkPoint center;
45};
46
47class SkScale : public SkMatrixPart {
48 DECLARE_MEMBER_INFO(Scale);
49 SkScale();
50protected:
mtklein36352bf2015-03-25 18:17:31 -070051 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000052 SkScalar x;
53 SkScalar y;
54 SkPoint center;
55};
56
57class SkSkew : public SkMatrixPart {
58 DECLARE_MEMBER_INFO(Skew);
59 SkSkew();
60protected:
mtklein36352bf2015-03-25 18:17:31 -070061 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000062 SkScalar x;
63 SkScalar y;
64 SkPoint center;
65};
66
67class SkTranslate : public SkMatrixPart {
68 DECLARE_MEMBER_INFO(Translate);
69 SkTranslate();
70protected:
mtklein36352bf2015-03-25 18:17:31 -070071 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000072 SkScalar x;
73 SkScalar y;
74};
75
76class SkFromPath : public SkMatrixPart {
77 DECLARE_MEMBER_INFO(FromPath);
78 SkFromPath();
79 virtual ~SkFromPath();
80protected:
mtklein36352bf2015-03-25 18:17:31 -070081 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000082 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
mtklein36352bf2015-03-25 18:17:31 -070093 void dump(SkAnimateMaker* ) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000094#endif
mtklein36352bf2015-03-25 18:17:31 -070095 const SkMemberInfo* preferredChild(SkDisplayTypes type) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000096protected:
mtklein36352bf2015-03-25 18:17:31 -070097 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000098 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
mtklein36352bf2015-03-25 18:17:31 -0700107 void dump(SkAnimateMaker* ) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000108#endif
mtklein36352bf2015-03-25 18:17:31 -0700109 void onEndElement(SkAnimateMaker& ) override;
110 const SkMemberInfo* preferredChild(SkDisplayTypes type) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000111protected:
mtklein36352bf2015-03-25 18:17:31 -0700112 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000113 SkPolygon* source;
114 SkPolygon* destination;
115};
116
rmistry@google.comd6176b02012-08-23 18:14:13 +0000117// !!! add concat matrix ?
reed@android.com8a1c16f2008-12-17 15:59:43 +0000118
119#endif // SkMatrixParts_DEFINED