/** * Painting the flow of a right-to-left page on the canvas * (`VDTMirroredFlowFrame`). * * The flow is laid out as a left-to-right page and turned over the sheet's * vertical axis: the page paints it through `transform(-1, 0, 0, 1, W, 0)`, * so columns, rules, frames, backgrounds and every position land mirrored, * as the layout means them. Text and pictures must not read mirrored: * while the frame is on, the context's `fillText`, `strokeText` and * `drawImage` turn what they paint back about its own box (the run's * advance from where its alignment puts it, the image's destination * rect), so a glyph run lands where the mirrored layout puts its box and * reads as written. Every painter of the flow (lines, bullets, chips, * ruby, captions, table cells, callout icons, figures) goes through these * three calls, so none of them needs to know about the frame; a run the * painter sets right to left (`ctx.direction = 'rtl'`) is turned about the * box its direction and alignment give it, and shapes as it would on a * left-to-right page. A formula drawn as paths rather than a bitmap asks * {@link counterFlipBox} itself, and a word painted with several * `fillText`s (a tracked word in pieces, #663) asks {@link paintAsOneRun}: * turned piece by piece, its pieces would stand in the mirror's order * ("five" as "vefi", #685). * * The interception is an own property on the context instance, set for * the flow pass and removed after it: running heads, folios and crop marks * paint on the sheet untouched. */ export declare function mirroredPaintActive(): boolean; /** * Run `paint` as on a left-to-right page, inside the mirrored flow: the * counter-flip is off while it runs (#960). A frame set in its own writing * mode on a right-to-left page is placed by a matrix that already * includes the mirror (`VDTFrame.unmirrorX`), so what it paints reads as * written without being turned back. */ export declare function withoutMirroredPaint(paint: () => T): T; /** Turn what `paint` draws back about the horizontal extent * `[left, left + width]`, inside a mirrored frame: the box stays where * the layout put it and its content reads unmirrored. Outside a mirrored * frame it just paints. */ export declare function counterFlipBox(ctx: CanvasRenderingContext2D, left: number, width: number, paint: () => void): void; /** * Paint, with `paint`, a run made of several `fillText`s (the pieces of a * word) whose box is `[left, left + width]`: inside a mirrored frame the * run is turned back once, about that box, and each call of `paint` lands * as on a left-to-right page, so the pieces keep their reading order and * their places in the run. Turned one by one, each about its own box, they * would stand where the mirror puts them: the first at the right end. * Outside a mirrored frame it just paints. */ export declare function paintAsOneRun(ctx: CanvasRenderingContext2D, left: number, width: number, paint: () => void): void; /** * Paint, with `paint`, content that must land on the sheet as a * left-to-right page would put it, inside a mirrored frame (#955): the * frame is reflected back about the vertical axis of the box * `[left, left + width]` (so the box keeps its place on the sheet while * what stands in it reads from its other side) and the text and pictures * are no longer turned back, since nothing is mirrored any more. A vertical * label does it: its cells cannot be turned back run by run, as the line of * a horizontal label's. Outside a mirrored frame it just paints. */ export declare function paintUnmirrored(ctx: CanvasRenderingContext2D, left: number, width: number, paint: () => void): void; /** * Begin painting the flow of a page mirrored about `originX` (its * `flow.mirror.originX`): saves the context, applies the frame and turns * text runs and images back (see the module comment). Returns the * function that ends it, restoring the context. */ export declare function beginMirroredFlow(ctx: CanvasRenderingContext2D, originX: number): () => void; //# sourceMappingURL=mirrorFrame.d.ts.map