blob: 2907d816157d0a901003b2fb6980044d4fb5e9c2 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001/*
2 * Copyright 2006 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
reed@google.com8d4dc712014-04-18 15:14:25 +00008#ifndef SkPaintPart_DEFINED
9#define SkPaintPart_DEFINED
reed@android.com8a1c16f2008-12-17 15:59:43 +000010
11#include "SkDisplayable.h"
12#include "SkMemberInfo.h"
13#include "SkPaint.h"
14#include "SkShader.h"
15#include "SkTypeface.h"
16#include "SkXfermode.h"
17
18class SkDrawPaint;
19class SkDrawMatrix;
20
21class SkPaintPart : public SkDisplayable {
22public:
23 SkPaintPart();
24 virtual bool add() = 0;
25 virtual SkDisplayable* getParent() const;
26 virtual bool setParent(SkDisplayable* parent);
27#ifdef SK_DEBUG
28 virtual bool isPaintPart() const { return true; }
29#endif
30protected:
31 SkDrawPaint* fPaint;
32};
33
34class SkDrawMaskFilter : public SkPaintPart {
35 DECLARE_EMPTY_MEMBER_INFO(MaskFilter);
36 virtual SkMaskFilter* getMaskFilter();
37protected:
mtklein36352bf2015-03-25 18:17:31 -070038 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000039};
40
41class SkDrawPathEffect : public SkPaintPart {
42 DECLARE_EMPTY_MEMBER_INFO(PathEffect);
43 virtual SkPathEffect* getPathEffect();
44protected:
mtklein36352bf2015-03-25 18:17:31 -070045 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000046};
47
48class SkDrawShader : public SkPaintPart {
49 DECLARE_DRAW_MEMBER_INFO(Shader);
50 SkDrawShader();
51 virtual SkShader* getShader();
52protected:
mtklein36352bf2015-03-25 18:17:31 -070053 bool add() override;
commit-bot@chromium.org9c9005a2014-04-28 14:55:39 +000054 SkMatrix* getMatrix(); // returns NULL if matrix is NULL
reed@android.com8a1c16f2008-12-17 15:59:43 +000055 SkDrawMatrix* matrix;
56 int /*SkShader::TileMode*/ tileMode;
57};
58
59class SkDrawTypeface : public SkPaintPart {
60 DECLARE_DRAW_MEMBER_INFO(Typeface);
61 SkDrawTypeface();
62#ifdef SK_DUMP_ENABLED
mtklein36352bf2015-03-25 18:17:31 -070063 void dump(SkAnimateMaker *) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000064#endif
65 SkTypeface* getTypeface() {
deanm@chromium.org1220e1c2009-06-11 12:26:47 +000066 return SkTypeface::CreateFromName(fontName.c_str(), style); }
reed@android.com8a1c16f2008-12-17 15:59:43 +000067protected:
mtklein36352bf2015-03-25 18:17:31 -070068 bool add() override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000069 SkString fontName;
70 SkTypeface::Style style;
71};
72
reed@google.com8d4dc712014-04-18 15:14:25 +000073#endif // SkPaintPart_DEFINED