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

Side by Side Diff: src/doc/SkCanvasSimplifier.h

Issue 24811002: Update the SkDocument interface to allow for 1) abort won't emit pdf, 2) close can report success/f… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 The Android Open Source Project
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
9 #ifndef SkCanvasSimplifier_DEFINED
10 #define SkCanvasSimplifier_DEFINED
11
12 #include "SkCanvas.h"
13
14 /** \class SkCanvasSimplifier
15
16 Canvas Simplifier will simplify the geometry and the paint so it is easier t o have the vectorial
17 properties preserved.
18
19 Right now it is a pass though layer, that calls into the base canvas.
20
21 TODO(edisonn): For example instead f using perspective matrix, it will flatt en the geometry so
22 PDF can export the geometry easier.
23
24 TODO(edisonn): It could update the shader of the paint, or do other xfer tha t PDF does not
25 support natively.
26 */
27 class SkCanvasSimplifier : public SkCanvas {
vandebo (ex-Chrome) 2013/09/27 15:50:17 There's probably a better name for this: SkPerspec
edisonn 2013/10/04 19:40:37 removed
28 public:
29 SK_DECLARE_INST_COUNT(SkCanvasSimplifier)
30
31 SkCanvasSimplifier();
32
33 /** Construct a canvas with the specified device to draw into.
34 @param device Specifies a device for the canvas to draw into.
35 */
36 explicit SkCanvasSimplifier(SkBaseDevice* device);
37
38 virtual ~SkCanvasSimplifier();
39
40 virtual int save(SaveFlags flags = kMatrixClip_SaveFlag);
41
42 virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
43 SaveFlags flags = kARGB_ClipLayer_SaveFlag);
44
45 virtual void restore();
46
47 virtual bool isDrawingToLayer() const;
48
49 virtual bool translate(SkScalar dx, SkScalar dy);
50
51 virtual bool scale(SkScalar sx, SkScalar sy);
52
53 virtual bool rotate(SkScalar degrees);
54
55 virtual bool skew(SkScalar sx, SkScalar sy);
56
57 virtual bool concat(const SkMatrix& matrix);
58
59 virtual void setMatrix(const SkMatrix& matrix);
60
61 virtual bool clipRect(const SkRect& rect,
62 SkRegion::Op op = SkRegion::kIntersect_Op,
63 bool doAntiAlias = false);
64
65 virtual bool clipRRect(const SkRRect& rrect,
66 SkRegion::Op op = SkRegion::kIntersect_Op,
67 bool doAntiAlias = false);
68
69 virtual bool clipPath(const SkPath& path,
70 SkRegion::Op op = SkRegion::kIntersect_Op,
71 bool doAntiAlias = false);
72
73 virtual bool clipRegion(const SkRegion& deviceRgn,
74 SkRegion::Op op = SkRegion::kIntersect_Op);
75
76 virtual void clear(SkColor);
77
78 virtual void drawPaint(const SkPaint& paint);
79
80 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
81 const SkPaint& paint);
82
83 virtual void drawRect(const SkRect& rect, const SkPaint& paint);
84
85 virtual void drawOval(const SkRect& oval, const SkPaint&);
86
87 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint);
88
89 virtual void drawPath(const SkPath& path, const SkPaint& paint);
90
91 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
92 const SkPaint* paint = NULL);
93
94 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
95 const SkRect& dst,
96 const SkPaint* paint = NULL,
97 DrawBitmapRectFlags flags = kNone_DrawBitm apRectFlag);
98
99 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
100 const SkPaint* paint = NULL);
101
102 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
103 const SkRect& dst, const SkPaint* paint = NULL);
104
105 virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
106 const SkPaint* paint = NULL);
107
108
109 virtual void drawText(const void* text, size_t byteLength, SkScalar x,
110 SkScalar y, const SkPaint& paint);
111
112 virtual void drawPosText(const void* text, size_t byteLength,
113 const SkPoint pos[], const SkPaint& paint);
114
115 virtual void drawPosTextH(const void* text, size_t byteLength,
116 const SkScalar xpos[], SkScalar constY,
117 const SkPaint& paint);
118
119 virtual void drawTextOnPath(const void* text, size_t byteLength,
120 const SkPath& path, const SkMatrix* matrix,
121 const SkPaint& paint);
122
123 virtual void drawPicture(SkPicture& picture);
124
125 virtual void drawVertices(VertexMode vmode, int vertexCount,
126 const SkPoint vertices[], const SkPoint texs[],
127 const SkColor colors[], SkXfermode* xmode,
128 const uint16_t indices[], int indexCount,
129 const SkPaint& paint);
130
131
132 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter);
133
134
135 private:
136 typedef SkCanvas INHERITED;
137 };
138
139 #endif // SkCanvasSimplifier_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698