blob: b6d7be8429845dbecf3c09eba9bde5253efc4ff9 [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkDocument.h"
12#include "include/core/SkPicture.h"
13#include "include/core/SkSize.h"
halcanary45420a92016-06-02 12:41:14 -070014
Mike Reed47fdf6c2017-12-20 14:12:07 -050015struct SkDeserialProcs;
16struct SkSerialProcs;
Hal Canary45cde312017-04-03 16:06:42 -040017class SkStreamSeekable;
18
19/**
20 * Writes into a file format that is similar to SkPicture::serialize()
21 */
Mike Reed47fdf6c2017-12-20 14:12:07 -050022SK_API sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst, const SkSerialProcs* = nullptr);
halcanary45420a92016-06-02 12:41:14 -070023
Hal Canary45cde312017-04-03 16:06:42 -040024struct SkDocumentPage {
25 sk_sp<SkPicture> fPicture;
26 SkSize fSize;
27};
28
29/**
30 * Returns the number of pages in the SkMultiPictureDocument.
31 */
32SK_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 */
39SK_API bool SkMultiPictureDocumentRead(SkStreamSeekable* src,
40 SkDocumentPage* dstArray,
Mike Reed47fdf6c2017-12-20 14:12:07 -050041 int dstArrayCount,
42 const SkDeserialProcs* = nullptr);
Hal Canary45cde312017-04-03 16:06:42 -040043
halcanary45420a92016-06-02 12:41:14 -070044#endif // SkMultiPictureDocument_DEFINED