// Verify that the values of enum ResourceType correspond to the expected values // as defined in the arrays below. // If these are failing, you may need to update the kResourceTypePrefixes // and kResourceTypeNames arrays below.
static_assert(0 == (int)SkPDFResourceType::kExtGState, "resource_type_mismatch");
static_assert(1 == (int)SkPDFResourceType::kPattern, "resource_type_mismatch");
static_assert(2 == (int)SkPDFResourceType::kXObject, "resource_type_mismatch");
static_assert(3 == (int)SkPDFResourceType::kFont, "resource_type_mismatch");
// One extra character for the Prefix.
constexpr size_t kMaxResourceNameLength = 1 + kSkStrAppendS32_MaxSize;
// returns pointer just past end of what's written into `dst`. staticchar* get_resource_name(char dst[kMaxResourceNameLength], SkPDFResourceType type, int key) { staticconstchar kResourceTypePrefixes[] = { 'G', // kExtGState 'P', // kPattern 'X', // kXObject 'F'// kFont
};
SkASSERT((unsigned)type < std::size(kResourceTypePrefixes));
dst[0] = kResourceTypePrefixes[(unsigned)type]; return SkStrAppendS32(dst + 1, key);
}
void SkPDFWriteResourceName(SkWStream* dst, SkPDFResourceType type, int key) { // One extra character for the leading '/'. char buffer[1 + kMaxResourceNameLength];
buffer[0] = '/'; char* end = get_resource_name(buffer + 1, type, key);
dst->write(buffer, (size_t)(end - buffer));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.