#include <SkDumpCanvas.h>
Inherits SkCanvas.
Classes | |
class | Dumper |
Public Types | |
enum | Verb { kNULL_Verb, kSave_Verb, kRestore_Verb, kMatrix_Verb, kClip_Verb, kDrawPaint_Verb, kDrawPoints_Verb, kDrawRect_Verb, kDrawPath_Verb, kDrawBitmap_Verb, kDrawText_Verb, kDrawPicture_Verb, kDrawShape_Verb, kDrawVertices_Verb } |
Public Member Functions | |
SkDumpCanvas (Dumper *=0) | |
virtual | ~SkDumpCanvas () |
Dumper * | getDumper () const |
void | setDumper (Dumper *) |
int | getNestLevel () const |
virtual int | save (SaveFlags flags=kMatrixClip_SaveFlag) |
virtual int | saveLayer (const SkRect *bounds, const SkPaint *paint, SaveFlags flags=kARGB_ClipLayer_SaveFlag) |
virtual void | restore () |
virtual bool | translate (SkScalar dx, SkScalar dy) |
virtual bool | scale (SkScalar sx, SkScalar sy) |
virtual bool | rotate (SkScalar degrees) |
virtual bool | skew (SkScalar sx, SkScalar sy) |
virtual bool | concat (const SkMatrix &matrix) |
virtual void | setMatrix (const SkMatrix &matrix) |
virtual bool | clipRect (const SkRect &rect, SkRegion::Op op=SkRegion::kIntersect_Op) |
virtual bool | clipPath (const SkPath &path, SkRegion::Op op=SkRegion::kIntersect_Op) |
virtual bool | clipRegion (const SkRegion &deviceRgn, SkRegion::Op op=SkRegion::kIntersect_Op) |
virtual void | drawPaint (const SkPaint &paint) |
virtual void | drawPoints (PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint) |
virtual void | drawRect (const SkRect &rect, const SkPaint &paint) |
virtual void | drawPath (const SkPath &path, const SkPaint &paint) |
virtual void | drawBitmap (const SkBitmap &bitmap, SkScalar left, SkScalar top, const SkPaint *paint=NULL) |
virtual void | drawBitmapRect (const SkBitmap &bitmap, const SkIRect *src, const SkRect &dst, const SkPaint *paint=NULL) |
virtual void | drawBitmapMatrix (const SkBitmap &bitmap, const SkMatrix &m, const SkPaint *paint=NULL) |
virtual void | drawSprite (const SkBitmap &bitmap, int left, int top, const SkPaint *paint=NULL) |
virtual void | drawText (const void *text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint &paint) |
virtual void | drawPosText (const void *text, size_t byteLength, const SkPoint pos[], const SkPaint &paint) |
virtual void | drawPosTextH (const void *text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint &paint) |
virtual void | drawTextOnPath (const void *text, size_t byteLength, const SkPath &path, const SkMatrix *matrix, const SkPaint &paint) |
virtual void | drawPicture (SkPicture &) |
virtual void | drawShape (SkShape *) |
virtual void | drawVertices (VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode *xmode, const uint16_t indices[], int indexCount, const SkPaint &paint) |
This class overrides all the draw methods on SkCanvas, and formats them as text, and then sends that to a Dumper helper object.
Typical use might be to dump a display list to a log file to see what is being drawn.
Definition at line 12 of file SkDumpCanvas.h.
enum SkDumpCanvas::Verb |
Definition at line 19 of file SkDumpCanvas.h.
SkDumpCanvas::SkDumpCanvas | ( | Dumper * | = 0 |
) | [explicit] |
virtual SkDumpCanvas::~SkDumpCanvas | ( | ) | [virtual] |
virtual bool SkDumpCanvas::clipPath | ( | const SkPath & | path, | |
SkRegion::Op | op = SkRegion::kIntersect_Op | |||
) | [virtual] |
Modify the current clip with the specified path.
path | The path to apply to the current clip | |
op | The region op to apply to the current clip |
Reimplemented from SkCanvas.
virtual bool SkDumpCanvas::clipRect | ( | const SkRect & | rect, | |
SkRegion::Op | op = SkRegion::kIntersect_Op | |||
) | [virtual] |
Modify the current clip with the specified rectangle.
rect | The rect to intersect with the current clip | |
op | The region op to apply to the current clip |
Reimplemented from SkCanvas.
virtual bool SkDumpCanvas::clipRegion | ( | const SkRegion & | deviceRgn, | |
SkRegion::Op | op = SkRegion::kIntersect_Op | |||
) | [virtual] |
Modify the current clip with the specified region. Note that unlike clipRect() and clipPath() which transform their arguments by the current matrix, clipRegion() assumes its argument is already in device coordinates, and so no transformation is performed.
deviceRgn | The region to apply to the current clip | |
op | The region op to apply to the current clip |
Reimplemented from SkCanvas.
virtual bool SkDumpCanvas::concat | ( | const SkMatrix & | matrix | ) | [virtual] |
Preconcat the current matrix with the specified matrix.
matrix | The matrix to preconcatenate with the current matrix |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawBitmap | ( | const SkBitmap & | bitmap, | |
SkScalar | left, | |||
SkScalar | top, | |||
const SkPaint * | paint = NULL | |||
) | [virtual] |
Draw the specified bitmap, with its top/left corner at (x,y), using the specified paint, transformed by the current matrix. Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height, then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated.
bitmap | The bitmap to be drawn | |
left | The position of the left side of the bitmap being drawn | |
top | The position of the top side of the bitmap being drawn | |
paint | The paint used to draw the bitmap, or NULL |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawBitmapMatrix | ( | const SkBitmap & | bitmap, | |
const SkMatrix & | m, | |||
const SkPaint * | paint = NULL | |||
) | [virtual] |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawBitmapRect | ( | const SkBitmap & | bitmap, | |
const SkIRect * | src, | |||
const SkRect & | dst, | |||
const SkPaint * | paint = NULL | |||
) | [virtual] |
Draw the specified bitmap, with the specified matrix applied (before the canvas' matrix is applied).
bitmap | The bitmap to be drawn | |
src | Optional: specify the subset of the bitmap to be drawn | |
dst | The destination rectangle where the scaled/translated image will be drawn | |
paint | The paint used to draw the bitmap, or NULL |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawPaint | ( | const SkPaint & | paint | ) | [virtual] |
Fill the entire canvas' bitmap (restricted to the current clip) with the specified paint.
paint | The paint used to fill the canvas |
Reimplemented from SkCanvas.
Draw the specified path using the specified paint. The path will be filled or framed based on the Style in the paint.
path | The path to be drawn | |
paint | The paint used to draw the path |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawPicture | ( | SkPicture & | picture | ) | [virtual] |
Draw the picture into this canvas. This method effective brackets the playback of the picture's draw calls with save/restore, so the state of this canvas will be unchanged after this call. This contrasts with the more immediate method SkPicture::draw(), which does not bracket the canvas with save/restore, thus the canvas may be left in a changed state after the call.
picture | The recorded drawing commands to playback into this canvas. |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawPoints | ( | PointMode | mode, | |
size_t | count, | |||
const SkPoint | pts[], | |||
const SkPaint & | paint | |||
) | [virtual] |
Draw a series of points, interpreted based on the PointMode mode. For all modes, the count parameter is interpreted as the total number of points. For kLine mode, count/2 line segments are drawn. For kPoint mode, each point is drawn centered at its coordinate, and its size is specified by the paint's stroke-width. It draws as a square, unless the paint's cap-type is round, in which the points are drawn as circles. For kLine mode, each pair of points is drawn as a line segment, respecting the paint's settings for cap/join/width. For kPolygon mode, the entire array is drawn as a series of connected line segments. Note that, while similar, kLine and kPolygon modes draw slightly differently than the equivalent path built with a series of moveto, lineto calls, in that the path will draw all of its contours at once, with no interactions if contours intersect each other (think XOR xfermode). drawPoints always draws each element one at a time.
mode | PointMode specifying how to draw the array of points. | |
count | The number of points in the array | |
pts | Array of points to draw | |
paint | The paint used to draw the points |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawPosText | ( | const void * | text, | |
size_t | byteLength, | |||
const SkPoint | pos[], | |||
const SkPaint & | paint | |||
) | [virtual] |
Draw the text, with each character/glyph origin specified by the pos[] array. The origin is interpreted by the Align setting in the paint.
text | The text to be drawn | |
byteLength | The number of bytes to read from the text parameter | |
pos | Array of positions, used to position each character | |
paint | The paint used for the text (e.g. color, size, style) |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawPosTextH | ( | const void * | text, | |
size_t | byteLength, | |||
const SkScalar | xpos[], | |||
SkScalar | constY, | |||
const SkPaint & | paint | |||
) | [virtual] |
Draw the text, with each character/glyph origin specified by the x coordinate taken from the xpos[] array, and the y from the constY param. The origin is interpreted by the Align setting in the paint.
text | The text to be drawn | |
byteLength | The number of bytes to read from the text parameter | |
xpos | Array of x-positions, used to position each character | |
constY | The shared Y coordinate for all of the positions | |
paint | The paint used for the text (e.g. color, size, style) |
Reimplemented from SkCanvas.
Draw the specified rectangle using the specified paint. The rectangle will be filled or stroked based on the Style in the paint.
rect | The rect to be drawn | |
paint | The paint used to draw the rect |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawShape | ( | SkShape * | ) | [virtual] |
Draws the specified shape
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawSprite | ( | const SkBitmap & | bitmap, | |
int | left, | |||
int | top, | |||
const SkPaint * | paint = NULL | |||
) | [virtual] |
Draw the specified bitmap, with its top/left corner at (x,y), NOT transformed by the current matrix. Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height, then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated.
bitmap | The bitmap to be drawn | |
left | The position of the left side of the bitmap being drawn | |
top | The position of the top side of the bitmap being drawn | |
paint | The paint used to draw the bitmap, or NULL |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawText | ( | const void * | text, | |
size_t | byteLength, | |||
SkScalar | x, | |||
SkScalar | y, | |||
const SkPaint & | paint | |||
) | [virtual] |
Draw the text, with origin at (x,y), using the specified paint. The origin is interpreted based on the Align setting in the paint.
text | The text to be drawn | |
byteLength | The number of bytes to read from the text parameter | |
x | The x-coordinate of the origin of the text being drawn | |
y | The y-coordinate of the origin of the text being drawn | |
paint | The paint used for the text (e.g. color, size, style) |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawTextOnPath | ( | const void * | text, | |
size_t | byteLength, | |||
const SkPath & | path, | |||
const SkMatrix * | matrix, | |||
const SkPaint & | paint | |||
) | [virtual] |
Draw the text, with origin at (x,y), using the specified paint, along the specified path. The paint's Align setting determins where along the path to start the text.
text | The text to be drawn | |
byteLength | The number of bytes to read from the text parameter | |
path | The path the text should follow for its baseline | |
matrix | (may be null) Applied to the text before it is mapped onto the path | |
paint | The paint used for the text |
Reimplemented from SkCanvas.
virtual void SkDumpCanvas::drawVertices | ( | VertexMode | vmode, | |
int | vertexCount, | |||
const SkPoint | vertices[], | |||
const SkPoint | texs[], | |||
const SkColor | colors[], | |||
SkXfermode * | xmode, | |||
const uint16_t | indices[], | |||
int | indexCount, | |||
const SkPaint & | paint | |||
) | [virtual] |
Draw the array of vertices, interpreted as triangles (based on mode).
vmode | How to interpret the array of vertices | |
vertexCount | The number of points in the vertices array (and corresponding texs and colors arrays if non-null) | |
vertices | Array of vertices for the mesh | |
texs | May be null. If not null, specifies the coordinate in texture space for each vertex. | |
colors | May be null. If not null, specifies a color for each vertex, to be interpolated across the triangle. | |
xmode | Used if both texs and colors are present. In this case the colors are combined with the texture using mode, before being drawn using the paint. If mode is null, then kMultiply_Mode is used. | |
indices | If not null, array of indices to reference into the vertex (texs, colors) array. | |
indexCount | number of entries in the indices array (if not null) | |
paint | Specifies the shader/texture if present. |
Reimplemented from SkCanvas.
Dumper* SkDumpCanvas::getDumper | ( | ) | const [inline] |
Definition at line 49 of file SkDumpCanvas.h.
int SkDumpCanvas::getNestLevel | ( | ) | const [inline] |
Definition at line 52 of file SkDumpCanvas.h.
virtual void SkDumpCanvas::restore | ( | ) | [virtual] |
virtual bool SkDumpCanvas::rotate | ( | SkScalar | degrees | ) | [virtual] |
Preconcat the current matrix with the specified rotation.
degrees | The amount to rotate, in degrees returns true if the operation succeeded (e.g. did not overflow) |
Reimplemented from SkCanvas.
virtual int SkDumpCanvas::save | ( | SaveFlags | flags = kMatrixClip_SaveFlag |
) | [virtual] |
This call saves the current matrix and clip information, and pushes a copy onto a private stack. Subsequent calls to translate, scale, rotate, skew, concat or clipRect, clipPath all operate on this copy. When the balancing call to restore() is made, this copy is deleted and the previous matrix/clip state is restored.
Reimplemented from SkCanvas.
virtual int SkDumpCanvas::saveLayer | ( | const SkRect * | bounds, | |
const SkPaint * | paint, | |||
SaveFlags | flags = kARGB_ClipLayer_SaveFlag | |||
) | [virtual] |
This behaves the same as save(), but in addition it allocates an offscreen bitmap. All drawing calls are directed there, and only when the balancing call to restore() is made is that offscreen transfered to the canvas (or the previous layer). Subsequent calls to translate, scale, rotate, skew, concat or clipRect, clipPath all operate on this copy. When the balancing call to restore() is made, this copy is deleted and the previous matrix/clip state is restored.
bounds | (may be null) the maximum size the offscreen bitmap needs to be (in local coordinates) | |
paint | (may be null) This is copied, and is applied to the offscreen when restore() is called | |
flags | LayerFlags |
Reimplemented from SkCanvas.
Preconcat the current matrix with the specified scale.
sx | The amount to scale in X | |
sy | The amount to scale in Y returns true if the operation succeeded (e.g. did not overflow) |
Reimplemented from SkCanvas.
void SkDumpCanvas::setDumper | ( | Dumper * | ) |
virtual void SkDumpCanvas::setMatrix | ( | const SkMatrix & | matrix | ) | [virtual] |
Replace the current matrix with a copy of the specified matrix.
matrix | The matrix that will be copied into the current matrix. |
Reimplemented from SkCanvas.
Preconcat the current matrix with the specified skew.
sx | The amount to skew in X | |
sy | The amount to skew in Y returns true if the operation succeeded (e.g. did not overflow) |
Reimplemented from SkCanvas.
Preconcat the current matrix with the specified translation
dx | The distance to translate in X | |
dy | The distance to translate in Y returns true if the operation succeeded (e.g. did not overflow) |
Reimplemented from SkCanvas.