CreatePdfZXingBarcodeProvider は、ZXing-C++ 2.3.0 からビルドした対象環境に合うネイティブブリッジの絶対パスを受け取り、IPdfBarcodeProvider を提供します
TryCreatePdfZXingBarcodeProvider はプロセスの検索パスを変更せず、ライブラリやエクスポートの不足、ブリッジ ABI の不一致を報告します
生成は Code128、QR、DataMatrix、PDF417 に対応し、指定したモジュールサイズの黒いベクトル矩形を返します。Code128 は対応する文字セットを受け付け、マトリックス型コードは Unicode テキストに対応します
QuietZoneModules は黒い矩形を左と上からずらします。配置やラスタライズの際は、呼び出し側で右と下にも白いクワイエットゾーンを確保してください
認識には、上から下の順に並ぶ 1 バイトのグレースケールデータと、幅、高さ、stride を渡します。境界は半開区間のピクセル矩形で、confidence 1 はデコードの成立を示し、統計的な確率ではありません
既定の上限は 4,194,304 ピクセル、32,768 バイトの UTF-8 テキスト、1,000,000 個のベクトル矩形です。クワイエットゾーンは 4、誤り訂正レベルは 2 です
QR の誤り訂正レベルは 0–2 が L、3–4 が M、5–6 が Q、7–8 が H です。PDF417 は 0–8 を使用し、Code128 と DataMatrix はこの設定を無視します
認識結果は要求した上限が大きくても最大 255 シンボルです。既存のプロバイダーインターフェイスにはキャンセルトークンがありません
ビルド手順と実行可能なエンコード/デコードのサンプルは Native/BarcodeZXing と Tests/BarcodeProvider にあります。この変更にはネイティブブリッジのバイナリや依存ライブラリのソースを同梱していません
Delphi/FPC の Win32/Win64 実行では、回転、反転、Unicode を含む 60 回のエンコード/デコード往復を検証済みです。Linux のネイティブブリッジでも 15 回の往復を検証していますが、Pascal プロバイダーにはラッパーの Windows 依存が引き続き適用されます
Provider := CreatePdfZXingBarcodeProvider( BridgePath, TPdfZXingBarcodeOptions.Default); Rects := GeneratePdfBarcode(pbkQr, 'Invoice 12345', 2, Provider); Results := RecognisePdfBarcodes(Pixels, Width, Height, Stride, Provider, 256);
type
EPdfBarcodeBackendError = class(EPdfProduction);
TPdfZXingBarcodeOptions = record
MaxPixels: Int64;
MaxTextBytes: Integer;
MaxRectangles: Integer;
QuietZoneModules: Integer;
ErrorCorrectionLevel: Integer;
class function Default: TPdfZXingBarcodeOptions; static;
end;
// Recognition accepts top-down, one-byte grayscale pixels with explicit stride
// Bounds are half-open pixel rectangles; Confidence=1 denotes a valid decode
// The backend does not supply a statistical confidence estimate
// A recognition call returns at most 255 symbols, even with a higher requested limit
function CreatePdfZXingBarcodeProvider(const BridgeLibraryPath: string;
const Options: TPdfZXingBarcodeOptions): IPdfBarcodeProvider;
function TryCreatePdfZXingBarcodeProvider(const BridgeLibraryPath: string;
const Options: TPdfZXingBarcodeOptions; out Provider: IPdfBarcodeProvider;
out ErrorMessage: string): Boolean;