IHPDFPageRenderBackend 接口

IHPDFPageRenderBackend = interface
  ['{ACCC7AA4-30B5-4C7B-A4E4-3B9A7481030A}']
  function GetName: AnsiString;
  function GetCapabilities: THPDFPageRenderBackendCapabilities;
  function IsAvailable: boolean;
  function RenderPage(const Request: THPDFPageRenderBackendRequest;
    out Bitmap: TBitmap;
    out Diagnostics: THPDFRenderFallbackDiagnostics;
    out DiagnosticDroppedCount: Integer;
    out Type3Stats: THPDFType3GlyphCacheStats;
    out TransparencyStats: THPDFTransparencyGroupTileStats): boolean;
end;

可插拔页面 render backend 的契约,GDI 和 SIMD scanline 实现都遵循它;GetName 和 GetCapabilities 描述 backend 自身,IsAvailable 报告运行时前提(比如 CPU 指令集支持)是否满足

GetCapabilities 返回由 THPDFPageRenderBackendCapability 组成的 THPDFPageRenderBackendCapabilities 集合:prbcNative、prbcDeviceAcceleration、prbcThreadSafe、prbcDeterministic、prbcTransparency、prbcColourManagement 与 prbcSIMD

调用方依据该能力集合判断某个 backend 是否有资格承担所请求的渲染模式,而配置好的 THPDFRenderBackendFallbackPolicy 决定不合格或失败的 backend 是回退到软件实现、还是让这次渲染失败

RenderPage 按 backend 请求渲染一个页面;返回 False 表示调用方应回退到其他 backend,各个 out 参数带回回退诊断以及 Type 3 字形缓存和 transparency group 分块统计,方便做性能分析

IHPDFPageRenderBackendFailureInfo 接口, 高级渲染语义