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