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 SkDrawGradient_DEFINED
11 #define SkDrawGradient_DEFINED
12 
13 #include "SkDrawColor.h"
14 #include "SkDrawShader.h"
15 #include "SkIntArray.h"
16 
17 class SkDrawGradient : public SkDrawShader {
18     DECLARE_PRIVATE_MEMBER_INFO(DrawGradient);
19     SkDrawGradient();
20     virtual ~SkDrawGradient();
21     bool addChild(SkAnimateMaker& , SkDisplayable* child) override;
22 #ifdef SK_DUMP_ENABLED
23     virtual void dumpRest(SkAnimateMaker*);
24 #endif
25     void onEndElement(SkAnimateMaker& ) override;
26 protected:
27     SkTDScalarArray offsets;
28     SkString unitMapper;
29     SkTDColorArray fColors;
30     SkTDDrawColorArray fDrawColors;
31     int addPrelude();
32 private:
33     typedef SkDrawShader INHERITED;
34 };
35 
36 class SkDrawLinearGradient : public SkDrawGradient {
37     DECLARE_MEMBER_INFO(DrawLinearGradient);
38     SkDrawLinearGradient();
39     void onEndElement(SkAnimateMaker& ) override;
40 #ifdef SK_DUMP_ENABLED
41     void dump(SkAnimateMaker*) override;
42 #endif
43     SkShader* getShader() override;
44 protected:
45     SkTDScalarArray points;
46 private:
47     typedef SkDrawGradient INHERITED;
48 };
49 
50 class SkDrawRadialGradient : public SkDrawGradient {
51     DECLARE_MEMBER_INFO(DrawRadialGradient);
52     SkDrawRadialGradient();
53 #ifdef SK_DUMP_ENABLED
54     void dump(SkAnimateMaker*) override;
55 #endif
56     SkShader* getShader() override;
57 protected:
58     SkPoint center;
59     SkScalar radius;
60 private:
61     typedef SkDrawGradient INHERITED;
62 };
63 
64 #endif // SkDrawGradient_DEFINED
65