michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SKOBJECTPARSER_H_ michael@0: #define SKOBJECTPARSER_H_ michael@0: michael@0: #include "SkCanvas.h" michael@0: #include "SkString.h" michael@0: michael@0: /** \class SkObjectParser michael@0: michael@0: The ObjectParser is used to return string information about parameters michael@0: in each draw command. michael@0: */ michael@0: class SkObjectParser { michael@0: public: michael@0: michael@0: /** michael@0: Returns a string about a bitmaps bounds and config. michael@0: @param bitmap SkBitmap michael@0: */ michael@0: static SkString* BitmapToString(const SkBitmap& bitmap); michael@0: michael@0: /** michael@0: Returns a string representation of a boolean. michael@0: @param doAA boolean michael@0: */ michael@0: static SkString* BoolToString(bool doAA); michael@0: michael@0: /** michael@0: Returns a string representation of the text pointer passed in. michael@0: */ michael@0: static SkString* CustomTextToString(const char* text); michael@0: michael@0: /** michael@0: Returns a string representation of an integer with the text parameter michael@0: at the front of the string. michael@0: @param x integer michael@0: @param text michael@0: */ michael@0: static SkString* IntToString(int x, const char* text); michael@0: /** michael@0: Returns a string representation of the SkIRects coordinates. michael@0: @param rect SkIRect michael@0: */ michael@0: static SkString* IRectToString(const SkIRect& rect); michael@0: michael@0: /** michael@0: Returns a string representation of an SkMatrix's contents michael@0: @param matrix SkMatrix michael@0: */ michael@0: static SkString* MatrixToString(const SkMatrix& matrix); michael@0: michael@0: /** michael@0: Returns a string representation of an SkPaint's color michael@0: @param paint SkPaint michael@0: */ michael@0: static SkString* PaintToString(const SkPaint& paint); michael@0: michael@0: /** michael@0: Returns a string representation of a SkPath's points. michael@0: @param path SkPath michael@0: */ michael@0: static SkString* PathToString(const SkPath& path); michael@0: michael@0: /** michael@0: Returns a string representation of the points in the point array. michael@0: @param pts[] Array of SkPoints michael@0: @param count michael@0: */ michael@0: static SkString* PointsToString(const SkPoint pts[], size_t count); michael@0: michael@0: /** michael@0: Returns a string representation of the SkCanvas PointMode enum. michael@0: */ michael@0: static SkString* PointModeToString(SkCanvas::PointMode mode); michael@0: michael@0: /** michael@0: Returns a string representation of the SkRects coordinates. michael@0: @param rect SkRect michael@0: */ michael@0: static SkString* RectToString(const SkRect& rect, const char* title = NULL); michael@0: michael@0: /** michael@0: Returns a string representation of an SkRRect. michael@0: @param rrect SkRRect michael@0: */ michael@0: static SkString* RRectToString(const SkRRect& rrect, const char* title = NULL); michael@0: michael@0: /** michael@0: Returns a string representation of the SkRegion enum. michael@0: @param op SkRegion::op enum michael@0: */ michael@0: static SkString* RegionOpToString(SkRegion::Op op); michael@0: michael@0: /** michael@0: Returns a string representation of the SkRegion. michael@0: @param region SkRegion michael@0: */ michael@0: static SkString* RegionToString(const SkRegion& region); michael@0: michael@0: /** michael@0: Returns a string representation of the SkCanvas::SaveFlags enum. michael@0: @param flags SkCanvas::SaveFlags enum michael@0: */ michael@0: static SkString* SaveFlagsToString(SkCanvas::SaveFlags flags); michael@0: michael@0: /** michael@0: Returns a string representation of an SkScalar with the text parameter michael@0: at the front of the string. michael@0: @param x SkScalar michael@0: @param text michael@0: */ michael@0: static SkString* ScalarToString(SkScalar x, const char* text); michael@0: michael@0: /** michael@0: Returns a string representation of the char pointer passed in. michael@0: @param text const void* that will be cast to a char* michael@0: */ michael@0: static SkString* TextToString(const void* text, size_t byteLength, michael@0: SkPaint::TextEncoding encoding); michael@0: }; michael@0: michael@0: #endif