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  */
7 
8 #ifndef SkMultiPictureDocument_DEFINED
9 #define SkMultiPictureDocument_DEFINED
10 
11 #include "SkDocument.h"
12 
13 struct SkDeserialProcs;
14 struct SkSerialProcs;
15 class SkStreamSeekable;
16 
17 /**
18  *  Writes into a file format that is similar to SkPicture::serialize()
19  */
20 SK_API sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst, const SkSerialProcs* = nullptr);
21 
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,
39                                        int dstArrayCount,
40                                        const SkDeserialProcs* = nullptr);
41 
42 #endif  // SkMultiPictureDocument_DEFINED
43