skia2/include/core/SkAnnotation.h
reed fb8c1fcab1 Revert of IWYU: 'core' target, files starting A-C. (patchset #5 id:80001 of https://codereview.chromium.org/1265033002/ )
Reason for revert:
revert to unblock DEPS roll

../../chrome/browser/chromeos/display/overscan_calibrator.cc:43:10: error: variable has incomplete type 'SkPath'
  SkPath base_path;

Original issue's description:
> IWYU: 'core' target, files starting A-C.
>
> TBR=reed@google.com
> Verbal lgtm, does not change API.
>
> Committed: https://skia.googlesource.com/skia/+/7403d87db8e43d4c2b5b25ac22a0ebc22bd09d69

TBR=reed@google.com,mtklein@google.com,bungeman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1273613002
2015-08-04 18:44:57 -07:00

124 lines
3.0 KiB
C++

/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkAnnotation_DEFINED
#define SkAnnotation_DEFINED
#include "SkRefCnt.h"
#include "SkString.h"
class SkData;
class SkReadBuffer;
class SkWriteBuffer;
class SkStream;
class SkWStream;
struct SkPoint;
/**
* Experimental class for annotating draws. Do not use directly yet.
* Use helper functions at the bottom of this file for now.
*/
class SkAnnotation : public SkRefCnt {
public:
virtual ~SkAnnotation();
static SkAnnotation* Create(const char key[], SkData* value) {
return SkNEW_ARGS(SkAnnotation, (key, value));
}
static SkAnnotation* Create(SkReadBuffer& buffer) {
return SkNEW_ARGS(SkAnnotation, (buffer));
}
/**
* Return the data for the specified key, or NULL.
*/
SkData* find(const char key[]) const;
void writeToBuffer(SkWriteBuffer&) const;
private:
SkAnnotation(const char key[], SkData* value);
SkAnnotation(SkReadBuffer&);
SkString fKey;
SkData* fData;
typedef SkRefCnt INHERITED;
};
/**
* Experimental collection of predefined Keys into the Annotation dictionary
*/
class SkAnnotationKeys {
public:
/**
* Returns the canonical key whose payload is a URL
*/
static const char* URL_Key();
/**
* Returns the canonical key whose payload is the name of a destination to
* be defined.
*/
static const char* Define_Named_Dest_Key();
/**
* Returns the canonical key whose payload is the name of a destination to
* be linked to.
*/
static const char* Link_Named_Dest_Key();
};
///////////////////////////////////////////////////////////////////////////////
//
// Experimental helper functions to use Annotations
//
struct SkRect;
class SkCanvas;
/**
* Experimental!
*
* Annotate the canvas by associating the specified URL with the
* specified rectangle (in local coordinates, just like drawRect). If the
* backend of this canvas does not support annotations, this call is
* safely ignored.
*
* The caller is responsible for managing its ownership of the SkData.
*/
SK_API void SkAnnotateRectWithURL(SkCanvas*, const SkRect&, SkData*);
/**
* Experimental!
*
* Annotate the canvas by associating a name with the specified point.
*
* If the backend of this canvas does not support annotations, this call is
* safely ignored.
*
* The caller is responsible for managing its ownership of the SkData.
*/
SK_API void SkAnnotateNamedDestination(SkCanvas*, const SkPoint&, SkData*);
/**
* Experimental!
*
* Annotate the canvas by making the specified rectangle link to a named
* destination.
*
* If the backend of this canvas does not support annotations, this call is
* safely ignored.
*
* The caller is responsible for managing its ownership of the SkData.
*/
SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*);
#endif