1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SkSVGPaintState_DEFINED 18 #define SkSVGPaintState_DEFINED 19 20 #include "SkSVGBase.h" 21 #include "SkString.h" 22 23 class SkSVGPaint : public SkSVGBase { 24 public: 25 enum Field { 26 kInitial = -1, 27 kClipPath, 28 kClipRule, 29 kEnableBackground, 30 kFill, 31 kFillRule, 32 kFilter, 33 kFontFamily, 34 kFontSize, 35 kLetterSpacing, 36 kMask, 37 kOpacity, 38 kStopColor, 39 kStopOpacity, 40 kStroke, 41 kStroke_Dasharray, 42 kStroke_Linecap, 43 kStroke_Linejoin, 44 kStroke_Miterlimit, 45 kStroke_Width, 46 kStyle, 47 kTransform, 48 kTerminal 49 }; 50 51 SkSVGPaint(); 52 virtual void addAttribute(SkSVGParser& parser, int attrIndex, 53 const char* attrValue, size_t attrLength); 54 bool flush(SkSVGParser& , bool isFlushable, bool isDef); 55 virtual int getAttributes(const SkSVGAttribute** attrPtr); 56 static void Push(SkSVGPaint** head, SkSVGPaint* add); 57 static void Pop(SkSVGPaint** head); 58 SkString* operator[](int index); 59 SkString fInitial; 60 SkString f_clipPath; 61 SkString f_clipRule; 62 SkString f_enableBackground; 63 SkString f_fill; 64 SkString f_fillRule; 65 SkString f_filter; 66 SkString f_fontFamily; 67 SkString f_fontSize; 68 SkString f_letterSpacing; 69 SkString f_mask; 70 SkString f_opacity; 71 SkString f_stopColor; 72 SkString f_stopOpacity; 73 SkString f_stroke; 74 SkString f_strokeDasharray; 75 SkString f_strokeLinecap; 76 SkString f_strokeLinejoin; 77 SkString f_strokeMiterlimit; 78 SkString f_strokeWidth; 79 SkString f_style; // unused, but allows array access to the rest 80 SkString f_transform; 81 #ifdef SK_DEBUG 82 SkString fTerminal; 83 #endif 84 SkString fTransformID; 85 static SkSVGAttribute gAttributes[]; 86 static const int kAttributesSize; 87 private: 88 void setSave(SkSVGParser& ); 89 bool writeChangedAttributes(SkSVGParser& , SkSVGPaint& , bool* changed); 90 bool writeChangedElements(SkSVGParser& , SkSVGPaint& , bool* changed); 91 SkSVGPaint* fNext; 92 friend class SkSVGParser; 93 typedef SkSVGPaint BASE_CLASS; 94 }; 95 96 #endif // SkSVGPaintState_DEFINED 97