/** * How the backends paint a composed page (#855, DESIGN §4): the frames in * layer order with the template's decoration at layer 0, each frame's * blocks turned (and scaled, #858) by its matrix and clipped to its box * when its content overflows; on a page of a spread (#861) all of it * clipped to the page's share of the sheet. Shared by canvas, PDF and HTML * so the three agree. */ import { type VDTBlock, type VDTComicPage, type VDTComposedPage, type VDTDesignBlock, type VDTDesignSlot, type VDTFrame, type VDTPage } from '../vdt.js'; /** One step of a composed page's paint order. */ export type ComposedPaintItem = /** `facing`: the half of a frame read on the facing page of a spread * (`VDTFrame.facingBlocks`, #861): painted, never read. */ { kind: 'frame'; frame: VDTFrame; blocks: VDTBlock[]; facing: boolean; } /** The template's decoration at layer 0, without its blocks painted * over the frames ({@link decorationUnder}). */ | { kind: 'decoration'; } /** The decoration's blocks painted over every frame (#1076: connectors * into pictures; #1189: a module's texts, {@link decorationOver}); last * in the order, present * only when the decoration has such a block. */ | { kind: 'over'; }; /** Whether a decoration block is painted over the frames: a connector's * path (#1076) or a text (#1189) marked `over`. */ export declare function paintsOverFrames(block: VDTDesignBlock): boolean; /** The part of a composed page's decoration painted at layer 0, under * the frames of layer 0 and up: the slot itself when none of its blocks * is painted over them (the common case, so nothing is copied), else the * slot without those blocks. */ export declare function decorationUnder(slot: VDTDesignSlot): VDTDesignSlot; export declare function decorationUnder(slot: VDTDesignSlot | undefined): VDTDesignSlot | undefined; /** The part of a composed page's decoration painted after every frame * (#1076), in slot order; undefined when there is none. */ export declare function decorationOver(slot: VDTDesignSlot | undefined): VDTDesignSlot | undefined; /** Ids of the floats a composed page's frames hold: the backends paint * them with their frames ({@link composedPaintOrder}), not with the * page's other floats. Empty for any other page. */ export declare function composedFrameBlockIds(page: VDTPage): Set; /** The frames painted under the decoration (`'below'`: layers below 0) * or over it (`'above'`), for a backend that paints the decoration * apart (a page painted through a flow frame, whose decoration stands on * the sheet). */ export type ComposedPaintPart = 'below' | 'above'; /** The frames of a comic that hold text (`::panel{text}`, #885), with * their blocks, in panel order: painted over the panels and under the * lettering ({@link comicPaintsUnderText}). `comic` (on the sheet) is the * page's comic page by default; pass a strip's (`pageComics`, #959) for * its frames. Empty when the comic holds none. */ export declare function comicFramePaintOrder(page: VDTPage, comic?: Pick | undefined): ComposedPaintItem[]; /** Whether a page's comic holds text panels (#885): its panels are then * painted before the page's flow, the text frames after the floats, and * its lettering last, so the text lies over its panel's ground and under * the balloons. */ export declare function comicPaintsUnderText(page: VDTPage): boolean; /** Whether a comic (on the sheet) holds a text frame with text in it. */ export declare function comicHoldsText(comic: Pick | undefined): boolean; /** The paint order of a composed page: frames of a layer below 0, the * decoration (layer 0), then the frames of layer 0 and up; frames of * one layer in template order; last, when the decoration has blocks * painted over the frames (#1076), the `'over'` item. Each frame comes * with its blocks, in `page.floats` order (its box first). With `part`, * only the frames on that side of the decoration, and neither decoration * item: the caller paints the decoration on the sheet, and its `'over'` * part after the frames `'above'`. */ export declare function composedPaintOrder(page: VDTPage, part?: ComposedPaintPart): ComposedPaintItem[]; /** The items of a paint order (`composedPaintOrder`) in reading order * (#862): the decoration first, then the frames by the Markdown order of * their content (the lowest content index of their blocks; a frame with * no content keeps its place after those that have some). The pieces of * one story (`next`) follow each other, as their content does. What the * HTML writes in this order and paints by `z-index`; the tagged PDF reads * the same order (`readFloat`'s `readAt`). */ export declare function composedReadingOrder(paint: readonly ComposedPaintItem[]): ComposedPaintItem[]; /** On a page of a spread (#861): the box the page's frames and decoration * are painted clipped to (`VDTComposedPage.sheetClip`), so what crosses * the spine shows its own half on each page; undefined on any other * page. */ export declare function composedSheetClip(page: Pick): { x: number; y: number; width: number; height: number; } | undefined; /** {@link composedSheetClip} on the sheet, for what a page paints there * rather than through its flow frame (the decoration of a vertical or * right-to-left page): the clip, in the page's flow coordinates, mapped * to the page (#926). The same box on any other page. */ export declare function composedSheetClipOnSheet(page: Pick): { x: number; y: number; width: number; height: number; } | undefined; type Affine = [number, number, number, number, number, number]; /** The affine matrix `[a, b, c, d, e, f]` (canvas `transform` order, * y down) that puts a frame's blocks on the sheet (in the page's flow frame, #929): scaled by the frame's * text `scale` about the top-left of its box (#858; the blocks are laid * out `1 / scale` as large), then turned `rotate` degrees clockwise about * the centre of its box. Undefined for an upright frame at full size. */ export declare function frameMatrix(frame: Pick & Partial>): Affine | undefined; /** The quarter turn a frame set in its own writing mode (#944) adds to its * `rotate`: 90 for a vertical frame on a horizontal page, −90 for a * horizontal one on a vertical page; 0 for any other frame. */ export declare function frameModeTurn(frame: Pick): number; /** A box turned a quarter turn about its centre: its width and height * swapped. */ export declare function quarterTurnedRect(r: { x: number; y: number; width: number; height: number; }): { x: number; y: number; width: number; height: number; }; /** The box the page gives a frame, before the frame's own `rotate`: its * `rect`, or, for a frame set in its own writing mode (#944), `rect` * turned back a quarter turn. */ export declare function framePageRect(frame: Pick): { x: number; y: number; width: number; height: number; }; /** A frame's box in its blocks' own coordinates: `rect` itself, or, for a * frame whose text the reflow ladder scaled (#858), the larger box its * content was laid out in. Backends clip to it under {@link frameMatrix}. */ export declare function frameContentRect(frame: Pick & Partial>): { x: number; y: number; width: number; height: number; }; /** Whether a frame's content is clipped to its box: some of it runs past * the frame's foot. */ export declare function frameClips(frame: Pick): boolean; /** The axis-aligned box a frame covers on the page once turned. */ export declare function frameBounds(frame: Pick & Partial>): { x: number; y: number; width: number; height: number; }; /** The frame of `composed` holding block `id`, if any. */ export declare function frameOfBlock(composed: VDTComposedPage | undefined, id: string): VDTFrame | undefined; export {}; //# sourceMappingURL=paint.d.ts.map