/** * The picture of a comic panel (#556): which part of it shows in the cell. * * `cover` fills the cell: the visible window has the cell's aspect ratio * and is as large as the picture allows; it is placed so the picture's * safe area stays whole — centred on `focus` when one is given, else with * the margins round the safe area cropped in proportion to their sizes * (the rule of `safeAreaSource`), else centred. A cell whose shape cannot * hold the safe area under a cover crop shows the smallest window that * holds it, and the picture is letterboxed (the bands show the panel * background). `contain` always shows the whole picture. * * The result is the window in picture fractions (`source`) and the box the * whole picture covers on the page (`box`): renderers clip to the cell and * draw the picture at `box`, as they draw a cropped figure * (`uncroppedPictureBox`). A mirrored picture is flipped inside `box`. */ import type { ResourceAnchor, ResourceSafeArea } from '../types.js'; import type { BoundingBox, VDTComicArt, VDTPoint } from '../vdt.js'; export interface ComicCropInput { /** The picture's intrinsic size (any unit; only the ratio counts). */ width: number; height: number; /** The cell (page px). */ cell: BoundingBox; fit: 'cover' | 'contain'; safeArea?: ResourceSafeArea; /** The point of the picture (fractions) to centre when the safe area * leaves room. */ focus?: { x: number; y: number; }; /** The picture is drawn flipped: the safe area and focus are read * flipped. */ mirrored?: boolean; } export interface ComicCrop { /** The visible part of the picture, in fractions of the picture as stored * (unflipped), clamped to it. */ source: BoundingBox; /** The box the whole picture covers (page px). */ box: BoundingBox; /** The picture leaves bands of the cell uncovered. */ letterbox: boolean; /** The cover crop could not keep the safe area whole (a `cover` panel * fell back to a letterbox). */ fallback: boolean; } /** The cell aspect ratios (width / height) a picture can fill under a * cover crop with its safe area whole: from the safe area's width over the * whole height (`min`, a tall cell) to the whole width over the safe * area's height (`max`, a wide one). Without a safe area any ratio. */ export declare function comicCropFeasibleRange(width: number, height: number, safeArea?: ResourceSafeArea): { min: number; max: number; }; /** Which part of a picture shows in a cell, and where the whole picture * goes. */ export declare function comicArtCrop(input: ComicCropInput): ComicCrop; /** Where a point of a panel's picture (`u`, `v`: fractions of the picture * as stored) lands on the page; a mirrored picture flips `u`. Whether it * shows is whether it lies inside the panel's polygon (`pointInPolygon`). */ export declare function comicArtPointToPage(art: Pick, u: number, v: number): VDTPoint; /** A rectangle of a panel's picture (fractions) on the page. */ export declare function comicArtRectToPage(art: Pick, r: ResourceSafeArea): BoundingBox; /** The anchors of a picture that lie outside its safe area: a crop keeps * the safe area and may cut them off. A picture without a safe area * reports none (any crop may cut any point; the hint is about pictures * whose safe area was drawn). */ export declare function anchorsOutsideSafeArea(anchors: readonly ResourceAnchor[] | undefined, safeArea: ResourceSafeArea | undefined): ResourceAnchor[]; //# sourceMappingURL=art.d.ts.map