OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 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 |
| 8 #ifndef SkSVGNode_DEFINED |
| 9 #define SkSVGNode_DEFINED |
| 10 |
| 11 #include "SkRefCnt.h" |
| 12 #include "SkSVGAttribute.h" |
| 13 |
| 14 class SkCanvas; |
| 15 class SkMatrix; |
| 16 class SkSVGRenderContext; |
| 17 class SkSVGValue; |
| 18 |
| 19 enum class SkSVGTag { |
| 20 g, |
| 21 path, |
| 22 svg |
| 23 }; |
| 24 |
| 25 class SkSVGNode : public SkRefCnt { |
| 26 public: |
| 27 virtual ~SkSVGNode(); |
| 28 |
| 29 SkSVGTag tag() const { return fTag; } |
| 30 |
| 31 virtual void appendChild(sk_sp<SkSVGNode>) = 0; |
| 32 |
| 33 void render(SkCanvas*) const; |
| 34 void render(SkCanvas*, const SkSVGRenderContext&) const; |
| 35 |
| 36 void setAttribute(SkSVGAttribute, const SkSVGValue&); |
| 37 |
| 38 protected: |
| 39 SkSVGNode(SkSVGTag); |
| 40 |
| 41 virtual void onRender(SkCanvas*, const SkSVGRenderContext&) const = 0; |
| 42 |
| 43 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); |
| 44 |
| 45 virtual const SkMatrix& onLocalMatrix() const; |
| 46 |
| 47 private: |
| 48 SkSVGTag fTag; |
| 49 |
| 50 // FIXME: this should be sparse |
| 51 SkSVGPresentationAttributes fPresentationAttributes; |
| 52 |
| 53 typedef SkRefCnt INHERITED; |
| 54 }; |
| 55 |
| 56 #endif // SkSVGNode_DEFINED |
OLD | NEW |