Files
RecipesCam/modules/recipescam-export/index.ts
T

51 lines
1.8 KiB
TypeScript

import { requireNativeModule } from 'expo-modules-core';
export interface DecodeEncodeTimings {
decodeMs: number;
encodeWriteMs: number;
totalMs: number;
}
export interface ColorTimings {
decodeMs: number;
toneMs?: number;
colorMs: number;
encodeWriteMs: number;
totalMs: number;
}
/** Rect (pixel coords) of the center-largest aspect crop, computed in JS. */
export interface CropRect {
x: number;
y: number;
width: number;
height: number;
}
/** ToneUniforms from toneShader.ts (0/0/0 = skip tone pass). */
export interface ToneUniforms {
dr: number;
hl: number;
sh: number;
}
export interface RecipescamExportModule {
/** Decode JPEG/PNG at srcPath (plain absolute path), re-encode JPEG q and write dstPath. All native, background. Returns stage timings in ms. */
decodeEncodeAsync(srcPath: string, dstPath: string, quality: number): Promise<DecodeEncodeTimings>;
/**
* Decode srcPath, optional crop rect, optional tone pass (DR/highlight/
* shadow, port of toneShader.ts), then row-major 4x5 color matrix (translate
* column in 0..1 Skia space), JPEG-encode to dstPath. All native, off the
* JS/main threads. Stage order mirrors exportEngine: crop -> tone -> matrix.
*/
processPhotoAsync(srcPath: string, dstPath: string, matrix: number[], crop: CropRect | null, tone: ToneUniforms, quality: number): Promise<ColorTimings>;
/** P1 alias: matrix + crop, no tone pass. */
processColorAsync(srcPath: string, dstPath: string, matrix: number[], crop: CropRect | null, quality: number): Promise<ColorTimings>;
/** P0 probe helpers — removed before ship. */
ping(): Promise<string>;
materializeBenchAsset(assetName: string): Promise<string>;
materializeSolidAsset(r: number, g: number, b: number): Promise<string>;
}
export default requireNativeModule('RecipesCamExport') as RecipescamExportModule;