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

41 lines
1.4 KiB
TypeScript

import { requireNativeModule } from 'expo-modules-core';
export interface DecodeEncodeTimings {
decodeMs: number;
encodeWriteMs: number;
totalMs: number;
}
export interface ColorTimings {
decodeMs: 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;
}
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, apply a row-major 4x5 color matrix
* (translate column in 0..1 Skia space — folded from colorUtils.ts
* getSkiaColorMatrix/applyExposureGain in JS), JPEG-encode to dstPath.
* All native, off the JS/main threads.
*/
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>;
materializeBlackAsset(): Promise<string>;
}
export default requireNativeModule('RecipesCamExport') as RecipescamExportModule;