blob: 5cce6a8e7f1cd043a96e35c2593d207a2b562e45 [file] [log] [blame]
commit-bot@chromium.org47401352013-07-23 21:49:29 +00001/*
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
Hal Canary9e41c212018-09-03 12:00:23 -040011#include "SkPDFFont.h"
martina.kollarovab8d6af12016-06-29 05:12:31 -070012
Hal Canary9e41c212018-09-03 12:00:23 -040013#include <vector>
14
martina.kollarovab8d6af12016-06-29 05:12:31 -070015class SkPDFDict;
16class SkPDFObject;
Hal Canarye650b852018-09-12 09:12:36 -040017class SkWStream;
commit-bot@chromium.org47401352013-07-23 21:49:29 +000018
Hal Canarye650b852018-09-12 09:12:36 -040019enum class SkPDFResourceType {
20 kExtGState = 0,
21 kPattern = 1,
22 kXObject = 2,
23 kFont = 3,
Hal Canary9e41c212018-09-03 12:00:23 -040024 // These additional types are defined by the spec, but not
25 // currently used by Skia: ColorSpace, Shading, Properties
commit-bot@chromium.org47401352013-07-23 21:49:29 +000026};
27
Hal Canary9e41c212018-09-03 12:00:23 -040028
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 */
Hal Canary74801582018-12-18 16:30:41 -050035std::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);
Hal Canary9e41c212018-09-03 12:00:23 -040040
41/**
Hal Canarye650b852018-09-12 09:12:36 -040042 * Writes the name for the resource that will be generated by the resource
Hal Canary9e41c212018-09-03 12:00:23 -040043 * dict.
44 *
Hal Canarye650b852018-09-12 09:12:36 -040045 * @param type The type of resource being entered
Hal Canary9e41c212018-09-03 12:00:23 -040046 * @param key The resource key, should be unique within its type.
47 */
Hal Canarye650b852018-09-12 09:12:36 -040048void SkPDFWriteResourceName(SkWStream*, SkPDFResourceType type, int key);
Hal Canary9e41c212018-09-03 12:00:23 -040049
commit-bot@chromium.org47401352013-07-23 21:49:29 +000050#endif