react-native-mask-segment-c.../dist/utils/compositePaintedImage.d.ts

44 lines
2.2 KiB
TypeScript
Raw Normal View History

import type { BgrColor, SavePaintResult } from '../components/MaskSegmentCanvas.types';
import type { SkImage } from '@shopify/react-native-skia';
export type CompositePaintInput = {
originBuffer: Uint8Array;
cols: number;
rows: number;
pickBuffer: Uint8Array;
paintedRegions: Map<number, BgrColor>;
destDir?: string;
/**
* Preferred path for rich export: PNG base64 from makeImageSnapshot() written
* directly to disk without an extra decode/re-encode round trip.
*/
exportPngBase64?: string;
/**
* Preferred path for rich export: if the caller (MaskSegmentCanvas) provides bytes
* that were produced by makeImageSnapshot() on a high-resolution Canvas rendering the
* exact same PaintShaderLayer + regionPaint SkSL at work resolution, we write them
* directly. This captures the live editor (lighting + high/low-freq texture)
* without CPU pixel math and without a second declarative drawAsImage.
*/
exportPngBytes?: Uint8Array;
/**
* Fallback rich path (when no pre-captured snapshot bytes): pass the live textures
* so we can try renderPaintedImageOffscreen (drawAsImage with the shader tree).
*/
shaderTextures?: {
originImage: SkImage;
paintColorMap: SkImage;
lowFreqImage: SkImage;
highFreqImage: SkImage;
};
/** The logical size at which to render the shader tree for export (typically the work image res). */
renderWidth?: number;
renderHeight?: number;
};
/** recolored PNG
*
* 1. exportPngBytes makeImageSnapshot Canvas shader CPU drawAsImage
* 2. shaderTextures + render* renderPaintedImageOffscreen / drawAsImage PaintShaderLayer + SkSL
* 3. CPU recolorflat/
*/
export declare function compositePaintedImage(input: CompositePaintInput): Promise<SavePaintResult>;
//# sourceMappingURL=compositePaintedImage.d.ts.map