blob: 5b71abc73d1f8cd9d7bde7b9492e7ac2f571d12d [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 /**
76 Returns a string representation of the SkRects coordinates.
77 @param rect SkRect
78 */
79 static std::string RectToString(const SkRect& rect);
80
81 /**
82 Returns a string representation of the SkRegion enum.
83 @param op SkRegion::op enum
84 */
85 static std::string RegionOpToString(SkRegion::Op op);
86
87 /**
88 Returns a string representation of the SkRegion.
89 @param region SkRegion
90 */
91 static std::string RegionToString(const SkRegion& region);
92
93 /**
94 Returns a string representation of the SkCanvas::SaveFlags enum.
95 @param flags SkCanvas::SaveFlags enum
96 */
97 static std::string SaveFlagsToString(SkCanvas::SaveFlags flags);
98
99 /**
100 Returns a string representation of an SkScalar with the text parameter
101 at the front of the string.
102 @param x SkScalar
103 @param text
104 */
105 static std::string ScalarToString(SkScalar x, const char* text);
106
107 /**
108 Returns a string representation of the char pointer passed in.
109 @param text const void* that will be cast to a char*
110 */
111 static std::string TextToString(const void* text, size_t byteLength);
112};
113
114#endif