halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
Mike Reed | 47fdf6c | 2017-12-20 14:12:07 -0500 | [diff] [blame] | 7 | |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 8 | #ifndef SkMultiPictureDocument_DEFINED |
| 9 | #define SkMultiPictureDocument_DEFINED |
| 10 | |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 11 | #include "SkDocument.h" |
| 12 | |
Mike Reed | 47fdf6c | 2017-12-20 14:12:07 -0500 | [diff] [blame] | 13 | struct SkDeserialProcs; |
| 14 | struct SkSerialProcs; |
Hal Canary | 45cde31 | 2017-04-03 16:06:42 -0400 | [diff] [blame] | 15 | class SkStreamSeekable; |
| 16 | |
| 17 | /** |
| 18 | * Writes into a file format that is similar to SkPicture::serialize() |
| 19 | */ |
Mike Reed | 47fdf6c | 2017-12-20 14:12:07 -0500 | [diff] [blame] | 20 | SK_API sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst, const SkSerialProcs* = nullptr); |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 21 | |
Hal Canary | 45cde31 | 2017-04-03 16:06:42 -0400 | [diff] [blame] | 22 | struct SkDocumentPage { |
| 23 | sk_sp<SkPicture> fPicture; |
| 24 | SkSize fSize; |
| 25 | }; |
| 26 | |
| 27 | /** |
| 28 | * Returns the number of pages in the SkMultiPictureDocument. |
| 29 | */ |
| 30 | SK_API int SkMultiPictureDocumentReadPageCount(SkStreamSeekable* src); |
| 31 | |
| 32 | /** |
| 33 | * Read the SkMultiPictureDocument into the provided array of pages. |
| 34 | * dstArrayCount must equal SkMultiPictureDocumentReadPageCount(). |
| 35 | * Return false on error. |
| 36 | */ |
| 37 | SK_API bool SkMultiPictureDocumentRead(SkStreamSeekable* src, |
| 38 | SkDocumentPage* dstArray, |
Mike Reed | 47fdf6c | 2017-12-20 14:12:07 -0500 | [diff] [blame] | 39 | int dstArrayCount, |
| 40 | const SkDeserialProcs* = nullptr); |
Hal Canary | 45cde31 | 2017-04-03 16:06:42 -0400 | [diff] [blame] | 41 | |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 42 | #endif // SkMultiPictureDocument_DEFINED |