Ship LITE and PRO, and let CLARITY and LIGHT GLOW reach the library

Both flavors build from one JS tree: `lite` hands out the free apk
(com.locphamtran.recipescamera), `pro` sells as-is (same id + .pro, label
"RecipesCam Pro"). Release is signed from android/keystore.properties, both
files gitignored - lose either and no later build can install over this one.
The tier reaches JS through src/provariant.ts, which tools/set-variant.mjs
rewrites before each build (`npm run apk:lite` / `apk:pro`); the gradle flavor
alone would ship a Pro apk that thinks it is Lite.

The dev scaffolding goes: the three src/dev probes and their App effects, the
EXPO_PUBLIC_CAPTURE_MODE [CAPTURE] timing log, and the -PdevtestSuffix
side-by-side install hook. 'balanced' stays the shipped capture mode, which is
what those probes measured on the 12S Ultra.

Looking at the picture: WB now converts kelvin through the Planckian locus into
a luma-normalised gain (unity at 5500K, symmetric tint) instead of the old
one-sided push; LEITZ STREETLIFE splits into CLASSIC and VIVID; selecting a
recipe loads every knob it carries over the defaults and stays editable, and
RESET hands the panel back to the sim's own values. The in-app library picker,
the ultra-wide native module and recipe share/import land here too.

