/** A decoded bitmap: straight (un-premultiplied) RGBA, TOP row first. */ export interface DibImage { readonly width: number; readonly height: number; readonly rgba: Uint8Array; /** * Whether the source stored its rows bottom-first — which is the usual way, * and which a caller needs to know to read a source rectangle: a blit states * one in the BITMAP's own coordinates, whose origin is its first row. */ readonly bottomUp?: boolean; } /** What a caller knows about the bitmap that its own header does not say. */ export interface DibOptions { /** * Where the pixels start. EMF states this; a WMF stores the two parts back to * back, so leaving it out means "after the palette". */ readonly bitsAt?: number; /** How many pixel bytes there are, when the record states it. */ readonly cbBits?: number; /** * Whether a 32-bit bitmap's fourth byte is ALPHA. It is reserved in an * ordinary blit — GDI ignores it and so must this, or a picture whose * producer left it zero comes out invisible — and it is the alpha channel * in an EMR_ALPHABLEND that says so. */ readonly alpha?: boolean; } /** * Decode a packed DIB into RGBA. * * @param bytes The metafile. * @param bmiAt Where the bitmap's header starts. * @param o What the record says about the bitmap; see {@link DibOptions}. * @returns The bitmap, or `undefined` when the header is malformed or its * compression is one this decoder does not do. */ export declare function readDib(bytes: Uint8Array, bmiAt: number, o?: DibOptions): DibImage | undefined; /** * The colour bitmap seen through a monochrome one — the two-blit idiom every * clipart of this age is drawn with: an AND of the mask, which knocks the * picture's ground to white, and then an OR of the picture, which is black * exactly where the ground was. Kept apart they draw a black box; put together * they are one bitmap with an alpha channel. * * @param color The bitmap the second blit paints. * @param mask The first blit's mask: WHITE where the picture is to show * through, black where it is opaque. */ export declare function maskedDib(color: DibImage, mask: DibImage): DibImage; /** * The bitmap as a PNG file, ready for the resource store. An opaque one is * written without an alpha channel — a quarter less to deflate, and the * writers that flatten transparency then have nothing to do. */ export declare function dibToPng(img: DibImage): Uint8Array; /** The bitmap at a constant transparency — what a blend function's `SrcConstantAlpha` asks for. */ export declare function fadedDib(img: DibImage, alpha: number): DibImage; /** The part of the bitmap a blit's source rectangle names, or all of it. */ export declare function cropDib(img: DibImage, x: number, y: number, w: number, h: number): DibImage;