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