รีเคิร์ด THPDFRenderDocAccess
ผูกตัวเรนเดอร์เข้ากับบริการของเอกสาร สำหรับ resolve reference, อ่าน stream, decode รูปภาพ, หาฟอนต์ และประเมินความมองเห็นของ layer
การประกาศ
THPDFRenderDocAccess= record
Context: Pointer;
SharedCache: THPDFRendererSharedCache;
ShareRenderCaches: boolean;
// v2.375.0 generic indirect-ref resolver (any object type). The typed
// Resolve* fields below predate it and return nil for non-matching
// types, which silently dropped indirect refs to arrays (e.g. a
// /ColorSpace entry pointing at a [/Separation ...] array object)
ResolveObject: function(Context: Pointer; Obj: THPDFObject): THPDFObject;
ResolveDictionary: function(Context: Pointer; Obj: THPDFObject): THPDFDictionaryObject;
ResolveStream: function(Context: Pointer; Obj: THPDFObject): THPDFStreamObject;
ReadDecodedStreamBytes: function(Context: Pointer; Stream: THPDFStreamObject; out Bytes: TBytes): boolean;
AcquireDecodedImageStream: function(Context: Pointer;
Stream: THPDFStreamObject): IHPDFDecodedBitmapHandle;
DecodeImageStream: function(Context: Pointer; Stream: THPDFStreamObject): TBitmap;
BeginProgressiveImageDecode: function(Context: Pointer;
Stream: THPDFStreamObject;
CancellationToken: THPDFCancellationToken): IHPDFProgressiveImageDecoder;
DecodeImageRegion: function(Context: Pointer; Stream: THPDFStreamObject;
RegionLeft, RegionTop, RegionRight, RegionBottom,
DesiredWidth, DesiredHeight: Integer): TBitmap;
AcquireDecodedImageRegion: function(Context: Pointer;
Stream: THPDFStreamObject; RegionLeft, RegionTop, RegionRight,
RegionBottom, DesiredWidth,
DesiredHeight: Integer): IHPDFDecodedBitmapHandle;
// v2.425.0 inline-image decoder: builds a throwaway stream from the raw
// ID..EI bytes and the normalised BI key set, then decodes it without the
// ObjectNumber-keyed cache (inline images have no object number). Returns
// a TBitmap the caller owns, or nil on failure. Nil hook = inline images
// are not rendered (legacy behaviour)
DecodeInlineImage: function(Context: Pointer; const Bytes: TBytes;
const Keys: THPDFInlineImgKeys): TBitmap;
// Colour-key /Mask array of an image XObject as a soft mask, white where
// the image shows and black where it is masked out. Returns a TBitmap the
// caller owns, or nil when the image has no usable colour-key mask; a nil
// hook draws such images unmasked
DecodeColorKeyMask: function(Context: Pointer;
Stream: THPDFStreamObject): TBitmap;
// Look up a font dictionary by resource key in a Resources dict, following
// indirect refs at both /Resources and /Font levels. Returns nil if absent
ResolveFontDict: function(Context: Pointer; PageObj: THPDFDictionaryObject;
const FontKey: AnsiString): THPDFDictionaryObject;
// v2.377.0 optional-content visibility oracle: evaluates an /OC property
// object (OCG or OCMD) against the document's layer states. Nil hook or
// a True result means the content is drawn
EvalOCVisibility: function(Context: Pointer; PropObj: THPDFObject): boolean;
CancellationToken: THPDFCancellationToken;
ColourIntent: Integer;
FallbackPolicy: THPDFRenderFallbackPolicy;
FallbackDiagnosticLimit: Integer;
OverprintPreview: boolean;
ProofICCProfile: TBytes;
OutputICCProfile: TBytes;
BlackPointCompensation: boolean;
SeparationPlate: AnsiString;
end;
ยูนิต
HPDFPageRenderer
ฟิลด์
| ฟิลด์ | วัตถุประสงค์ |
|---|---|
Context | context pointer ที่ผู้เรียกส่งมา ถูกส่งเป็นอาร์กิวเมนต์ตัวแรกของ callback ทุกตัว เอกสารจะผูกตัวเองไว้ตรงนี้ |
SharedCache | แคชของตัวเรนเดอร์ที่หลายหน้าแชร์กันได้เมื่อเปิด ShareRenderCaches |
ShareRenderCaches | true เมื่อเอกสารยอมให้ตัวเรนเดอร์หลายตัวที่ทำงานพร้อมกันแชร์ decode cache |
ResolveObject | ตัว resolve indirect reference แบบทั่วไปสำหรับ object ทุกชนิด เพิ่มเข้ามาเพราะ resolver แบบระบุชนิดจะคืน nil เมื่อชนิดไม่ตรง |
ResolveDictionary | resolve indirect reference ไปยัง dictionary object ชนิดอื่นจะได้ nil |
ResolveStream | resolve indirect reference ไปยัง stream object |
ReadDecodedStreamBytes | อ่าน stream แบบถอดการเข้ารหัสครบแล้วเป็น byte array |
AcquireDecodedImageStream | decode image XObject เป็น bitmap handle แบบแชร์ร่วมนับ reference |
DecodeImageStream | decode image XObject เป็น bitmap ที่ผู้เรียกเป็นเจ้าของ |
BeginProgressiveImageDecode | เริ่ม progressive decoder ที่ยกเลิกได้ สำหรับ stream รูปภาพขนาดใหญ่ |
DecodeImageRegion | decode บางส่วนของรูปภาพที่ขนาดพิกเซลตามที่ขอ |
AcquireDecodedImageRegion | เวอร์ชันย่อยส่วนของรูปที่คืน bitmap handle แบบแชร์ร่วมนับ reference |
DecodeInlineImage | decode inline image จากไบต์ ID..EI ดิบ ๆ กับชุด key BI ที่ normalize แล้ว โดยไม่ผ่านแคชตามหมายเลข object ถ้า hook เป็น nil แปลว่า inline image จะไม่ถูกวาด |
DecodeColorKeyMask | เปลี่ยน array color-key /Mask ของ image XObject ให้เป็น soft mask ขาวดำขนาดเท่ากับภาพ ได้ nil เมื่อภาพไม่มี color-key mask ที่ใช้ได้ และ hook ที่เป็น nil จะวาดภาพแบบนี้โดยไม่ใส่ mask |
ResolveFontDict | หา font dictionary จาก resource key โดยไล่ indirect reference ทั้งระดับ /Resources และ /Font ไม่เจอจะได้ nil |
EvalOCVisibility | ประเมิน object property /OC เทียบกับสถานะ layer ของเอกสาร ถ้า hook เป็น nil หรือผลเป็น True แปลว่าเนื้อหาถูกวาด |
CancellationToken | cancellation token ที่ถูกเช็กระหว่างการ decode ที่ยาวนาน |
ColourIntent | intent การจัดการสีที่ใช้กับ graphics state ของผลเรนเดอร์ |
FallbackPolicy | เลือกว่าฟีเจอร์ที่ไม่รองรับจะถูกมองข้าม, รายงาน หรือถือเป็นความล้มเหลวแบบเข้ม |
FallbackDiagnosticLimit | จำกัดจำนวนข้อความวินิจฉัยที่เก็บไว้ระหว่าง fallback |
OverprintPreview | เปิดการจำลอง overprint preview |
ProofICCProfile | ไบต์ ICC profile ที่ใช้ฝั่ง proofing ของ pipeline สี |
OutputICCProfile | ไบต์ ICC profile ที่บรรยายอุปกรณ์ output |
BlackPointCompensation | เปิด black point compensation ในการแปลง ICC |
SeparationPlate | ชื่อ separation plate ที่จะแยกดู ปล่อยว่างจะเรนเดอร์ตามปกติ |
หมายเหตุการใช้งาน
- THotPDF ผูก hook ทุกตัวผ่าน helper
MakeRenderDocAccessภายใน แอปพลิเคชันจึงได้ record พร้อมใช้ ไม่ต้องมานั่งเติมเอง - render backend แบบกำหนดเองอ่าน hook เหล่านี้จาก
THPDFPageRenderBackendRequestแทนที่จะเข้าไปยุ่งกับเอกสารโดยตรง - ปล่อยให้
DecodeInlineImageหรือEvalOCVisibilityเป็น nil เพื่อกลับไปใช้พฤติกรรมเดิมคือข้าม inline image และวาด optional content ทุกชิ้น