| 1 |
/* |
| 2 |
* Copyright 2017 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 SkXPSDocument_DEFINED |
| 9 |
#define SkXPSDocument_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkTypes.h" |
| 12 |
|
| 13 |
#ifdef SK_BUILD_FOR_WIN |
| 14 |
|
| 15 |
#include "include/core/SkDocument.h" |
| 16 |
|
| 17 |
struct IXpsOMObjectFactory; |
| 18 |
class SKWStream; |
| 19 |
class SkPixmap; |
| 20 |
|
| 21 |
namespace SkXPS { |
| 22 |
|
| 23 |
using EncodePngCallback = bool (*)(SkWStream* dst, const SkPixmap& src); |
| 24 |
|
| 25 |
struct Options { |
| 26 |
float dpi = SK_ScalarDefaultRasterDPI; |
| 27 |
|
| 28 |
/** Clients can provide a way to encode png. */ |
| 29 |
EncodePngCallback pngEncoder = nullptr; |
| 30 |
|
| 31 |
/** Skia's XPS support depends on having a png encoder registered to handle |
| 32 |
* XPS image brushes. Clients that create XPS documents without images may |
| 33 |
* set `allowNoPngs` to true to acknowledge this. |
| 34 |
*/ |
| 35 |
bool allowNoPngs = false; |
| 36 |
}; |
| 37 |
|
| 38 |
SK_API sk_sp<SkDocument> MakeDocument(SkWStream* stream, |
| 39 |
IXpsOMObjectFactory* xpsFactory, |
| 40 |
Options opts); |
| 41 |
} // namespace SkXPS |
| 42 |
#endif // SK_BUILD_FOR_WIN |
| 43 |
#endif // SkXPSDocument_DEFINED |