| 1 |
/* |
| 2 |
* Copyright 2013 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 SkPDFResourceDict_DEFINED |
| 9 |
#define SkPDFResourceDict_DEFINED |
| 10 |
|
| 11 |
#include <memory> |
| 12 |
#include <vector> |
| 13 |
|
| 14 |
class SkPDFDict; |
| 15 |
class SkWStream; |
| 16 |
struct SkPDFIndirectReference; |
| 17 |
|
| 18 |
enum class SkPDFResourceType { |
| 19 |
kExtGState = 0, |
| 20 |
kPattern = 1, |
| 21 |
kXObject = 2, |
| 22 |
kFont = 3, |
| 23 |
// These additional types are defined by the spec, but not |
| 24 |
// currently used by Skia: ColorSpace, Shading, Properties |
| 25 |
}; |
| 26 |
|
| 27 |
|
| 28 |
/** Create a PDF resource dictionary. |
| 29 |
* The full set of ProcSet entries is automatically created for backwards |
| 30 |
* compatibility, as recommended by the PDF spec. |
| 31 |
* |
| 32 |
* Any arguments can be nullptr. |
| 33 |
*/ |
| 34 |
std::unique_ptr<SkPDFDict> SkPDFMakeResourceDict( |
| 35 |
const std::vector<SkPDFIndirectReference>& graphicStateResources, |
| 36 |
const std::vector<SkPDFIndirectReference>& shaderResources, |
| 37 |
const std::vector<SkPDFIndirectReference>& xObjectResources, |
| 38 |
const std::vector<SkPDFIndirectReference>& fontResources); |
| 39 |
|
| 40 |
/** |
| 41 |
* Writes the name for the resource that will be generated by the resource |
| 42 |
* dict. |
| 43 |
* |
| 44 |
* @param type The type of resource being entered |
| 45 |
* @param key The resource key, should be unique within its type. |
| 46 |
*/ |
| 47 |
void SkPDFWriteResourceName(SkWStream*, SkPDFResourceType type, int key); |
| 48 |
|
| 49 |
#endif |