epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 1 | |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 3 | * Copyright 2011 Google Inc. |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 9 | |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 10 | #ifndef SkPDFUtils_DEFINED |
| 11 | #define SkPDFUtils_DEFINED |
| 12 | |
vandebo@chromium.org | f71b210 | 2011-04-04 19:46:31 +0000 | [diff] [blame] | 13 | #include "SkPath.h" |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 14 | |
| 15 | class SkMatrix; |
| 16 | class SkPath; |
| 17 | class SkPDFArray; |
vandebo@chromium.org | 8989d31 | 2011-05-18 22:10:09 +0000 | [diff] [blame] | 18 | struct SkRect; |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 19 | |
vandebo@chromium.org | f71b210 | 2011-04-04 19:46:31 +0000 | [diff] [blame] | 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 | |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 34 | class SkPDFUtils { |
| 35 | public: |
| 36 | static SkPDFArray* MatrixToArray(const SkMatrix& matrix); |
vandebo@chromium.org | 75f97e4 | 2011-04-11 23:24:18 +0000 | [diff] [blame] | 37 | static void AppendTransform(const SkMatrix& matrix, SkWStream* content); |
vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 38 | |
| 39 | static void MoveTo(SkScalar x, SkScalar y, SkWStream* content); |
| 40 | static void AppendLine(SkScalar x, SkScalar y, SkWStream* content); |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 41 | static void AppendCubic(SkScalar ctl1X, SkScalar ctl1Y, |
| 42 | SkScalar ctl2X, SkScalar ctl2Y, |
vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 43 | SkScalar dstX, SkScalar dstY, SkWStream* content); |
vandebo@chromium.org | 9fbdf87 | 2011-05-09 07:55:58 +0000 | [diff] [blame] | 44 | static void AppendRectangle(const SkRect& rect, SkWStream* content); |
vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 45 | static void EmitPath(const SkPath& path, SkWStream* content); |
| 46 | static void ClosePath(SkWStream* content); |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 47 | static void PaintPath(SkPaint::Style style, SkPath::FillType fill, |
vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 48 | SkWStream* content); |
| 49 | static void StrokePath(SkWStream* content); |
vandebo@chromium.org | 6112c21 | 2011-05-13 03:50:38 +0000 | [diff] [blame] | 50 | static void DrawFormXObject(int objectIndex, SkWStream* content); |
| 51 | static void ApplyGraphicState(int objectIndex, SkWStream* content); |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | #endif |