2 * Copyright 2016 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkMultiPictureDocument_DEFINED
9 #define SkMultiPictureDocument_DEFINED
11 #include "include/core/SkPicture.h"
12 #include "include/core/SkRefCnt.h"
13 #include "include/core/SkSize.h"
14 #include "include/core/SkTypes.h"
19 class SkStreamSeekable;
21 struct SkDeserialProcs;
25 * Writes into a file format that is similar to SkPicture::serialize()
26 * Accepts a callback for endPage behavior
28 SK_SPI sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst, const SkSerialProcs* = nullptr,
29 std::function<void(const SkPicture*)> onEndPage = nullptr);
31 struct SkDocumentPage {
32 sk_sp<SkPicture> fPicture;
37 * Returns the number of pages in the SkMultiPictureDocument.
39 SK_SPI int SkMultiPictureDocumentReadPageCount(SkStreamSeekable* src);
42 * Read the SkMultiPictureDocument into the provided array of pages.
43 * dstArrayCount must equal SkMultiPictureDocumentReadPageCount().
44 * Return false on error.
46 SK_SPI bool SkMultiPictureDocumentRead(SkStreamSeekable* src,
47 SkDocumentPage* dstArray,
49 const SkDeserialProcs* = nullptr);
51 #endif // SkMultiPictureDocument_DEFINED