Expand description
Image XObjects and inline images → premultiplied RGBA pixmaps
(ISO 32000-1, 8.9): every bit depth, the colour spaces of super::color,
/Decode ranges, stencil masks painted in the fill colour, /SMask soft
masks, stencil and colour-key /Masks. The sample data comes through the
raster’s filter chain, its libjpeg-exact JPEG decoder and its CCITT
decoder; JPX and JBIG2 have no decoder here and come out as a mid-gray
block (the picture the layout model should see is “a picture”).
Loading (load: filters, codec, colour space, alpha plane) is separate
from rasterizing (rasterize: the RGBA pixmap for one destination
size) so a document-wide cache can decode a scan once and blit it at the
pipeline’s several scales. Like docling-parse (build_bitmap_image), an
image several times larger than its destination is box-averaged down by
an integer factor before the blit, so a 5000-pixel-wide scan drawn 600
pixels wide costs 600 columns.
Structs§
- Decoded
Image - Loaded
Image - An image decoded to samples, with everything the rasterizer needs.
Functions§
- codec_
reduction_ shift - docling-parse’s
codec_reduction_shift: how many halvings a JPEG may be decoded at (libjpeg’s 1/2, 1/4, 1/8 reduced inverse DCT) and still hold at least the pixels it is drawn onto attarget_pixels_per_unit— the renderer’sbitmap_target_pixels_per_unit, docling’srender_scaleof 1.0 — so the rasterizer keeps minifying and never magnifies samples it once had. A 300 dpi scan drawn full-page decodes at a quarter for the 72 dpi hint and is blitted up onto the scale-2 canvas; matching that is what lines the Rust render of a scan up with the shim’s. Capped at three halvings and never below 64 samples a side (a thumbnail is not worth the resampling risk);drawn_*_unitsis the axis-aligned extent of the drawn quad in PDF units. - declared_
size - Decode
streamto samples: the filter chain and codec, the colour space, the alpha plane. The/Width×/Heightan image dictionary declares (the codec’s own size wins once decoded; this is what the reduction rule is asked with). - decode
loadthenrasterize.- load
- Decode an image XObject (or inline image) into samples.
reduction_shiftasks the JPEG decoder for a1 / 2^shiftreduced decode when the image allows one (codec_reduction_shift, [may_reduce_decode]); the loaded image then reports the reduced size. - rasterize
- Rasterize a loaded image as it would be painted with
fill(for stencil masks), reduced so that its whole extent covers abouttargetdevice pixels (None= full size).