OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkAnnotation_DEFINED | 8 #ifndef SkAnnotation_DEFINED |
9 #define SkAnnotation_DEFINED | 9 #define SkAnnotation_DEFINED |
10 | 10 |
11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
12 #include "SkString.h" | 12 #include "SkString.h" |
13 | 13 |
14 class SkData; | 14 class SkData; |
15 class SkReadBuffer; | 15 class SkReadBuffer; |
16 class SkWriteBuffer; | 16 class SkWriteBuffer; |
17 class SkStream; | 17 class SkStream; |
18 class SkWStream; | 18 class SkWStream; |
19 struct SkPoint; | 19 struct SkPoint; |
20 | 20 |
21 /** | 21 /** |
22 * Experimental class for annotating draws. Do not use directly yet. | 22 * Experimental class for annotating draws. Do not use directly yet. |
23 * Use helper functions at the bottom of this file for now. | 23 * Use helper functions at the bottom of this file for now. |
24 */ | 24 */ |
25 class SkAnnotation : public SkRefCnt { | 25 class SkAnnotation : public SkRefCnt { |
26 public: | 26 public: |
27 SkAnnotation(const char key[], SkData* value); | |
28 virtual ~SkAnnotation(); | 27 virtual ~SkAnnotation(); |
29 | 28 |
| 29 static SkAnnotation* Create(const char key[], SkData* value) { |
| 30 return SkNEW_ARGS(SkAnnotation, (key, value)); |
| 31 } |
| 32 |
| 33 static SkAnnotation* Create(SkReadBuffer& buffer) { |
| 34 return SkNEW_ARGS(SkAnnotation, (buffer)); |
| 35 } |
| 36 |
30 /** | 37 /** |
31 * Return the data for the specified key, or NULL. | 38 * Return the data for the specified key, or NULL. |
32 */ | 39 */ |
33 SkData* find(const char key[]) const; | 40 SkData* find(const char key[]) const; |
34 | 41 |
35 SkAnnotation(SkReadBuffer&); | |
36 void writeToBuffer(SkWriteBuffer&) const; | 42 void writeToBuffer(SkWriteBuffer&) const; |
37 | 43 |
38 private: | 44 private: |
| 45 SkAnnotation(const char key[], SkData* value); |
| 46 SkAnnotation(SkReadBuffer&); |
| 47 |
39 SkString fKey; | 48 SkString fKey; |
40 SkData* fData; | 49 SkData* fData; |
41 | 50 |
42 typedef SkRefCnt INHERITED; | 51 typedef SkRefCnt INHERITED; |
43 }; | 52 }; |
44 | 53 |
45 /** | 54 /** |
46 * Experimental collection of predefined Keys into the Annotation dictionary | 55 * Experimental collection of predefined Keys into the Annotation dictionary |
47 */ | 56 */ |
48 class SkAnnotationKeys { | 57 class SkAnnotationKeys { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 * | 114 * |
106 * If the backend of this canvas does not support annotations, this call is | 115 * If the backend of this canvas does not support annotations, this call is |
107 * safely ignored. | 116 * safely ignored. |
108 * | 117 * |
109 * The caller is responsible for managing its ownership of the SkData. | 118 * The caller is responsible for managing its ownership of the SkData. |
110 */ | 119 */ |
111 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); | 120 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); |
112 | 121 |
113 | 122 |
114 #endif | 123 #endif |
OLD | NEW |