/** * Where the pixels of an image are in its element: `object-fit` and * `object-position`, as numbers for the shader. */ import type { Slider } from '../index.js'; /** What the page says about a media element, read once per layout. */ export interface Style { /** Its `object-fit`. */ fit: string; /** Its position across and down, as a share of what is left or in px. */ at: { share?: number; px?: number; }[]; /** Radius of its corners, px. */ radius: number; /** The exponent of the corners: 2 round, 4 a squircle. */ shape: number; } /** Where something is, px. */ export interface Rect { x: number; y: number; w: number; h: number; } /** A media element as the layers measure it. */ export interface Box { /** Along the way of the slides, in the slide, px. */ dx: number; /** Across, in the view, px. */ dy: number; /** The element, in px of its quad. */ at: Rect; style: Style; } /** * What the page says about a media element, read once per layout. * * @param media Media element. * @return `fit`, `at` (position as fractions or px), `radius` * and `shape`, the exponent of the corners. */ export declare function styleOf(media: HTMLElement): Style; /** * @param iw Width of the image. * @param ih Height of the image. * @param box The element in px of the quad: `x`, `y`, `w`, * `h`. * @param qw Width of the quad. * @param qh Height of the quad. * @param style From `styleOf()`. * @param out Thirteen numbers: `box` (quad uv to texture * uv: scale x and y, offset x and y), `rect` * (the element in quad uv: left, top, right, * bottom), `cut` (1 when the image leaves a * part of its element empty) and the whole * image in px of the quad (left, top, width, * height). * @return Width the whole image is drawn at, px. */ export declare function fit(iw: number, ih: number, box: Rect, qw: number, qh: number, style: Style, out: Float32Array | number[]): number; /** * Whether a picture has nothing in it. WebKit gives such a bitmap now and * then for an image that is loaded and decoded: seen for slides out of * view, on a machine that is busy. * * @param canvas The picture, drawn four by four. * @return Nothing in it. */ export declare const empty: (canvas: OffscreenCanvas) => boolean; /** * Makes the textures of the slides next to those in view, when the page * has time: the first move to a picture does not wait for its texture, * which on a phone costs frames. Images only: a video is uploaded while it * plays. Then lets go of the textures that were not drawn for longest. * * @param slider Slider. * @param media The media of the slides. * @param boxes Their boxes, as the layers measure them. * @param get Asks * for the texture of an image drawn so wide, px. * @param sweep Lets go of the textures beyond `KEEP`. * @return Does it, when the page has time. */ export declare const KEEP = 16; export declare const nearby: (slider: Slider, media: (HTMLElement | null | undefined)[], boxes: (Box | null)[], get: (element: HTMLImageElement, width: number) => void, sweep: () => void) => (() => void);