• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "include/core/SkDocument.h"
12 #include "include/core/SkPicture.h"
13 #include "include/core/SkSize.h"
14 
15 #include <functional>
16 
17 struct SkDeserialProcs;
18 struct SkSerialProcs;
19 class SkStreamSeekable;
20 /**
21  *  Writes into a file format that is similar to SkPicture::serialize()
22  *  Accepts a callback for endPage behavior
23  */
24 SK_SPI sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst, const SkSerialProcs* = nullptr,
25   std::function<void(const SkPicture*)> onEndPage = nullptr);
26 
27 struct SkDocumentPage {
28     sk_sp<SkPicture> fPicture;
29     SkSize fSize;
30 };
31 
32 /**
33  *  Returns the number of pages in the SkMultiPictureDocument.
34  */
35 SK_SPI int SkMultiPictureDocumentReadPageCount(SkStreamSeekable* src);
36 
37 /**
38  *  Read the SkMultiPictureDocument into the provided array of pages.
39  *  dstArrayCount must equal SkMultiPictureDocumentReadPageCount().
40  *  Return false on error.
41  */
42 SK_SPI bool SkMultiPictureDocumentRead(SkStreamSeekable* src,
43                                        SkDocumentPage* dstArray,
44                                        int dstArrayCount,
45                                        const SkDeserialProcs* = nullptr);
46 
47 #endif  // SkMultiPictureDocument_DEFINED
48