Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Enumerations | Functions
SkPDFResourceDict.h File Reference
#include "src/pdf/SkPDFFont.h"
#include <vector>

Go to the source code of this file.

Enumerations

enum class  SkPDFResourceType { kExtGState = 0 , kPattern = 1 , kXObject = 2 , kFont = 3 }
 

Functions

std::unique_ptr< SkPDFDictSkPDFMakeResourceDict (const std::vector< SkPDFIndirectReference > &graphicStateResources, const std::vector< SkPDFIndirectReference > &shaderResources, const std::vector< SkPDFIndirectReference > &xObjectResources, const std::vector< SkPDFIndirectReference > &fontResources)
 
void SkPDFWriteResourceName (SkWStream *, SkPDFResourceType type, int key)
 

Enumeration Type Documentation

◆ SkPDFResourceType

enum class SkPDFResourceType
strong
Enumerator
kExtGState 
kPattern 
kXObject 
kFont 

Definition at line 19 of file SkPDFResourceDict.h.

19 {
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};

Function Documentation

◆ SkPDFMakeResourceDict()

std::unique_ptr< SkPDFDict > SkPDFMakeResourceDict ( const std::vector< SkPDFIndirectReference > &  graphicStateResources,
const std::vector< SkPDFIndirectReference > &  shaderResources,
const std::vector< SkPDFIndirectReference > &  xObjectResources,
const std::vector< SkPDFIndirectReference > &  fontResources 
)

Create a PDF resource dictionary. The full set of ProcSet entries is automatically created for backwards compatibility, as recommended by the PDF spec.

Any arguments can be nullptr.

Definition at line 84 of file SkPDFResourceDict.cpp.

88 {
89 auto dict = SkPDFMakeDict();
90 dict->insertObject("ProcSet", make_proc_set());
91 add_subdict(graphicStateResources, SkPDFResourceType::kExtGState, dict.get());
92 add_subdict(shaderResources, SkPDFResourceType::kPattern, dict.get());
93 add_subdict(xObjectResources, SkPDFResourceType::kXObject, dict.get());
94 add_subdict(fontResources, SkPDFResourceType::kFont, dict.get());
95 return dict;
96}
static void add_subdict(const std::vector< SkPDFIndirectReference > &resourceList, SkPDFResourceType type, SkPDFDict *dst)
static std::unique_ptr< SkPDFArray > make_proc_set()
static std::unique_ptr< SkPDFDict > SkPDFMakeDict(const char *type=nullptr)
Definition SkPDFTypes.h:195

◆ SkPDFWriteResourceName()

void SkPDFWriteResourceName ( SkWStream dst,
SkPDFResourceType  type,
int  key 
)

Writes the name for the resource that will be generated by the resource dict.

Parameters
typeThe type of resource being entered
keyThe resource key, should be unique within its type.

Definition at line 37 of file SkPDFResourceDict.cpp.

37 {
38 // One extra character for the leading '/'.
40 buffer[0] = '/';
41 char* end = get_resource_name(buffer + 1, type, key);
42 dst->write(buffer, (size_t)(end - buffer));
43}
constexpr size_t kMaxResourceNameLength
static char * get_resource_name(char dst[kMaxResourceNameLength], SkPDFResourceType type, int key)
glong glong end
static const uint8_t buffer[]
dst
Definition cp.py:12