SkNWayCanvas.h revision 392c9be344549e809d0468abafdbeb6e32135bcd
1
2/*
3 * Copyright 2011 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#ifndef SkNWayCanvas_DEFINED
10#define SkNWayCanvas_DEFINED
11
12#include "SkCanvas.h"
13
14class SK_API SkNWayCanvas : public SkCanvas {
15public:
16    SkNWayCanvas(int width, int height);
17    virtual ~SkNWayCanvas();
18
19    virtual void addCanvas(SkCanvas*);
20    virtual void removeCanvas(SkCanvas*);
21    virtual void removeAll();
22
23    ///////////////////////////////////////////////////////////////////////////
24    // These are forwarded to the N canvases we're referencing
25
26    virtual int save(SaveFlags) SK_OVERRIDE;
27    virtual int saveLayer(const SkRect* bounds, const SkPaint*,
28                          SaveFlags) SK_OVERRIDE;
29    virtual void restore() SK_OVERRIDE;
30    virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE;
31    virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
32    virtual bool rotate(SkScalar degrees) SK_OVERRIDE;
33    virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE;
34    virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
35    virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
36    virtual void clear(SkColor) SK_OVERRIDE;
37    virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
38    virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
39                            const SkPaint&) SK_OVERRIDE;
40    virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
41    virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
42    virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
43    virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
44    virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
45                            const SkPaint*) SK_OVERRIDE;
46    virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
47                                      const SkRect& dst, const SkPaint* paint,
48                                      DrawBitmapRectFlags flags) SK_OVERRIDE;
49    virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
50                                  const SkPaint*) SK_OVERRIDE;
51    virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
52                                const SkRect& dst,
53                                const SkPaint* paint = NULL) SK_OVERRIDE;
54    virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
55                            const SkPaint*) SK_OVERRIDE;
56    virtual void drawText(const void* text, size_t byteLength, SkScalar x,
57                          SkScalar y, const SkPaint&) SK_OVERRIDE;
58    virtual void drawPosText(const void* text, size_t byteLength,
59                             const SkPoint pos[], const SkPaint&) SK_OVERRIDE;
60    virtual void drawPosTextH(const void* text, size_t byteLength,
61                              const SkScalar xpos[], SkScalar constY,
62                              const SkPaint&) SK_OVERRIDE;
63    virtual void drawTextOnPath(const void* text, size_t byteLength,
64                                const SkPath& path, const SkMatrix* matrix,
65                                const SkPaint&) SK_OVERRIDE;
66    virtual void drawPicture(SkPicture&) SK_OVERRIDE;
67    virtual void drawVertices(VertexMode vmode, int vertexCount,
68                              const SkPoint vertices[], const SkPoint texs[],
69                              const SkColor colors[], SkXfermode* xmode,
70                              const uint16_t indices[], int indexCount,
71                              const SkPaint&) SK_OVERRIDE;
72    virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
73
74    virtual SkBounder* setBounder(SkBounder*) SK_OVERRIDE;
75    virtual SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE;
76
77    virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
78    virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
79    virtual void endCommentGroup() SK_OVERRIDE;
80
81protected:
82    SkTDArray<SkCanvas*> fList;
83
84    virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
85
86    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
87    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
88    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
89    virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
90
91    class Iter;
92
93private:
94    typedef SkCanvas INHERITED;
95};
96
97
98#endif
99