|
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 SkPaintParts_DEFINED |
|
11 #define SkPaintParts_DEFINED |
|
12 |
|
13 #include "SkDisplayable.h" |
|
14 #include "SkMemberInfo.h" |
|
15 #include "SkPaint.h" |
|
16 #include "SkShader.h" |
|
17 #include "SkTypeface.h" |
|
18 #include "SkXfermode.h" |
|
19 |
|
20 class SkDrawPaint; |
|
21 class SkDrawMatrix; |
|
22 |
|
23 class SkPaintPart : public SkDisplayable { |
|
24 public: |
|
25 SkPaintPart(); |
|
26 virtual bool add() = 0; |
|
27 virtual SkDisplayable* getParent() const; |
|
28 virtual bool setParent(SkDisplayable* parent); |
|
29 #ifdef SK_DEBUG |
|
30 virtual bool isPaintPart() const { return true; } |
|
31 #endif |
|
32 protected: |
|
33 SkDrawPaint* fPaint; |
|
34 }; |
|
35 |
|
36 class SkDrawMaskFilter : public SkPaintPart { |
|
37 DECLARE_EMPTY_MEMBER_INFO(MaskFilter); |
|
38 virtual SkMaskFilter* getMaskFilter(); |
|
39 protected: |
|
40 virtual bool add(); |
|
41 }; |
|
42 |
|
43 class SkDrawPathEffect : public SkPaintPart { |
|
44 DECLARE_EMPTY_MEMBER_INFO(PathEffect); |
|
45 virtual SkPathEffect* getPathEffect(); |
|
46 protected: |
|
47 virtual bool add(); |
|
48 }; |
|
49 |
|
50 class SkDrawShader : public SkPaintPart { |
|
51 DECLARE_DRAW_MEMBER_INFO(Shader); |
|
52 SkDrawShader(); |
|
53 virtual SkShader* getShader(); |
|
54 protected: |
|
55 virtual bool add(); |
|
56 void addPostlude(SkShader* shader); |
|
57 SkDrawMatrix* matrix; |
|
58 int /*SkShader::TileMode*/ tileMode; |
|
59 }; |
|
60 |
|
61 class SkDrawTypeface : public SkPaintPart { |
|
62 DECLARE_DRAW_MEMBER_INFO(Typeface); |
|
63 SkDrawTypeface(); |
|
64 #ifdef SK_DUMP_ENABLED |
|
65 virtual void dump(SkAnimateMaker *); |
|
66 #endif |
|
67 SkTypeface* getTypeface() { |
|
68 return SkTypeface::CreateFromName(fontName.c_str(), style); } |
|
69 protected: |
|
70 virtual bool add(); |
|
71 SkString fontName; |
|
72 SkTypeface::Style style; |
|
73 }; |
|
74 |
|
75 #endif // SkPaintParts_DEFINED |