blob: f08ca08182719209170d6c5dc5dc69ad0dd109f8 [file] [log] [blame]
chudy@google.com902ebe52012-06-29 14:21:22 +00001
2/*
3 * Copyright 2012 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10#ifndef SKOBJECTPARSER_H_
11#define SKOBJECTPARSER_H_
12
13#include <iostream>
14#include <sstream>
15#include "SkCanvas.h"
16/** \class SkObjectParser
17
18 The ObjectParser is used to return string information about parameters
19 in each draw command.
20 TODO(chudy): Change std::string to SkString
21 */
22class SkObjectParser {
23public:
24
25 /**
26 Returns a string about a bitmaps bounds and config.
27 @param bitmap SkBitmap
28 */
29 static std::string BitmapToString(const SkBitmap& bitmap);
30
31 /**
32 Returns a string representation of a boolean.
33 @param doAA boolean
34 */
35 static std::string BoolToString(bool doAA);
36
37 /**
38 Returns a string representation of an integer with the text parameter
39 at the front of the string.
40 @param x integer
41 @param text
42 */
43 static std::string IntToString(int x, const char* text);
44 /**
45 Returns a string representation of the SkIRects coordinates.
46 @param rect SkIRect
47 */
48 static std::string IRectToString(const SkIRect& rect);
49
50 /**
51 Returns a string representation of an SkMatrix's contents
52 @param matrix SkMatrix
53 */
54 static std::string MatrixToString(const SkMatrix& matrix);
55
56 /**
57 Returns a string representation of an SkPaint's color
58 @param paint SkPaint
59 */
60 static std::string PaintToString(const SkPaint& paint);
61
62 /**
63 Returns a string representation of a SkPath's points.
64 @param path SkPath
65 */
66 static std::string PathToString(const SkPath& path);
67
68 /**
69 Returns a string representation of the points in the point array.
70 @param pts[] Array of SkPoints
71 @param count
72 */
73 static std::string PointsToString(const SkPoint pts[], size_t count);
74
75 /**
chudy@google.com92b11f62012-08-01 16:10:06 +000076 Returns a string representation of the SkCanvas PointMode enum.
77 */
78 static std::string PointModeToString(SkCanvas::PointMode mode);
79
80 /**
chudy@google.com902ebe52012-06-29 14:21:22 +000081 Returns a string representation of the SkRects coordinates.
82 @param rect SkRect
83 */
84 static std::string RectToString(const SkRect& rect);
85
86 /**
87 Returns a string representation of the SkRegion enum.
88 @param op SkRegion::op enum
89 */
90 static std::string RegionOpToString(SkRegion::Op op);
91
92 /**
93 Returns a string representation of the SkRegion.
94 @param region SkRegion
95 */
96 static std::string RegionToString(const SkRegion& region);
97
98 /**
99 Returns a string representation of the SkCanvas::SaveFlags enum.
100 @param flags SkCanvas::SaveFlags enum
101 */
102 static std::string SaveFlagsToString(SkCanvas::SaveFlags flags);
103
104 /**
105 Returns a string representation of an SkScalar with the text parameter
106 at the front of the string.
107 @param x SkScalar
108 @param text
109 */
110 static std::string ScalarToString(SkScalar x, const char* text);
111
112 /**
113 Returns a string representation of the char pointer passed in.
114 @param text const void* that will be cast to a char*
115 */
116 static std::string TextToString(const void* text, size_t byteLength);
117};
118
119#endif