reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 1 | /* 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 | |
| 28 | class SkDrawPaint; |
| 29 | class SkDrawMatrix; |
| 30 | |
| 31 | class SkPaintPart : public SkDisplayable { |
| 32 | public: |
| 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 |
| 40 | protected: |
| 41 | SkDrawPaint* fPaint; |
| 42 | }; |
| 43 | |
| 44 | class SkDrawMaskFilter : public SkPaintPart { |
| 45 | DECLARE_EMPTY_MEMBER_INFO(MaskFilter); |
| 46 | virtual SkMaskFilter* getMaskFilter(); |
| 47 | protected: |
| 48 | virtual bool add(); |
| 49 | }; |
| 50 | |
| 51 | class SkDrawPathEffect : public SkPaintPart { |
| 52 | DECLARE_EMPTY_MEMBER_INFO(PathEffect); |
| 53 | virtual SkPathEffect* getPathEffect(); |
| 54 | protected: |
| 55 | virtual bool add(); |
| 56 | }; |
| 57 | |
| 58 | class SkDrawShader : public SkPaintPart { |
| 59 | DECLARE_DRAW_MEMBER_INFO(Shader); |
| 60 | SkDrawShader(); |
| 61 | virtual SkShader* getShader(); |
| 62 | protected: |
| 63 | virtual bool add(); |
| 64 | void addPostlude(SkShader* shader); |
| 65 | SkDrawMatrix* matrix; |
| 66 | int /*SkShader::TileMode*/ tileMode; |
| 67 | }; |
| 68 | |
| 69 | class 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.org | 1220e1c | 2009-06-11 12:26:47 +0000 | [diff] [blame] | 76 | return SkTypeface::CreateFromName(fontName.c_str(), style); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 77 | protected: |
| 78 | virtual bool add(); |
| 79 | SkString fontName; |
| 80 | SkTypeface::Style style; |
| 81 | }; |
| 82 | |
| 83 | #endif // SkPaintParts_DEFINED |