THPDFJpegReducedDecoder
把編碼過的 JPEG 區域直接解碼成精確的低解析度 BGR24 點陣圖
宣告
function LoadFromBytes(const Data: THPDFJpegByteArray;
const Region: TRect; TargetWidth, TargetHeight: Integer;
MaxOutputBytes: Int64 = 268435456): Boolean;
function Decode: THPDFJpegReducedDecodeStatus;
用法
Decoder := THPDFJpegReducedDecoder.Create;
try
if Decoder.LoadFromBytes(Data, Rect(0, 0, 12000, 12000), 300, 300) and
(Decoder.Decode = jrdsCompleted) then
begin
Bitmap.Assign(Decoder.Bitmap);
Info := Decoder.Info;
end;
finally
Decoder.Free;
end;
擁有權與限制
- 解碼器會複製編碼輸入,並擁有
Bitmap公開的點陣圖 - 傳回的點陣圖在解碼器重新載入或銷毀之前持續有效
MaxOutputBytes限制目標點陣圖大小,設 0 表示不套用這個明確上限OnCancellationCheck會在掃描線迴圈中被呼叫Info公開解碼器回報的縮放幾何與工作記憶體估計
相關 API
THPDFJpegReducedDecodeInfo · THPDFJpegReducedDecodeStatus · Reduced-DCT JPEG 解碼