blob: 7d50683572cd47bb188e0826381c65b803c71ecc [file] [log] [blame]
halcanary45420a92016-06-02 12:41:14 -07001/*
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 Reed47fdf6c2017-12-20 14:12:07 -05007
halcanary45420a92016-06-02 12:41:14 -07008#ifndef SkMultiPictureDocument_DEFINED
9#define SkMultiPictureDocument_DEFINED
10
halcanary45420a92016-06-02 12:41:14 -070011#include "SkDocument.h"
12
Mike Reed47fdf6c2017-12-20 14:12:07 -050013struct SkDeserialProcs;
14struct SkSerialProcs;
Hal Canary45cde312017-04-03 16:06:42 -040015class SkStreamSeekable;
16
17/**
18 * Writes into a file format that is similar to SkPicture::serialize()
19 */
Mike Reed47fdf6c2017-12-20 14:12:07 -050020SK_API sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst, const SkSerialProcs* = nullptr);
halcanary45420a92016-06-02 12:41:14 -070021
Hal Canary45cde312017-04-03 16:06:42 -040022struct SkDocumentPage {
23 sk_sp<SkPicture> fPicture;
24 SkSize fSize;
25};
26
27/**
28 * Returns the number of pages in the SkMultiPictureDocument.
29 */
30SK_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 */
37SK_API bool SkMultiPictureDocumentRead(SkStreamSeekable* src,
38 SkDocumentPage* dstArray,
Mike Reed47fdf6c2017-12-20 14:12:07 -050039 int dstArrayCount,
40 const SkDeserialProcs* = nullptr);
Hal Canary45cde312017-04-03 16:06:42 -040041
halcanary45420a92016-06-02 12:41:14 -070042#endif // SkMultiPictureDocument_DEFINED