• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SkUnitMapper;
18 
19 class SkGradient : public SkDrawShader {
20     DECLARE_PRIVATE_MEMBER_INFO(Gradient);
21     SkGradient();
22     virtual ~SkGradient();
23     virtual bool add(SkAnimateMaker& , SkDisplayable* child);
24 #ifdef SK_DUMP_ENABLED
25     virtual void dumpRest(SkAnimateMaker*);
26 #endif
27     virtual void onEndElement(SkAnimateMaker& );
28 protected:
29     SkTDScalarArray offsets;
30     SkString unitMapper;
31     SkTDColorArray fColors;
32     SkTDDrawColorArray fDrawColors;
33     SkUnitMapper* fUnitMapper;
34     int addPrelude();
35 private:
36     typedef SkDrawShader INHERITED;
37 };
38 
39 class SkLinearGradient : public SkGradient {
40     DECLARE_MEMBER_INFO(LinearGradient);
41     SkLinearGradient();
42     virtual void onEndElement(SkAnimateMaker& );
43 #ifdef SK_DUMP_ENABLED
44     virtual void dump(SkAnimateMaker*);
45 #endif
46     virtual SkShader* getShader();
47 protected:
48     SkTDScalarArray points;
49 private:
50     typedef SkGradient INHERITED;
51 };
52 
53 class SkRadialGradient : public SkGradient {
54     DECLARE_MEMBER_INFO(RadialGradient);
55     SkRadialGradient();
56 #ifdef SK_DUMP_ENABLED
57     virtual void dump(SkAnimateMaker*);
58 #endif
59     virtual SkShader* getShader();
60 protected:
61     SkPoint center;
62     SkScalar radius;
63 private:
64     typedef SkGradient INHERITED;
65 };
66 
67 #endif // SkDrawGradient_DEFINED
68 
69