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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame^] | 11 | #include "include/core/SkDocument.h" |
| 12 | #include "include/core/SkPicture.h" |
| 13 | #include "include/core/SkSize.h" |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 14 | |
Mike Reed | 47fdf6c | 2017-12-20 14:12:07 -0500 | [diff] [blame] | 15 | struct SkDeserialProcs; |
| 16 | struct SkSerialProcs; |
Hal Canary | 45cde31 | 2017-04-03 16:06:42 -0400 | [diff] [blame] | 17 | class SkStreamSeekable; |
| 18 | |
| 19 | /** |
| 20 | * Writes into a file format that is similar to SkPicture::serialize() |
| 21 | */ |
Mike Reed | 47fdf6c | 2017-12-20 14:12:07 -0500 | [diff] [blame] | 22 | SK_API sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst, const SkSerialProcs* = nullptr); |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 23 | |
Hal Canary | 45cde31 | 2017-04-03 16:06:42 -0400 | [diff] [blame] | 24 | struct SkDocumentPage { |
| 25 | sk_sp<SkPicture> fPicture; |
| 26 | SkSize fSize; |
| 27 | }; |
| 28 | |
| 29 | /** |
| 30 | * Returns the number of pages in the SkMultiPictureDocument. |
| 31 | */ |
| 32 | SK_API int SkMultiPictureDocumentReadPageCount(SkStreamSeekable* src); |
| 33 | |
| 34 | /** |
| 35 | * Read the SkMultiPictureDocument into the provided array of pages. |
| 36 | * dstArrayCount must equal SkMultiPictureDocumentReadPageCount(). |
| 37 | * Return false on error. |
| 38 | */ |
| 39 | SK_API bool SkMultiPictureDocumentRead(SkStreamSeekable* src, |
| 40 | SkDocumentPage* dstArray, |
Mike Reed | 47fdf6c | 2017-12-20 14:12:07 -0500 | [diff] [blame] | 41 | int dstArrayCount, |
| 42 | const SkDeserialProcs* = nullptr); |
Hal Canary | 45cde31 | 2017-04-03 16:06:42 -0400 | [diff] [blame] | 43 | |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 44 | #endif // SkMultiPictureDocument_DEFINED |