| ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 Google Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef SkPDFUtils_DEFINED |
| 18 | #define SkPDFUtils_DEFINED |
| 19 | |
| vandebo@chromium.org | f71b210 | 2011-04-04 19:46:31 +0000 | [diff] [blame] | 20 | #include "SkPath.h" |
| ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 21 | |
| 22 | class SkMatrix; |
| 23 | class SkPath; |
| 24 | class SkPDFArray; |
| vandebo@chromium.org | 9fbdf87 | 2011-05-09 07:55:58 +0000 | [diff] [blame] | 25 | class SkRect; |
| ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 26 | |
| vandebo@chromium.org | f71b210 | 2011-04-04 19:46:31 +0000 | [diff] [blame] | 27 | #if 0 |
| 28 | #define PRINT_NOT_IMPL(str) fprintf(stderr, str) |
| 29 | #else |
| 30 | #define PRINT_NOT_IMPL(str) |
| 31 | #endif |
| 32 | |
| 33 | #define NOT_IMPLEMENTED(condition, assert) \ |
| 34 | do { \ |
| 35 | if (condition) { \ |
| 36 | PRINT_NOT_IMPL("NOT_IMPLEMENTED: " #condition "\n"); \ |
| 37 | SkDEBUGCODE(SkASSERT(!assert);) \ |
| 38 | } \ |
| 39 | } while(0) |
| 40 | |
| ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 41 | class SkPDFUtils { |
| 42 | public: |
| 43 | static SkPDFArray* MatrixToArray(const SkMatrix& matrix); |
| vandebo@chromium.org | 75f97e4 | 2011-04-11 23:24:18 +0000 | [diff] [blame] | 44 | static void AppendTransform(const SkMatrix& matrix, SkWStream* content); |
| vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 45 | |
| 46 | static void MoveTo(SkScalar x, SkScalar y, SkWStream* content); |
| 47 | static void AppendLine(SkScalar x, SkScalar y, SkWStream* content); |
| ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 48 | static void AppendCubic(SkScalar ctl1X, SkScalar ctl1Y, |
| 49 | SkScalar ctl2X, SkScalar ctl2Y, |
| vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 50 | SkScalar dstX, SkScalar dstY, SkWStream* content); |
| vandebo@chromium.org | 9fbdf87 | 2011-05-09 07:55:58 +0000 | [diff] [blame] | 51 | static void AppendRectangle(const SkRect& rect, SkWStream* content); |
| vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 52 | static void EmitPath(const SkPath& path, SkWStream* content); |
| 53 | static void ClosePath(SkWStream* content); |
| ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 54 | static void PaintPath(SkPaint::Style style, SkPath::FillType fill, |
| vandebo@chromium.org | cae5fba | 2011-03-28 19:03:50 +0000 | [diff] [blame] | 55 | SkWStream* content); |
| 56 | static void StrokePath(SkWStream* content); |
| vandebo@chromium.org | 6112c21 | 2011-05-13 03:50:38 +0000 | [diff] [blame^] | 57 | static void DrawFormXObject(int objectIndex, SkWStream* content); |
| 58 | static void ApplyGraphicState(int objectIndex, SkWStream* content); |
| ctguil@chromium.org | f966fd3 | 2011-03-04 21:47:04 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | #endif |