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 SkFlattenableReadBuffer; | 15 class SkFlattenableReadBuffer; |
16 class SkFlattenableWriteBuffer; | 16 class SkFlattenableWriteBuffer; |
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 enum Flags { | 27 SkAnnotation(const char key[], SkData* value); |
28 // If set, the associated drawing primitive should not be drawn | |
29 kNoDraw_Flag = 1 << 0, | |
30 }; | |
31 | |
32 SkAnnotation(const char key[], SkData* value, uint32_t flags); | |
33 virtual ~SkAnnotation(); | 28 virtual ~SkAnnotation(); |
34 | 29 |
35 uint32_t getFlags() const { return fFlags; } | |
36 | |
37 bool isNoDraw() const { return SkToBool(fFlags & kNoDraw_Flag); } | |
38 | |
39 /** | 30 /** |
40 * Return the data for the specified key, or NULL. | 31 * Return the data for the specified key, or NULL. |
41 */ | 32 */ |
42 SkData* find(const char key[]) const; | 33 SkData* find(const char key[]) const; |
43 | 34 |
44 SkAnnotation(SkFlattenableReadBuffer&); | 35 SkAnnotation(SkFlattenableReadBuffer&); |
45 void writeToBuffer(SkFlattenableWriteBuffer&) const; | 36 void writeToBuffer(SkFlattenableWriteBuffer&) const; |
46 | 37 |
47 private: | 38 private: |
48 SkString fKey; | 39 SkString fKey; |
49 SkData* fData; | 40 SkData* fData; |
50 uint32_t fFlags; | |
51 | 41 |
52 typedef SkRefCnt INHERITED; | 42 typedef SkRefCnt INHERITED; |
53 }; | 43 }; |
54 | 44 |
55 /** | 45 /** |
56 * Experimental collection of predefined Keys into the Annotation dictionary | 46 * Experimental collection of predefined Keys into the Annotation dictionary |
57 */ | 47 */ |
58 class SkAnnotationKeys { | 48 class SkAnnotationKeys { |
59 public: | 49 public: |
60 /** | 50 /** |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 * | 105 * |
116 * If the backend of this canvas does not support annotations, this call is | 106 * If the backend of this canvas does not support annotations, this call is |
117 * safely ignored. | 107 * safely ignored. |
118 * | 108 * |
119 * The caller is responsible for managing its ownership of the SkData. | 109 * The caller is responsible for managing its ownership of the SkData. |
120 */ | 110 */ |
121 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); | 111 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); |
122 | 112 |
123 | 113 |
124 #endif | 114 #endif |
OLD | NEW |