/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file.
*/ #ifndef SkPDFDocumentPriv_DEFINED #define SkPDFDocumentPriv_DEFINED
// Logically part of SkPDFDocument, but separate to keep similar functionality together. class SkPDFOffsetMap { public: void markStartOfDocument(const SkWStream*); void markStartOfObject(int referenceNumber, const SkWStream*); int objectCount() const; int emitCrossReferenceTable(SkWStream* s) const; private:
std::vector<int> fOffsets;
size_t fBaseOffset = SIZE_MAX;
};
struct SkPDFLink { enumclass Type {
kNone,
kUrl,
kNamedDestination,
};
SkPDFLink(Type type, SkData* data, const SkRect& rect, int elemId)
: fType(type)
, fData(sk_ref_sp(data))
, fRect(rect)
, fElemId(elemId) {} const Type fType; // The url or named destination, depending on |fType|. const sk_sp<SkData> fData; const SkRect fRect; constint fElemId;
};
/** Concrete implementation of SkDocument that creates PDF files. This class does not produced linearized or optimized PDFs; instead it
it attempts to use a minimum amount of RAM. */ class SkPDFDocument : public SkDocument { public:
SkPDFDocument(SkWStream*, SkPDF::Metadata);
~SkPDFDocument() override;
SkCanvas* onBeginPage(SkScalar, SkScalar) override; void onEndPage() override; void onClose(SkWStream*) override; void onAbort() override;
/** Serialize the object, as well as any other objects it indirectly refers to. If any any other objects have been added to the SkPDFObjNumMap without serializing them, they will be serialized as well.
It might go without saying that objects should not be changed after calling serialize, since those changes will be too late.
*/
SkPDFIndirectReference emit(const SkPDFObject&, SkPDFIndirectReference);
SkPDFIndirectReference emit(const SkPDFObject& o) { return this->emit(o, this->reserveRef()); }
// Create a new marked-content identifier (MCID) to be used with a marked-content sequence // parented by the structure element (StructElem) with the given element identifier (elemId). // Returns a false Mark if if elemId does not refer to a StructElem.
SkPDFStructTree::Mark createMarkForElemId(int elemId);
// Create a key to use with /StructParent in a content item (usually an annotation) which refers // to the structure element (StructElem) with the given element identifier (elemId). // Returns -1 if elemId does not refer to a StructElem. int createStructParentKeyForElemId(int elemId, SkPDFIndirectReference contentItemRef);
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.