OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkPDFDevice_DEFINED | 10 #ifndef SkPDFDevice_DEFINED |
11 #define SkPDFDevice_DEFINED | 11 #define SkPDFDevice_DEFINED |
12 | 12 |
13 #include "SkBitmapDevice.h" | 13 #include "SkBitmapDevice.h" |
| 14 #include "SkBitmap.h" |
14 #include "SkCanvas.h" | 15 #include "SkCanvas.h" |
15 #include "SkPaint.h" | 16 #include "SkPaint.h" |
16 #include "SkPath.h" | 17 #include "SkPath.h" |
17 #include "SkPicture.h" | 18 #include "SkPicture.h" |
18 #include "SkRect.h" | 19 #include "SkRect.h" |
19 #include "SkRefCnt.h" | 20 #include "SkRefCnt.h" |
20 #include "SkStream.h" | 21 #include "SkStream.h" |
21 #include "SkTDArray.h" | 22 #include "SkTDArray.h" |
22 #include "SkTemplates.h" | 23 #include "SkTemplates.h" |
23 | 24 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 * This may be useful to, for example, move the origin in and | 57 * This may be useful to, for example, move the origin in and |
57 * over a bit to account for a margin, scale the canvas, | 58 * over a bit to account for a margin, scale the canvas, |
58 * or apply a rotation. Note1: the SkPDFDevice also applies | 59 * or apply a rotation. Note1: the SkPDFDevice also applies |
59 * a scale+translate transform to move the origin from the | 60 * a scale+translate transform to move the origin from the |
60 * bottom left (PDF default) to the top left. Note2: drawDevice | 61 * bottom left (PDF default) to the top left. Note2: drawDevice |
61 * (used by layer restore) draws the device after this initial | 62 * (used by layer restore) draws the device after this initial |
62 * transform is applied, so the PDF device does an | 63 * transform is applied, so the PDF device does an |
63 * inverse scale+translate to accommodate the one that SkPDFDevice | 64 * inverse scale+translate to accommodate the one that SkPDFDevice |
64 * always does. | 65 * always does. |
65 */ | 66 */ |
66 // TODO(vandebo): The sizes should be SkSize and not SkISize. | 67 // Deprecated, please use SkDocument::CreatePdf() instead. |
67 SK_API SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize, | 68 SK_API SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize, |
68 const SkMatrix& initialTransform); | 69 const SkMatrix& initialTransform); |
69 SK_API virtual ~SkPDFDevice(); | 70 SK_API virtual ~SkPDFDevice(); |
70 | 71 |
71 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE; | 72 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE; |
72 | 73 |
73 virtual void clear(SkColor color) SK_OVERRIDE; | 74 virtual void clear(SkColor color) SK_OVERRIDE; |
74 | 75 |
75 /** These are called inside the per-device-layer loop for each draw call. | 76 /** These are called inside the per-device-layer loop for each draw call. |
76 When these are called, we have already applied any saveLayer operations, | 77 When these are called, we have already applied any saveLayer operations, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 const SkMatrix& matrix, const SkPaint& paint); | 305 const SkMatrix& matrix, const SkPaint& paint); |
305 SkPDFDict* createLinkAnnotation(const SkRect& r, const SkMatrix& matrix); | 306 SkPDFDict* createLinkAnnotation(const SkRect& r, const SkMatrix& matrix); |
306 void handleLinkToURL(SkData* urlData, const SkRect& r, | 307 void handleLinkToURL(SkData* urlData, const SkRect& r, |
307 const SkMatrix& matrix); | 308 const SkMatrix& matrix); |
308 void handleLinkToNamedDest(SkData* nameData, const SkRect& r, | 309 void handleLinkToNamedDest(SkData* nameData, const SkRect& r, |
309 const SkMatrix& matrix); | 310 const SkMatrix& matrix); |
310 void defineNamedDestination(SkData* nameData, const SkPoint& point, | 311 void defineNamedDestination(SkData* nameData, const SkPoint& point, |
311 const SkMatrix& matrix); | 312 const SkMatrix& matrix); |
312 | 313 |
313 typedef SkBitmapDevice INHERITED; | 314 typedef SkBitmapDevice INHERITED; |
| 315 |
| 316 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create |
| 317 // an SkPDFDevice |
| 318 //friend class SkDocument_PDF; |
| 319 //friend class SkPDFImageShader; |
314 }; | 320 }; |
315 | 321 |
316 #endif | 322 #endif |
OLD | NEW |