fix(sim): rebuild the six film-sim color matrices to match the stock looks

Provia/Velvia/Astia/Classic Chrome/Classic Neg/Acros each get their own
primaries+cross-talk matrix measured against the pipeline, plus a split-tone
stage (shadow/highlight tint uniforms) for Classic Chrome's teal and Classic
Neg's green-cyan shadows vs warm highlights.
This commit is contained in:
2026-09-10 20:57:19 +07:00
parent 93f48537f8
commit 4bb2bda5c8
5 changed files with 139 additions and 53 deletions
+6 -3
View File
@@ -5,7 +5,7 @@ import * as MediaLibrary from 'expo-media-library/legacy';
import { Asset } from 'expo-asset';
import { Recipe, GPSInfo, FrameId, AspectRatio, ASPECT_RATIO_W_H, CropRect } from '../types';
import { getSkiaColorMatrix, applyExposureGain } from './colorUtils';
import { TONE_SKSL, getToneUniforms, toneIsActive } from './toneShader';
import { TONE_SKSL, getToneUniforms, toneIsActive, toneUniformArray } from './toneShader';
import { CINEMA_SKSL, getCinemaUniforms, cinemaIsActive } from './cinemaShader';
import { drawFrameOnCanvas, polaroidLayout, POLAROID_CARD, POLAROID_WIN_W, wallframeLayout, WALLFRAME_W, WALLFRAME_H, WALLFRAME_LAND_W, WALLFRAME_LAND_H } from './frameUtils';
import { patchJpegDpi } from './jpegDpi';
@@ -218,7 +218,10 @@ export async function processAndExportPhoto(
// through the shader) when a real shader exists. If the RuntimeEffect fails
// to compile / makeShaderWithChildren returns null, paint has no shader and a
// drawRect would fill solid opaque color → black/blank output.
const tone = getToneUniforms(adjustments);
// The stock's own tone pass (Classic Neg split tone, Classic Chrome shadow
// crush) rides along here, so those two recipes export with the pass even
// when every user knob is 0.
const tone = getToneUniforms(adjustments, recipe.baseFilter);
const hasTone = toneIsActive(tone);
let toneShader: SkShader | null = null;
if (hasTone) {
@@ -235,7 +238,7 @@ export async function processAndExportPhoto(
FilterMode.Linear,
MipmapMode.None
);
toneShader = toneEffect.makeShaderWithChildren([tone.dr, tone.hl, tone.sh, tone.vib], [imageShader]);
toneShader = toneEffect.makeShaderWithChildren(toneUniformArray(tone), [imageShader]);
if (toneShader) {
paint.setShader(toneShader);
} else {