michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkPDFDeviceFlattener_DEFINED michael@0: #define SkPDFDeviceFlattener_DEFINED michael@0: michael@0: #include "SkPDFDevice.h" michael@0: michael@0: michael@0: /** \class SkPDFDeviceFlattener michael@0: michael@0: The PDF Device Flattener is used to flatten features without native support in PDF. michael@0: For now, the only one implemented is Perspective. michael@0: michael@0: TODO(edisonn): Rename the class once we know all the things it will do. michael@0: */ michael@0: class SkPDFDeviceFlattener : public SkPDFDevice { michael@0: private: michael@0: typedef SkPDFDevice INHERITED; michael@0: michael@0: SK_API SkPDFDeviceFlattener(const SkSize& pageSize, const SkRect* trimBox = NULL); michael@0: michael@0: public: michael@0: SK_API virtual ~SkPDFDeviceFlattener(); michael@0: michael@0: virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, michael@0: size_t count, const SkPoint[], michael@0: const SkPaint& paint) SK_OVERRIDE; michael@0: virtual void drawRect(const SkDraw&, const SkRect& r, const SkPaint& paint); michael@0: virtual void drawPath(const SkDraw&, const SkPath& origpath, michael@0: const SkPaint& paint, const SkMatrix* prePathMatrix, michael@0: bool pathIsMutable) SK_OVERRIDE; michael@0: virtual void drawText(const SkDraw&, const void* text, size_t len, michael@0: SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE; michael@0: virtual void drawPosText(const SkDraw&, const void* text, size_t len, michael@0: const SkScalar pos[], SkScalar constY, michael@0: int scalarsPerPos, const SkPaint&) SK_OVERRIDE; michael@0: virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, michael@0: const SkPath& path, const SkMatrix* matrix, michael@0: const SkPaint& paint) SK_OVERRIDE; michael@0: private: michael@0: michael@0: bool mustFlatten(const SkDraw& d) const; michael@0: bool mustPathText(const SkDraw& d, const SkPaint& paint); michael@0: michael@0: friend class SkDocument_PDF; michael@0: }; michael@0: michael@0: #endif // SkPDFDeviceFlattener_DEFINED