/** * TypedArray utilities for high-performance numeric operations. * * This module provides optimized operations using TypedArrays instead of * regular JavaScript arrays for numeric data. TypedArrays offer: * - Better memory efficiency (fixed-size elements) * - Faster iteration (no type checking per element) * - Better cache locality * - Direct memory access for FFI operations * * @module typed-arrays */ /** * Create a color array from RGB values (0-255 or 0-1). * Returns Float32Array normalized to 0-1 range. */ export declare function colorFromRGB(r: number, g: number, b: number, normalize?: boolean): Float32Array; /** * Create a color array from RGBA values. */ export declare function colorFromRGBA(r: number, g: number, b: number, a: number, normalize?: boolean): Float32Array; /** * Create a grayscale color array. */ export declare function colorFromGray(gray: number, normalize?: boolean): Float32Array; /** * Create a CMYK color array. */ export declare function colorFromCMYK(c: number, m: number, y: number, k: number, normalize?: boolean): Float32Array; /** * Create a point array from coordinates. * Stores as [x0, y0, x1, y1, x2, y2, ...] */ export declare function pointsFromCoords(...coords: number[]): Float32Array; /** * Create a point array from Point-like objects. */ export declare function pointsFromObjects(points: { x: number; y: number; }[]): Float32Array; /** * Transform points in-place by a matrix. * Points are stored as [x0, y0, x1, y1, ...] * Matrix is [a, b, c, d, e, f] */ export declare function transformPointsInPlace(points: Float32Array, a: number, b: number, c: number, d: number, e: number, f: number): void; /** * Transform points, returning a new array. */ export declare function transformPoints(points: Float32Array, a: number, b: number, c: number, d: number, e: number, f: number): Float32Array; /** * Create a rectangle array from coordinates. * Stores as [x0, y0, x1, y1, ...] */ export declare function rectsFromCoords(...coords: number[]): Float32Array; /** * Create a rectangle array from Rect-like objects. */ export declare function rectsFromObjects(rects: { x0: number; y0: number; x1: number; y1: number; }[]): Float32Array; /** * Transform rectangles in-place by a matrix. * For axis-aligned transforms (b=0, c=0), preserves rectangle form. * For other transforms, computes bounding box of transformed corners. */ export declare function transformRectsInPlace(rects: Float32Array, a: number, b: number, c: number, d: number, e: number, f: number): void; /** * Create an identity matrix. */ export declare function matrixIdentity(): Float32Array; /** * Create a translation matrix. */ export declare function matrixTranslate(tx: number, ty: number): Float32Array; /** * Create a scale matrix. */ export declare function matrixScale(sx: number, sy?: number): Float32Array; /** * Create a rotation matrix (degrees). */ export declare function matrixRotate(degrees: number): Float32Array; /** * Concatenate two matrices in-place (m1 = m1 * m2). */ export declare function matrixConcatInPlace(m1: Float32Array, m2: Float32Array): void; /** * Concatenate two matrices, returning new array. */ export declare function matrixConcat(m1: Float32Array, m2: Float32Array): Float32Array; /** * Calculate distances from one point to multiple points. * Returns Float32Array of distances. */ export declare function pointDistances(fromX: number, fromY: number, points: Float32Array): Float32Array; /** * Calculate squared distances (faster, no sqrt). */ export declare function pointDistancesSquared(fromX: number, fromY: number, points: Float32Array): Float32Array; /** * Test which points are inside a rectangle. * Returns Uint8Array (0 = outside, 1 = inside). */ export declare function rectContainsPoints(x0: number, y0: number, x1: number, y1: number, points: Float32Array): Uint8Array; /** * Count points inside a rectangle (no allocation). */ export declare function countPointsInRect(x0: number, y0: number, x1: number, y1: number, points: Float32Array): number; /** * Convert pixel data from one format to another. * Supported: RGB to RGBA, RGBA to RGB, Gray to RGB, etc. */ export declare function convertPixelFormat(src: Uint8Array, srcComponents: number, dstComponents: number, defaultAlpha?: number): Uint8Array; /** * Premultiply alpha in RGBA pixel data (in-place). */ export declare function premultiplyAlpha(pixels: Uint8Array): void; /** * Unpremultiply alpha in RGBA pixel data (in-place). */ export declare function unpremultiplyAlpha(pixels: Uint8Array): void; //# sourceMappingURL=typed-arrays.d.ts.map