region

open fun region(x: Int, y: Int, fullPageWidth: Int, fullPageHeight: Int): PageRenderConfiguration.Builder

Render a sub-region of the page. Region clip rect is determined from the passed full page size parameters and the bitmap size (passed to renderPageToBitmap .

The meaning of the `x/y` parameters may be confusing at first but given the following information they might make more sense: Think of a coordinate system where (x,y,fullPageWidth,fullPageHeight) represents the whole page and (0,0,bitmapBuffer.width,bitmapBuffer.height) the part you want to render.

Example: Let's say in your coordinate system the page is placed at (px,py,pw,ph) and you want to render the (rx,ry,rw,rh) part of it and the coordinates are in pixels, then: - Allocate a `bitmapBuffer` with the size (rw,rh) - Set `region()` with `x/y/fullPageWidth/Height` = (px-rx,py-ry,pw,ph) - Use a Bitmap of size (rx,ry) Note: It's normal for `X/Y` to become negative and for `fullPageWidth/Height` to be greater than `bitmap`.size in some situations.

For the `fullPageWidth` `fullPageHeight` params use correct ratio to w/h for the page and take into account how much you want to zoom. eg. For a page 600x800px zoomed in at 2x, you would set 1200x1600.

Parameters

x

x-offset of the rendered region, can be negative.

y

y-offset of the rendered region, can be negative.

fullPageWidth

Width of the fully sized page including any scaling (see description above).

fullPageHeight

Height of the fully sized page.