THotPDF.DecodeLoadedImageRegion Method
Decodes an exact source-coordinate rectangle from one loaded image XObject stream into a caller-owned TBitmap
Declaration
function DecodeLoadedImageRegion(AImageStream: THPDFStreamObject;
RegionLeft, RegionTop, RegionRight, RegionBottom: Integer): TBitmap;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
AImageStream | Loaded image XObject stream to decode |
RegionLeft | Inclusive left source coordinate |
RegionTop | Inclusive top source coordinate |
RegionRight | Exclusive right source coordinate |
RegionBottom | Exclusive bottom source coordinate |
Return value
Returns a newly allocated bitmap containing the clamped non-empty region, or nil when the image or requested geometry cannot be decoded
Usage notes
- The caller owns a non-nil returned bitmap and must free it
- Coordinates use the decoded image's top-left raster space and the right and bottom bounds are exclusive
- Bounds outside the image are clamped before decoding
- JPEG 2000 requests the native decoder region before pixel expansion
- This method preserves the full decoded resolution of the region
- Other supported image formats decode normally and return the exact cropped region
- The loaded-page renderer uses the resolution-aware overload automatically for clipped or downscaled axis-aligned image XObjects