THPDFRenderDocAccess 记录

把渲染器绑定到文档服务,用于解析引用、读取流、解码图像、定位字体和评估图层可见性

声明

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调用方提供的上下文指针,作为每个回调的第一个参数传入;文档在此绑定自身
SharedCache当启用 ShareRenderCaches 时,可供多个页面共享的渲染器缓存
ShareRenderCaches文档允许并发渲染器共享解码缓存时为 True
ResolveObject适用于任意对象类型的通用间接引用解析器;因类型化解析器对不匹配的类型返回 nil 而补充
ResolveDictionary把间接引用解析为字典对象,其他类型返回 nil
ResolveStream把间接引用解析为流对象
ReadDecodedStreamBytes把流完全解码后读入字节数组
AcquireDecodedImageStream把图像 XObject 解码为共享的引用计数位图句柄
DecodeImageStream把图像 XObject 解码为调用方持有的位图
BeginProgressiveImageDecode为大型图像流启动可取消的渐进解码器
DecodeImageRegion按请求的像素尺寸解码图像的子区域
AcquireDecodedImageRegion区域变体,返回共享的引用计数位图句柄
DecodeInlineImage从原始 ID..EI 字节和规范化 BI 键集解码内联图像,绕过按对象号索引的缓存;钩子为 nil 表示不渲染内联图像
DecodeColorKeyMask把图像 XObject 的 color-key /Mask 数组变成图像尺寸的黑白软掩码;图像没有可用的 color-key 掩码时为 nil,钩子为 nil 时这类图像不带掩码绘制
ResolveFontDict按资源键查找字体字典,跟随 /Resources 和 /Font 两级的间接引用;不存在时为 nil
EvalOCVisibility对照文档图层状态评估 /OC 属性对象;钩子为 nil 或结果为 True 都表示绘制该内容
CancellationToken长时间解码操作期间检查的取消令牌
ColourIntent应用到渲染图形状态的颜色处理意图
FallbackPolicy选择忽略、报告不支持的功能,还是把它们当作严格失败
FallbackDiagnosticLimit限制回退期间收集的诊断消息数量
OverprintPreview启用叠印预览模拟
ProofICCProfile用于色彩管线校样侧的 ICC profile 字节
OutputICCProfile描述输出设备的 ICC profile 字节
BlackPointCompensation在 ICC 变换中启用黑点补偿
SeparationPlate要隔离的分色印版名称;为空时正常渲染

使用说明

相关 API