CLARITY and LIGHT GLOW existed only on the camera worklet and the export
engine, so a photo opened from the library ignored both. They now run in all
three library preview branches (libPhoto), and the preview clips them to the
drawn image - the export engine always clipped its bloom to the canvas, the
preview drew it over the whole rect, so the bloom bled past the photo onto the
black letterbox and over the frame's mat.
This commit is contained in:
2026-09-14 19:48:44 +07:00
parent 99405514c6
commit 97949e449d
49 changed files with 2050 additions and 659 deletions
+46 -16
View File
@@ -26,6 +26,10 @@ interface RecipeCreateModalProps {
// Id of the currently applied film sim (or bundled recipe whose look should
// prefill the SIMULATION row); undefined → default to PROVIPES.
currentBase?: BaseFilter;
// The look live on screen. CREATE opens on THESE values (not on the sim's
// standard ones) so a recipe is a snapshot of what the user is looking at;
// every knob the form has no row for rides along on SAVE.
current?: ColorAdjustments | null;
// When set the form opens as an EDITOR: every row (name included) is
// prefilled from this recipe instead of the sim's standard values, and
// SAVE hands the edited copy back for the caller to store.
@@ -144,16 +148,24 @@ const NumRow = ({ label, value, onChange, placeholder, width = 58 }: NumRowProps
export default function RecipeCreateModal({
visible,
currentBase,
current,
initial,
onClose,
onSave,
}: RecipeCreateModalProps) {
const insets = useSafeAreaInsets();
// Seed from the current film sim (or PROVIPES) so "other params" start at the
// sim's standard values and the user only types what they want to change.
// Seed from what the user is LOOKING AT: the recipe being edited, else the live
// adjustments, else the current sim's standard values. Seeding from the sim's
// standard values alone (the old behaviour) meant the form showed — and SAVE
// wrote — neutral numbers for knobs the user had already dialled in.
const seedBase: BaseFilter =
currentBase && FILM_SIMS.some((s) => s.baseFilter === currentBase) ? currentBase : 'provia';
const seedAdj = FILM_SIMS.find((s) => s.baseFilter === seedBase)?.adjustments ?? DEFAULT_ADJUSTMENTS;
initial?.baseFilter ??
(currentBase && FILM_SIMS.some((s) => s.baseFilter === currentBase) ? currentBase : 'provia');
const seedAdj: ColorAdjustments =
initial?.adjustments ??
current ??
FILM_SIMS.find((s) => s.baseFilter === seedBase)?.adjustments ??
DEFAULT_ADJUSTMENTS;
// Every sim's standard values as form state — used to seed the modal and to
// reload the form when the SIMULATION chip changes.
@@ -161,13 +173,19 @@ export default function RecipeCreateModal({
const s = src ?? FILM_SIMS.find((x) => x.baseFilter === b)?.adjustments ?? DEFAULT_ADJUSTMENTS;
return {
dr: String(s.dynamicRange ?? 'auto'),
grain: String(s.grain === 0 ? 0 : s.grain >= 6 ? 6 : 3),
// Raw, not rounded to the three chips: a look sitting on grain 2 must not
// become 3 just because the form was opened (and the chip row below shows
// that value as its own chip when it is none of OFF/WEAK/STRONG).
grain: String(s.grain ?? 0),
cc: s.colorChrome ?? 'none',
ccb: s.colorChromeBlue ?? 'none',
// 'custom' = a WB the six chips do not name (a hand-set 6300K, say). It
// keeps its own chip and its own value; the old AUTO fallback rewrote the
// recipe's WB to 5500K on every save.
wbKey: WB_KEYS.find((k) => {
const p = WB_PRESETS.find((w) => w.key === k)!;
return p.temperature === s.temperature && p.tint === s.tint;
}) ?? 'auto',
}) ?? 'custom',
highlight: String(s.highlight),
shadow: String(s.shadow),
color: String(s.saturation),
@@ -181,14 +199,14 @@ export default function RecipeCreateModal({
const [sim, setSim] = useState<BaseFilter>(seedBase);
const [name, setName] = useState('');
const [dr, setDr] = useState<string>(seedAdj.dynamicRange == null ? 'auto' : String(seedAdj.dynamicRange));
const [grain, setGrain] = useState<string>(String(seedAdj.grain === 0 ? 0 : seedAdj.grain >= 6 ? 6 : 3));
const [grain, setGrain] = useState<string>(String(seedAdj.grain ?? 0));
const [cc, setCc] = useState<string>(seedAdj.colorChrome ?? 'none');
const [ccb, setCcb] = useState<string>(seedAdj.colorChromeBlue ?? 'none');
const [wbKey, setWbKey] = useState<string>(
WB_KEYS.find((k) => {
const p = WB_PRESETS.find((w) => w.key === k)!;
return p.temperature === seedAdj.temperature && p.tint === seedAdj.tint;
}) ?? 'auto'
}) ?? 'custom'
);
const [wbRed, setWbRed] = useState('0');
const [wbBlue, setWbBlue] = useState('0');
@@ -208,15 +226,15 @@ export default function RecipeCreateModal({
// Editing a stored recipe wins over the live sim seed: the form must show
// that recipe's own values, not the sim's standard ones.
const base = initial?.baseFilter ?? seedBase;
const v = valuesOf(base, initial?.adjustments);
const v = valuesOf(base, seedAdj);
setSim(base);
setDr(v.dr);
setGrain(v.grain);
setCc(v.cc);
setCcb(v.ccb);
setWbKey(v.wbKey);
setWbRed(String(initial?.adjustments.wbRed ?? 0));
setWbBlue(String(initial?.adjustments.wbBlue ?? 0));
setWbRed(String(seedAdj.wbRed ?? 0));
setWbBlue(String(seedAdj.wbBlue ?? 0));
setFHigh(v.highlight);
setFShadow(v.shadow);
setFColor(v.color);
@@ -250,13 +268,19 @@ export default function RecipeCreateModal({
};
const handleSave = () => {
const wb = WB_PRESETS.find((w) => w.key === wbKey) ?? WB_PRESETS[0];
const wb = WB_PRESETS.find((w) => w.key === wbKey);
const simAdj = FILM_SIMS.find((s) => s.baseFilter === sim)?.adjustments ?? DEFAULT_ADJUSTMENTS;
// The base is what the user was looking at (CREATE) or the recipe being
// edited. Spreading the sim's neutral values here instead — the old
// behaviour — silently zeroed every knob the form has no row for: exposure,
// contrast, vibrance, vignetting, glow, the WB red/blue shift. That is what
// made a saved recipe apply a different look from the one on screen.
const adj: ColorAdjustments = {
...DEFAULT_ADJUSTMENTS,
...simAdj,
temperature: wb.temperature,
tint: wb.tint,
...seedAdj,
// A WB with no preset of its own keeps the value it was seeded with.
temperature: wb ? wb.temperature : seedAdj.temperature,
tint: wb ? wb.tint : seedAdj.tint,
wbRed: int(wbRed, 0, -9, 9),
wbBlue: int(wbBlue, 0, -9, 9),
highlight: int(fHigh, simAdj.highlight, -10, 10),
@@ -265,7 +289,7 @@ export default function RecipeCreateModal({
denoise: int(fNr, simAdj.denoise, 0, 10),
sharpening: int(fSharp, simAdj.sharpening, 0, 10),
clarity: int(fClarity, simAdj.clarity, -10, 10),
grain: parseInt(grain, 10),
grain: int(grain, seedAdj.grain, 0, 10),
colorChrome: cc as ColorAdjustments['colorChrome'],
colorChromeBlue: ccb as ColorAdjustments['colorChromeBlue'],
dynamicRange: (dr === 'auto' ? 'auto' : parseInt(dr, 10)) as ColorAdjustments['dynamicRange'],
@@ -354,6 +378,9 @@ export default function RecipeCreateModal({
{GRAIN_OPTS.map((o) => (
<Chip key={o.v} label={o.d} active={grain === o.v} onPress={() => setGrain(o.v)} />
))}
{!GRAIN_OPTS.some((o) => o.v === grain) && (
<Chip label={grain} active onPress={() => {}} />
)}
</ChipRow>
<Text className="text-zinc-400 font-mono text-[9px] font-bold tracking-widest mt-1.5 mb-0.5">COLOR CHROME EFFECT</Text>
<ChipRow>
@@ -375,6 +402,9 @@ export default function RecipeCreateModal({
{WB_PRESETS.map((w) => (
<Chip key={w.key} label={w.label} active={wbKey === w.key} onPress={() => setWbKey(w.key)} />
))}
{wbKey === 'custom' && (
<Chip label={`${seedAdj.temperature}K`} active onPress={() => setWbKey('custom')} />
)}
</ChipRow>
<View className="flex-row items-center mt-1">
<Text style={{ width: LABEL_W }} className="text-zinc-400 font-mono text-[9px] font-bold tracking-widest">