commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 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" |
commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 13 | #include "SkTypes.h" |
| 14 | |
| 15 | /** \class SkPDFResourceDict |
| 16 | |
| 17 | A resource dictionary, which maintains the relevant sub-dicts and |
| 18 | allows generation of a list of referenced SkPDFObjects inserted with |
| 19 | insertResourceAsRef. |
| 20 | */ |
halcanary | 2b86155 | 2015-04-09 13:27:40 -0700 | [diff] [blame] | 21 | class SkPDFResourceDict { |
commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 22 | public: |
halcanary | 2b86155 | 2015-04-09 13:27:40 -0700 | [diff] [blame] | 23 | enum SkPDFResourceType { |
commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 24 | kExtGState_ResourceType, |
| 25 | kPattern_ResourceType, |
| 26 | kXObject_ResourceType, |
| 27 | kFont_ResourceType, |
| 28 | // These additional types are defined by the spec, but not |
| 29 | // currently used by Skia: ColorSpace, Shading, Properties |
| 30 | kResourceTypeCount |
halcanary | 2b86155 | 2015-04-09 13:27:40 -0700 | [diff] [blame] | 31 | }; |
commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 32 | |
| 33 | /** Create a PDF resource dictionary. |
| 34 | * The full set of ProcSet entries is automatically created for backwards |
| 35 | * compatibility, as recommended by the PDF spec. |
halcanary | 2b86155 | 2015-04-09 13:27:40 -0700 | [diff] [blame] | 36 | * |
| 37 | * Any arguments can be NULL. |
commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 38 | */ |
halcanary | 2b86155 | 2015-04-09 13:27:40 -0700 | [diff] [blame] | 39 | static SkPDFDict* Create( |
| 40 | const SkTDArray<SkPDFObject*>* gStateResources, |
| 41 | const SkTDArray<SkPDFObject*>* patternResources, |
| 42 | const SkTDArray<SkPDFObject*>* xObjectResources, |
| 43 | const SkTDArray<SkPDFObject*>* fontResources); |
commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 44 | |
| 45 | /** |
commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 46 | * Returns the name for the resource that will be generated by the resource |
| 47 | * dict. |
| 48 | * |
| 49 | * @param type The type of resource being entered, like |
| 50 | * kPattern_ResourceType or kExtGState_ResourceType. |
| 51 | * @param key The resource key, should be unique within its type. |
| 52 | */ |
| 53 | static SkString getResourceName(SkPDFResourceType type, int key); |
commit-bot@chromium.org | 4740135 | 2013-07-23 21:49:29 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | #endif |