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