Chromium Code Reviews| Index: src/doc/SkCanvasSimplifier.h |
| diff --git a/src/doc/SkCanvasSimplifier.h b/src/doc/SkCanvasSimplifier.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..89b8777a02879e59f8960913c9d08dd6f3e0156e |
| --- /dev/null |
| +++ b/src/doc/SkCanvasSimplifier.h |
| @@ -0,0 +1,139 @@ |
| +/* |
| + * Copyright 2013 The Android Open Source Project |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| + |
| +#ifndef SkCanvasSimplifier_DEFINED |
| +#define SkCanvasSimplifier_DEFINED |
| + |
| +#include "SkCanvas.h" |
| + |
| +/** \class SkCanvasSimplifier |
| + |
| + Canvas Simplifier will simplify the geometry and the paint so it is easier to have the vectorial |
| + properties preserved. |
| + |
| + Right now it is a pass though layer, that calls into the base canvas. |
| + |
| + TODO(edisonn): For example instead f using perspective matrix, it will flatten the geometry so |
| + PDF can export the geometry easier. |
| + |
| + TODO(edisonn): It could update the shader of the paint, or do other xfer that PDF does not |
| + support natively. |
| +*/ |
| +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
|
| +public: |
| + SK_DECLARE_INST_COUNT(SkCanvasSimplifier) |
| + |
| + SkCanvasSimplifier(); |
| + |
| + /** Construct a canvas with the specified device to draw into. |
| + @param device Specifies a device for the canvas to draw into. |
| + */ |
| + explicit SkCanvasSimplifier(SkBaseDevice* device); |
| + |
| + virtual ~SkCanvasSimplifier(); |
| + |
| + 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 isDrawingToLayer() const; |
| + |
| + 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, |
| + bool doAntiAlias = false); |
| + |
| + virtual bool clipRRect(const SkRRect& rrect, |
| + SkRegion::Op op = SkRegion::kIntersect_Op, |
| + bool doAntiAlias = false); |
| + |
| + virtual bool clipPath(const SkPath& path, |
| + SkRegion::Op op = SkRegion::kIntersect_Op, |
| + bool doAntiAlias = false); |
| + |
| + virtual bool clipRegion(const SkRegion& deviceRgn, |
| + SkRegion::Op op = SkRegion::kIntersect_Op); |
| + |
| + virtual void clear(SkColor); |
| + |
| + 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 drawOval(const SkRect& oval, const SkPaint&); |
| + |
| + virtual void drawRRect(const SkRRect& rrect, 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 drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, |
| + const SkRect& dst, |
| + const SkPaint* paint = NULL, |
| + DrawBitmapRectFlags flags = kNone_DrawBitmapRectFlag); |
| + |
| + virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, |
| + const SkPaint* paint = NULL); |
| + |
| + virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
| + const SkRect& dst, 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& picture); |
| + |
| + 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); |
| + |
| + |
| + virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter); |
| + |
| + |
| +private: |
| + typedef SkCanvas INHERITED; |
| +}; |
| + |
| +#endif // SkCanvasSimplifier_DEFINED |