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 | 683001c | 2012-05-09 17:17:51 +0000 | [diff] [blame] | 13 | #include "SkPaint.h" |
vandebo@chromium.org | f71b210 | 2011-04-04 19:46:31 +0000 | [diff] [blame] | 14 | #include "SkPath.h" |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 15 | |
| 16 | class SkMatrix; |
| 17 | class SkPath; |
| 18 | class SkPDFArray; |
vandebo@chromium.org | 8989d31 | 2011-05-18 22:10:09 +0000 | [diff] [blame] | 19 | struct SkRect; |
djsollen@google.com | c73dd5c | 2012-08-07 15:54:32 +0000 | [diff] [blame] | 20 | class SkWStream; |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 21 | |
vandebo@chromium.org | f71b210 | 2011-04-04 19:46:31 +0000 | [diff] [blame] | 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 { \ |
mtklein@google.com | 330313a | 2013-08-22 15:37:26 +0000 | [diff] [blame^] | 30 | if ((bool)(condition)) { \ |
vandebo@chromium.org | f71b210 | 2011-04-04 19:46:31 +0000 | [diff] [blame] | 31 | PRINT_NOT_IMPL("NOT_IMPLEMENTED: " #condition "\n"); \ |
| 32 | SkDEBUGCODE(SkASSERT(!assert);) \ |
| 33 | } \ |
ctguil@chromium.org | a5c7234 | 2011-08-15 23:55:03 +0000 | [diff] [blame] | 34 | } while (0) |
vandebo@chromium.org | f71b210 | 2011-04-04 19:46:31 +0000 | [diff] [blame] | 35 | |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 36 | class SkPDFUtils { |
| 37 | public: |
commit-bot@chromium.org | 93a2e21 | 2013-07-23 23:16:03 +0000 | [diff] [blame] | 38 | static SkPDFArray* RectToArray(const SkRect& rect); |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 39 | static SkPDFArray* MatrixToArray(const SkMatrix& matrix); |
vandebo@chromium.org | 75f97e4 | 2011-04-11 23:24:18 +0000 | [diff] [blame] | 40 | static void AppendTransform(const SkMatrix& matrix, SkWStream* content); |
vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 41 | |
| 42 | static void MoveTo(SkScalar x, SkScalar y, SkWStream* content); |
| 43 | static void AppendLine(SkScalar x, SkScalar y, SkWStream* content); |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 44 | static void AppendCubic(SkScalar ctl1X, SkScalar ctl1Y, |
| 45 | SkScalar ctl2X, SkScalar ctl2Y, |
vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 46 | SkScalar dstX, SkScalar dstY, SkWStream* content); |
vandebo@chromium.org | 9fbdf87 | 2011-05-09 07:55:58 +0000 | [diff] [blame] | 47 | static void AppendRectangle(const SkRect& rect, SkWStream* content); |
vandebo@chromium.org | 683001c | 2012-05-09 17:17:51 +0000 | [diff] [blame] | 48 | static void EmitPath(const SkPath& path, SkPaint::Style paintStyle, |
| 49 | SkWStream* content); |
vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 50 | static void ClosePath(SkWStream* content); |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 51 | static void PaintPath(SkPaint::Style style, SkPath::FillType fill, |
vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 52 | SkWStream* content); |
| 53 | static void StrokePath(SkWStream* content); |
vandebo@chromium.org | 6112c21 | 2011-05-13 03:50:38 +0000 | [diff] [blame] | 54 | static void DrawFormXObject(int objectIndex, SkWStream* content); |
| 55 | static void ApplyGraphicState(int objectIndex, SkWStream* content); |
commit-bot@chromium.org | 93a2e21 | 2013-07-23 23:16:03 +0000 | [diff] [blame] | 56 | static void ApplyPattern(int objectIndex, SkWStream* content); |
ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | #endif |