• 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 SkSVGPaintState_DEFINED
11 #define SkSVGPaintState_DEFINED
12 
13 #include "SkSVGBase.h"
14 #include "SkString.h"
15 
16 class SkSVGPaint : public SkSVGBase {
17 public:
18     enum Field {
19         kInitial = -1,
20         kClipPath,
21         kClipRule,
22         kEnableBackground,
23         kFill,
24         kFillRule,
25         kFilter,
26         kFontFamily,
27         kFontSize,
28         kLetterSpacing,
29         kMask,
30         kOpacity,
31         kStopColor,
32         kStopOpacity,
33         kStroke,
34         kStroke_Dasharray,
35         kStroke_Linecap,
36         kStroke_Linejoin,
37         kStroke_Miterlimit,
38         kStroke_Width,
39         kStyle,
40         kTransform,
41         kTerminal
42     };
43 
44     SkSVGPaint();
45     virtual void addAttribute(SkSVGParser& parser, int attrIndex,
46         const char* attrValue, size_t attrLength);
47     bool flush(SkSVGParser& , bool isFlushable, bool isDef);
48     virtual int getAttributes(const SkSVGAttribute** attrPtr);
49     static void Push(SkSVGPaint** head, SkSVGPaint* add);
50     static void Pop(SkSVGPaint** head);
51     SkString* operator[](int index);
52     SkString fInitial;
53     SkString f_clipPath;
54     SkString f_clipRule;
55     SkString f_enableBackground;
56     SkString f_fill;
57     SkString f_fillRule;
58     SkString f_filter;
59     SkString f_fontFamily;
60     SkString f_fontSize;
61     SkString f_letterSpacing;
62     SkString f_mask;
63     SkString f_opacity;
64     SkString f_stopColor;
65     SkString f_stopOpacity;
66     SkString f_stroke;
67     SkString f_strokeDasharray;
68     SkString f_strokeLinecap;
69     SkString f_strokeLinejoin;
70     SkString f_strokeMiterlimit;
71     SkString f_strokeWidth;
72     SkString f_style; // unused, but allows array access to the rest
73     SkString f_transform;
74 #ifdef SK_DEBUG
75     SkString fTerminal;
76 #endif
77     SkString fTransformID;
78     static SkSVGAttribute gAttributes[];
79     static const int kAttributesSize;
80 private:
81     void setSave(SkSVGParser& );
82     bool writeChangedAttributes(SkSVGParser& , SkSVGPaint& , bool* changed);
83     bool writeChangedElements(SkSVGParser& , SkSVGPaint& , bool* changed);
84     SkSVGPaint* fNext;
85     friend class SkSVGParser;
86     typedef SkSVGPaint BASE_CLASS;
87 };
88 
89 #endif // SkSVGPaintState_DEFINED
90