Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: include/utils/SkPaintFilterCanvas.h

Issue 1032173002: Add a paint filter utility canvas (SkPaintFilterCanvas) (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: rebased Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gyp/utils.gypi ('k') | src/utils/SkPaintFilterCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkPaintFilterCanvas_DEFINED
9 #define SkPaintFilterCanvas_DEFINED
10
11 #include "SkNWayCanvas.h"
12
13 /** \class SkPaintFilterCanvas
14
15 A utility proxy base class for implementing paint filters.
16 */
17 class SK_API SkPaintFilterCanvas : public SkNWayCanvas {
18 public:
19 SkPaintFilterCanvas(int width, int height);
20
21 enum Type {
22 kPaint_Type,
23 kPoint_Type,
24 kBitmap_Type,
25 kRect_Type,
26 kRRect_Type,
27 kDRRect_Type,
28 kOval_Type,
29 kPath_Type,
30 kPicture_Type,
31 kText_Type,
32 kTextBlob_Type,
33 kVertices_Type,
34 kPatch_Type,
35
36 kTypeCount
37 };
38
39 protected:
40 /**
41 * Called with the paint that will be used to draw the specified type.
42 * The implementation may modify the paint as they wish.
43 *
44 * Note: The base implementation calls onFilterPaint() for top-level/explic it paints only.
45 * To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), c lients may need to
46 * override the relevant methods (i.e. drawPicture, drawTextBlob).
47 */
48 virtual void onFilterPaint(SkPaint* paint, Type type) const = 0;
49
50 void onDrawPaint(const SkPaint&) override;
51 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) override;
52 void onDrawRect(const SkRect&, const SkPaint&) override;
53 void onDrawRRect(const SkRRect&, const SkPaint&) override;
54 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
55 void onDrawOval(const SkRect&, const SkPaint&) override;
56 void onDrawPath(const SkPath&, const SkPaint&) override;
57 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain t*) override;
58 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
59 DrawBitmapRectFlags flags) override;
60 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint* ) override;
61 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
62 const SkPaint*) override;
63 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
64 const SkPaint*) override;
65 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) overri de;
66 void onDrawVertices(VertexMode vmode, int vertexCount,
67 const SkPoint vertices[], const SkPoint texs[],
68 const SkColor colors[], SkXfermode* xmode,
69 const uint16_t indices[], int indexCount,
70 const SkPaint&) override;
71 void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
72 const SkPoint texCoords[4], SkXfermode* xmode,
73 const SkPaint& paint) override;
74 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri de;
75
76 void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
77 const SkPaint&) override;
78 void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
79 const SkPaint&) override;
80 void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos [],
81 SkScalar constY, const SkPaint&) override;
82 void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& pat h,
83 const SkMatrix* matrix, const SkPaint&) override;
84 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
85 const SkPaint& paint) override;
86
87 private:
88 class AutoPaintFilter;
89
90 typedef SkNWayCanvas INHERITED;
91 };
92
93 #endif
OLDNEW
« no previous file with comments | « gyp/utils.gypi ('k') | src/utils/SkPaintFilterCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698