2 * Copyright 2012 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkAnnotation_DEFINED
9 #define SkAnnotation_DEFINED
22 * Experimental class for annotating draws. Do not use directly yet.
23 * Use helper functions at the bottom of this file for now.
25 class SkAnnotation : public SkRefCnt {
27 SkAnnotation(const char key[], SkData* value);
28 virtual ~SkAnnotation();
31 * Return the data for the specified key, or NULL.
33 SkData* find(const char key[]) const;
35 SkAnnotation(SkReadBuffer&);
36 void writeToBuffer(SkWriteBuffer&) const;
42 typedef SkRefCnt INHERITED;
46 * Experimental collection of predefined Keys into the Annotation dictionary
48 class SkAnnotationKeys {
51 * Returns the canonical key whose payload is a URL
53 static const char* URL_Key();
56 * Returns the canonical key whose payload is the name of a destination to
59 static const char* Define_Named_Dest_Key();
62 * Returns the canonical key whose payload is the name of a destination to
65 static const char* Link_Named_Dest_Key();
68 ///////////////////////////////////////////////////////////////////////////////
70 // Experimental helper functions to use Annotations
79 * Annotate the canvas by associating the specified URL with the
80 * specified rectangle (in local coordinates, just like drawRect). If the
81 * backend of this canvas does not support annotations, this call is
84 * The caller is responsible for managing its ownership of the SkData.
86 SK_API void SkAnnotateRectWithURL(SkCanvas*, const SkRect&, SkData*);
91 * Annotate the canvas by associating a name with the specified point.
93 * If the backend of this canvas does not support annotations, this call is
96 * The caller is responsible for managing its ownership of the SkData.
98 SK_API void SkAnnotateNamedDestination(SkCanvas*, const SkPoint&, SkData*);
103 * Annotate the canvas by making the specified rectangle link to a named
106 * If the backend of this canvas does not support annotations, this call is
109 * The caller is responsible for managing its ownership of the SkData.
111 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*);