2012-06-29 14:21:22 +00:00
|
|
|
/*
|
|
|
|
* 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 SKOBJECTPARSER_H_
|
|
|
|
#define SKOBJECTPARSER_H_
|
|
|
|
|
|
|
|
#include "SkCanvas.h"
|
2012-08-07 20:41:37 +00:00
|
|
|
#include "SkString.h"
|
2012-09-29 13:17:16 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/** \class SkObjectParser
|
|
|
|
|
|
|
|
The ObjectParser is used to return string information about parameters
|
|
|
|
in each draw command.
|
|
|
|
*/
|
|
|
|
class SkObjectParser {
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
2015-08-24 15:27:38 +00:00
|
|
|
Returns a string about a bitmap's bounds and colortype.
|
2012-06-29 14:21:22 +00:00
|
|
|
@param bitmap SkBitmap
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* BitmapToString(const SkBitmap& bitmap);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2015-08-24 15:27:38 +00:00
|
|
|
/**
|
|
|
|
Returns a string about a image
|
|
|
|
@param image SkImage
|
|
|
|
*/
|
|
|
|
static SkString* ImageToString(const SkImage* image);
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Returns a string representation of a boolean.
|
|
|
|
@param doAA boolean
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* BoolToString(bool doAA);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of the text pointer passed in.
|
|
|
|
*/
|
|
|
|
static SkString* CustomTextToString(const char* text);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of an integer with the text parameter
|
|
|
|
at the front of the string.
|
|
|
|
@param x integer
|
|
|
|
@param text
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* IntToString(int x, const char* text);
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Returns a string representation of the SkIRects coordinates.
|
|
|
|
@param rect SkIRect
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* IRectToString(const SkIRect& rect);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of an SkMatrix's contents
|
|
|
|
@param matrix SkMatrix
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* MatrixToString(const SkMatrix& matrix);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of an SkPaint's color
|
|
|
|
@param paint SkPaint
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* PaintToString(const SkPaint& paint);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of a SkPath's points.
|
|
|
|
@param path SkPath
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* PathToString(const SkPath& path);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of the points in the point array.
|
|
|
|
@param pts[] Array of SkPoints
|
|
|
|
@param count
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* PointsToString(const SkPoint pts[], size_t count);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-08-01 16:10:06 +00:00
|
|
|
/**
|
|
|
|
Returns a string representation of the SkCanvas PointMode enum.
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* PointModeToString(SkCanvas::PointMode mode);
|
2012-08-01 16:10:06 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
/**
|
|
|
|
Returns a string representation of the SkRects coordinates.
|
|
|
|
@param rect SkRect
|
|
|
|
*/
|
2015-08-27 14:41:13 +00:00
|
|
|
static SkString* RectToString(const SkRect& rect, const char* title = nullptr);
|
2013-01-02 20:20:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of an SkRRect.
|
|
|
|
@param rrect SkRRect
|
|
|
|
*/
|
2015-08-27 14:41:13 +00:00
|
|
|
static SkString* RRectToString(const SkRRect& rrect, const char* title = nullptr);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of the SkRegion enum.
|
|
|
|
@param op SkRegion::op enum
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* RegionOpToString(SkRegion::Op op);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of the SkRegion.
|
|
|
|
@param region SkRegion
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* RegionToString(const SkRegion& region);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
2015-12-18 15:09:18 +00:00
|
|
|
Returns a string representation of the SkCanvas::SaveLayerFlags enum.
|
|
|
|
@param flags SkCanvas::SaveLayerFlags enum
|
2012-06-29 14:21:22 +00:00
|
|
|
*/
|
2015-12-18 15:09:18 +00:00
|
|
|
static SkString* SaveLayerFlagsToString(uint32_t saveLayerFlags);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of an SkScalar with the text parameter
|
|
|
|
at the front of the string.
|
|
|
|
@param x SkScalar
|
|
|
|
@param text
|
|
|
|
*/
|
2012-08-07 20:41:37 +00:00
|
|
|
static SkString* ScalarToString(SkScalar x, const char* text);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a string representation of the char pointer passed in.
|
|
|
|
@param text const void* that will be cast to a char*
|
|
|
|
*/
|
2013-03-07 20:30:32 +00:00
|
|
|
static SkString* TextToString(const void* text, size_t byteLength,
|
|
|
|
SkPaint::TextEncoding encoding);
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|