PdfImage
An image ready to embed in a PdfBuilder page via ContentStreamBuilder.drawImage.
Two kinds:
Raw samples (rgba / rgb / gray) — uncompressed 8-bit pixel bytes. Embedded as a
DeviceRGB/DeviceGrayimage XObject with/FlateDecode. rgba splits the alpha channel into a/SMaskso transparency is preserved (e.g. a logo with a cut-out background).JPEG passthrough (jpeg) — the encoded JPEG bytes are stored verbatim with
/DCTDecode; every conformant PDF reader decodes JPEG natively, so nothing is re-encoded. JPEG carries no alpha.
Instances are compared by identity: pass the same PdfImage to multiple pages and it's embedded once and shared across them.
Pixels are laid out top row first, left to right — the natural raster order. The PDF image-space flip is handled by ContentStreamBuilder.drawImage.