rasterize
fun rasterize(page: KitePage, widthPx: Int, heightPx: Int, background: Color = Color.White, hairlineWidthPx: Float = 1.0f, theme: ReaderTheme? = null): ImageBitmap
Renders page into a fresh widthPx×heightPx bitmap.
The page is scaled to fill widthPx. Give heightPx the page's own aspect ratio, widthPx * displayHeight / displayWidth: a shorter bitmap cuts off the bottom of the page, and a taller one leaves background below it.
Parameters
background
colour painted before page content (documents assume paper).
hairlineWidthPx
the width in raster pixels of a stroke whose line width is 0. See ComposeCanvas. Pass the raster:on-screen ratio (>1) when rendering supersampled so sub-pixel strokes keep their weight after the downscale.
fun rasterize(page: KitePage, widthPx: Int, heightPx: Int, background: Color = Color.White, hairlineWidthPx: Float = 1.0f, theme: ReaderTheme? = null, canvasDecorator: KiteCanvasDecorator?): ImageBitmap
rasterize with an application canvas wrapper. See KiteCanvasDecorator for ordering, repeatable paint passes and threading requirements.