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 10 #ifndef SkPDFUtils_DEFINED 11 #define SkPDFUtils_DEFINED 12 13 #include "SkPath.h" 14 15 class SkMatrix; 16 class SkPath; 17 class SkPDFArray; 18 struct SkRect; 19 20 #if 0 21 #define PRINT_NOT_IMPL(str) fprintf(stderr, str) 22 #else 23 #define PRINT_NOT_IMPL(str) 24 #endif 25 26 #define NOT_IMPLEMENTED(condition, assert) \ 27 do { \ 28 if (condition) { \ 29 PRINT_NOT_IMPL("NOT_IMPLEMENTED: " #condition "\n"); \ 30 SkDEBUGCODE(SkASSERT(!assert);) \ 31 } \ 32 } while (0) 33 34 class SkPDFUtils { 35 public: 36 static SkPDFArray* MatrixToArray(const SkMatrix& matrix); 37 static void AppendTransform(const SkMatrix& matrix, SkWStream* content); 38 39 static void MoveTo(SkScalar x, SkScalar y, SkWStream* content); 40 static void AppendLine(SkScalar x, SkScalar y, SkWStream* content); 41 static void AppendCubic(SkScalar ctl1X, SkScalar ctl1Y, 42 SkScalar ctl2X, SkScalar ctl2Y, 43 SkScalar dstX, SkScalar dstY, SkWStream* content); 44 static void AppendRectangle(const SkRect& rect, SkWStream* content); 45 static void EmitPath(const SkPath& path, SkWStream* content); 46 static void ClosePath(SkWStream* content); 47 static void PaintPath(SkPaint::Style style, SkPath::FillType fill, 48 SkWStream* content); 49 static void StrokePath(SkWStream* content); 50 static void DrawFormXObject(int objectIndex, SkWStream* content); 51 static void ApplyGraphicState(int objectIndex, SkWStream* content); 52 }; 53 54 #endif 55