/** * Color-matrix math: preset builders, combinators, and evaluation for 4×5 RGBA color matrices. * * A color-matrix is a 4×5 affine transform applied to premultiplied RGBA color vectors: * | R' | | m0 m1 m2 m3 m4 | | R | * | G' | = | m5 m6 m7 m8 m9 | × | G | * | B' | | m10 m11 m12 m13 m14 | | B | * | A' | | m15 m16 m17 m18 m19 | | A | * | 1 | * * Row 0 = R output coefficients (R, G, B, A inputs, then R offset). * Row 1 = G output coefficients. * Row 2 = B output coefficients. * Row 3 = A output coefficients. * * The bias column (indices 4, 9, 14, 19) uses normalized-linear, unbounded float units. */ /** Required length of a valid color-matrix array. */ export declare const COLOR_MATRIX_LENGTH = 20; /** * Evaluates `matrix` against a packed `0xRRGGBBAA` color. Useful for previews and tests; pure * math, no surface operations. Input bytes are normalized before applying the matrix; the result is * clamped to 0–1 and repacked as `0xRRGGBBAA`. */ export declare function applyColorMatrixToColor(matrix: Readonly, packedRgba: number): number; /** * Composes `source` into `target` in place: `target = target × source` (applies source first, * then target). Matches OpenFL color-matrix `concat` semantics. Alias-safe: `source` may be * `target`. */ export declare function concatColorMatrix(target: number[], source: Readonly): void; /** * Returns a color matrix that adds `amount` to the brightness offset of each channel. Positive * `amount` brightens; negative darkens. `amount` is normalized-linear. Allocates a new array. */ export declare function createBrightnessColorMatrix(amount: number): number[]; /** * Returns a channel-mixer color matrix. Each `[r, g, b]` triple defines the source mix for the * corresponding output channel. Values are in the 0–1 range (1 = full contribution). Allocates a * new array. * * Example: `createChannelMixerColorMatrix([1, 0, 0], [0, 1, 0], [0, 0, 1])` is the identity. * Swapping channels: `createChannelMixerColorMatrix([0, 1, 0], [1, 0, 0], [0, 0, 1])` swaps R/G. */ export declare function createChannelMixerColorMatrix(redOut: Readonly<[number, number, number]>, greenOut: Readonly<[number, number, number]>, blueOut: Readonly<[number, number, number]>): number[]; /** * Returns a color balance matrix that independently shifts highlights, midtones, and shadows. * Each parameter is a `[red, green, blue]` offset in the –100..100 range, mapped to normalized * –1..1 biases. Allocates a new array. * * Implementation uses a three-range additive model: shadows affect dark pixels (luma < 85), * highlights affect bright pixels (luma > 170), and midtones are weighted by proximity to the * centre luma value. Because colour matrices cannot represent luma-gating directly, the offsets * are applied uniformly and weighted by the fraction of the range each band covers; for precise * per-band clamping use a LUT-based approach in `filters-surface`. */ export declare function createColorBalanceColorMatrix(shadows: Readonly<[number, number, number]>, midtones: Readonly<[number, number, number]>, highlights: Readonly<[number, number, number]>): number[]; /** * Returns a color matrix that tints toward `packedRgba` (0xRRGGBBAA) by `amount` (0 = original, * 1 = solid tint color). Allocates a new array. */ export declare function createColorMatrixFromTint(packedRgba: number, amount: number): number[]; /** * Returns a color matrix that scales contrast by `amount` (1 = original, 0 = flat mid-grey, >1 = * increased contrast). Allocates a new array. */ export declare function createContrastColorMatrix(amount: number): number[]; /** * Returns a color matrix that desaturates by `amount` (0 = no change, 1 = fully desaturated / * grayscale). Allocates a new array. Equivalent to `createSaturationColorMatrix(1 - amount)`. */ export declare function createDesaturateColorMatrix(amount: number): number[]; /** * Returns a grayscale color matrix using luma-weighted ITU-R BT.601 coefficients * (R=0.299, G=0.587, B=0.114). Allocates a new array. */ export declare function createGrayscaleColorMatrix(): number[]; /** * Returns a hue-rotation color matrix that rotates the hue wheel by `degrees`. Allocates a new * array. */ export declare function createHueRotateColorMatrix(degrees: number): number[]; /** * Returns the identity color matrix. Applying it leaves colors unchanged. * Allocates a new array. */ export declare function createIdentityColorMatrix(): number[]; /** * Returns an invert color matrix that produces `1 - channel` per RGB channel. Alpha is * unchanged. Allocates a new array. */ export declare function createInvertColorMatrix(): number[]; /** * Returns a levels color matrix that remaps the input range `[inBlack, inWhite]` to the output * range `[outBlack, outWhite]` with optional `gamma` correction. All values are normalized 0–1. `gamma` * defaults to 1 (linear). Allocates a new array. * * The remapping function is: * output = outBlack + (outWhite - outBlack) * ((input - inBlack) / (inWhite - inBlack))^(1/gamma) * Because colour matrices cannot represent a true power-law curve, `gamma` is approximated via a * linear scale-and-offset that matches the midpoint of the gamma curve; for exact gamma correction * apply a LUT in `filters-surface`. */ export declare function createLevelsColorMatrix(inBlack: number, inWhite: number, outBlack: number, outWhite: number, gamma?: number): number[]; /** * Returns a color matrix that scales the alpha channel by `alpha` (0 = transparent, 1 = opaque). * RGB channels are unchanged. Allocates a new array. */ export declare function createOpacityColorMatrix(alpha: number): number[]; /** * Returns a color matrix that applies a Polaroid-style warm orange-tint look. * Allocates a new array. This is a data constant exposed as a factory for * consistent API shape with the other presets. */ export declare function createPolaroidColorMatrix(): number[]; /** * Returns a color matrix that scales color saturation by `amount` (0 = grayscale, 1 = original, * >1 = oversaturated). Allocates a new array. */ export declare function createSaturationColorMatrix(amount: number): number[]; /** * Returns a sepia-tone color matrix. Allocates a new array. */ export declare function createSepiaColorMatrix(): number[]; /** * Returns a color matrix approximating the Technicolor two-strip process: warm reds/oranges * with cyan shadows and a slight green cross-process. Allocates a new array. */ export declare function createTechnicolorColorMatrix(): number[]; /** * Returns a vintage/faded-film color matrix: desaturated, warm tones, lifted blacks. * Allocates a new array. */ export declare function createVintageColorMatrix(): number[]; /** * Returns a white-balance color matrix that adjusts color temperature toward warm (positive * `temperature` values) or cool (negative) and tint toward green (positive `tint`) or magenta * (negative). Both parameters are in the –100..100 range. Allocates a new array. * * Temperature shifts are modelled as complementary R/B channel gains (warm = more R, less B). * Tint shifts are modelled as G channel gain (more G = green, less G = magenta). This matches the * Lightroom/Camera3D Raw slider convention. */ export declare function createWhiteBalanceColorMatrix(temperature: number, tint: number): number[]; /** * Fuses a run of color matrices into ONE matrix that applies them left-to-right (index 0 first, then * 1, …). This is the matrix-tier fuse: a stack of consecutive matrix-tier adjustments collapses to a * single 4×5 matrix run through one generic color-matrix pass instead of one pass per adjustment. * Order matters (matrix composition is not commutative); an empty list yields the identity. Allocates * the result array. */ export declare function fuseColorMatrices(matrices: ReadonlyArray>): number[]; /** * Composes matrix `b` applied first and then `a`. The result is equivalent to applying `b` to a * color and then `a` to the result. When `out` is provided the result is written there (alias-safe: * `out` may be `a` or `b`). Returns the output array (either `out` or a freshly allocated array). */ export declare function multiplyColorMatrix(a: Readonly, b: Readonly, out?: number[]): number[]; //# sourceMappingURL=colorMatrixMath.d.ts.map