验收完成40%

This commit is contained in:
2026-07-17 08:08:31 +08:00
parent 23cfd365a1
commit 887481a4ab
172 changed files with 855 additions and 577 deletions
@@ -10,8 +10,8 @@ const manifestPath = path.join(pipelineDirectory, 'manifests', 'g01-background-c
const reportPath = path.join(pipelineDirectory, 'generated', 'g01-background', 'build-report.json')
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
if (manifest.schemaVersion !== 1 || manifest.page !== 'G01' || manifest.candidates?.length !== 3) {
throw new Error('G01 background manifest must declare exactly three schema v1 candidates')
if (manifest.schemaVersion !== 1 || manifest.page !== 'G01' || manifest.candidates?.length !== 4) {
throw new Error('G01 background manifest must declare exactly four schema v1 candidates')
}
for (const candidate of manifest.candidates) {
@@ -35,9 +35,11 @@ def process_chroma_image(source: Image.Image, config: dict[str, Any]) -> Image.I
return output
def process_opaque_image(source: Image.Image) -> Image.Image:
def process_opaque_image(source: Image.Image, output_size: tuple[int, int] | None = None) -> Image.Image:
"""Normalize a paper-backed master to deterministic opaque RGBA."""
output = source.convert("RGBA")
if output_size is not None and output.size != output_size:
output = output.resize(output_size, Image.Resampling.LANCZOS)
output.putalpha(255)
return output
@@ -83,8 +85,12 @@ def build(manifest_path: Path, workspace: Path, report_path: Path) -> list[dict[
)
if candidate["processingMode"] == "chroma-key":
output = process_chroma_image(opened, chroma)
elif candidate["processingMode"] == "opaque-paper":
output = process_opaque_image(opened)
elif candidate["processingMode"] in {"opaque-paper", "opaque-paper-resize"}:
output_size = None
if candidate["processingMode"] == "opaque-paper-resize":
target = candidate["outputPixels"]
output_size = (target["width"], target["height"])
output = process_opaque_image(opened, output_size)
else:
raise ValueError(f"unsupported processingMode: {candidate['processingMode']}")