OLD | NEW |
---|---|
(Empty) | |
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 "SkPDFTypes.h" | |
12 #include "SkTDArray.h" | |
13 #include "SkTSet.h" | |
14 #include "SkTypes.h" | |
15 | |
16 /** \class SkPDFResourceDict | |
17 | |
18 A resource dictionary, which maintains the relevant sub-dicts and | |
19 allows generation of a list of referenced SkPDFObjects inserted with | |
20 insertResourceAsRef. | |
21 */ | |
22 class SkPDFResourceDict : public SkPDFDict { | |
23 public: | |
24 SK_DECLARE_INST_COUNT(SkPDFResourceDict) | |
25 | |
26 enum SkPDFResourceType{ | |
27 kExtGState_ResourceType, | |
28 kPattern_ResourceType, | |
29 kXObject_ResourceType, | |
30 kFont_ResourceType | |
31 // These additional types are defined by the spec, but not | |
vandebo (ex-Chrome)
2013/07/11 17:50:23
You may want to add KResouceTypeCount to help with
ducky
2013/07/11 23:09:50
Done.
| |
32 // currently used by Skia: | |
33 // ColorSpace, Shading, Properties | |
vandebo (ex-Chrome)
2013/07/11 17:50:23
nit, will fit on the previous line.
ducky
2013/07/11 23:09:50
Done.
| |
34 }; | |
35 | |
36 /** Create a PDF resource dictionary. | |
37 * The full set of ProcSet entries is automatically created for backwards | |
38 * compatibility, as recommended by the PDF spec. | |
39 */ | |
40 SkPDFResourceDict(); | |
41 | |
42 /** Add the value to the dictionary with the given key. Refs value. | |
43 * The relevant sub-dicts will be automatically generated, and the | |
44 * resource will be named by concatenating a type-specific prefix and | |
45 * the input key. | |
46 * The object will NOT be part of the resource list when requested later. | |
47 * @param type The type of resource being entered. | |
48 * @param key The resource key, should be unique within its type. | |
49 * @param value The resource itself. | |
50 * @return The value argument is returned. | |
51 */ | |
52 SkPDFObject* insertResource(SkPDFResourceType type, int key, | |
53 SkPDFObject* value); | |
54 | |
55 /** Add the value SkPDFObject as a reference to the resource dictionary | |
56 * with the give type and key. | |
57 * The relevant sub-dicts will be automatically generated, and the | |
58 * resource will be named by concatenating a type-specific prefix and | |
59 * the input key. | |
60 * This object will be part of the resource list when requested later. | |
61 * @param type The type of resource being entered, like Pattern or ExtGSta te. | |
vandebo (ex-Chrome)
2013/07/11 17:50:23
Skia allows 100 column lines, but it looks like yo
vandebo (ex-Chrome)
2013/07/11 17:50:23
comment out of date, i.e. Pattern -> kPattern_Reso
ducky
2013/07/11 23:09:50
Adhering to 80 lines.
ducky
2013/07/11 23:09:50
Done.
| |
62 * @param key The resource key, should be unique within its type. | |
63 * @param value The resource itself. | |
64 * @return The value argument is returned. | |
65 */ | |
66 SkPDFObject* insertResourceAsRef(SkPDFResourceType type, int key, | |
67 SkPDFObject* value); | |
68 | |
69 /** | |
70 * Gets resources inserted into this dictionary. | |
71 * | |
72 * @param knownResourceObjects Set containing currently known resources. | |
73 * Resources in the dict and in this set will not be added to the output . | |
74 * @param newResourceObjects Output set to which non-preexisting resources | |
75 * will be added. | |
76 * @param recursive Whether or not to add resources of resources. | |
77 */ | |
78 void getResources( | |
79 const SkTSet<SkPDFObject*>& knownResourceObjects, | |
80 SkTSet<SkPDFObject*>* newResourceObjects, | |
81 bool recursive) const; | |
82 | |
83 private: | |
84 SkTSet<SkPDFObject*> fResources; | |
85 | |
86 SkTDArray<SkPDFDict*> fTypes; | |
87 }; | |
88 | |
89 #endif | |
OLD | NEW |