Compare commits
8
Commits
84df0b7a7d
...
v0.8.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2fdfafaa7 | ||
|
|
b60d0c3bce | ||
|
|
8a0065274b | ||
|
|
ab2f6e562e | ||
|
|
3026e7081c | ||
|
|
d50c3c4f3c | ||
|
|
9a365acd2b | ||
|
|
47a5373a8e |
@@ -1,5 +1,19 @@
|
|||||||
# ICCery Agent Notes
|
# ICCery Agent Notes
|
||||||
|
|
||||||
|
## Stage 5 Verification / Profcheck
|
||||||
|
|
||||||
|
- `profcheck` output is parsed from both JSON summaries (preferred) and legacy plain-text report formats.
|
||||||
|
- If no delta-E values can be detected, the report cards show 0.00 and a warning is appended to the process log.
|
||||||
|
- The `.gam` file for the 3D viewer is parsed using `parseGamutFile`, which supports multiple `BEGIN_DATA` blocks (some Argyll files use a separate block per surface section), inline `#` comments, and out-of-bounds vertex warnings.
|
||||||
|
- Manual parser tests live in `src/js/gamut_viewer.test.js`.
|
||||||
|
|
||||||
|
## 3D Gamut Viewer
|
||||||
|
|
||||||
|
- The viewer renders the measured/derived `.gam` volume and an optional sRGB reference wireframe in CIELAB.
|
||||||
|
- Layer controls (profile, sRGB, axes) each have visibility toggles and opacity sliders.
|
||||||
|
- Click **Reset View** or press **R** to return the camera to its default position.
|
||||||
|
- Full JSDoc is provided on the public API in `src/js/gamut_viewer.js`.
|
||||||
|
|
||||||
## Stage 4 colprof Options
|
## Stage 4 colprof Options
|
||||||
|
|
||||||
- `colprof` options are exposed in the Stage 4 UI with contextual tooltips:
|
- `colprof` options are exposed in the Stage 4 UI with contextual tooltips:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
2. **Stage 2 — Target Creation & Raw Printing (`printtarg`)**: Format patch targets for spectrophotometers (i1Pro, i1Pro2, ColorMunki, SpyderPrint). View high-resolution downscaled TIFF previews and print directly using native OS raw unmanaged pathways (Windows GDI uncorrected / Linux CUPS `raw`).
|
2. **Stage 2 — Target Creation & Raw Printing (`printtarg`)**: Format patch targets for spectrophotometers (i1Pro, i1Pro2, ColorMunki, SpyderPrint). View high-resolution downscaled TIFF previews and print directly using native OS raw unmanaged pathways (Windows GDI uncorrected / Linux CUPS `raw`).
|
||||||
3. **Stage 3 — Interactive Measurement (`chartread`) & Averaging (`average`)**: Instrument auto-detection (`instlist`), real-time calibration prompts, interactive strip reading state machine, live swatch grid with CIEDE2000 ($\Delta E_{00}$) quality indicators and user-configurable traffic-light thresholds, diagonally split intended-vs-measured colour swatches, white reference patch preservation, and multi-pass sheet averaging for measurement noise reduction.
|
3. **Stage 3 — Interactive Measurement (`chartread`) & Averaging (`average`)**: Instrument auto-detection (`instlist`), real-time calibration prompts, interactive strip reading state machine, live swatch grid with CIEDE2000 ($\Delta E_{00}$) quality indicators and user-configurable traffic-light thresholds, diagonally split intended-vs-measured colour swatches, white reference patch preservation, and multi-pass sheet averaging for measurement noise reduction.
|
||||||
4. **Stage 4 — Profile Calculation (`colprof`)**: Generate high-precision cLUT mathematical ICC/ICM profiles with configurable algorithm quality, OBA/FWA compensation, illuminant/observer selection, viewing-condition transforms, custom ambient spectrum support, descriptions, and copyright tagging.
|
4. **Stage 4 — Profile Calculation (`colprof`)**: Generate high-precision cLUT mathematical ICC/ICM profiles with configurable algorithm quality, OBA/FWA compensation, illuminant/observer selection, viewing-condition transforms, custom ambient spectrum support, descriptions, and copyright tagging.
|
||||||
5. **Stage 5 — Verification & 3D Gamut (`profcheck` + `iccgamut`)**: Comprehensive mathematical validation report (Peak, Average, RMS $\Delta E$) paired with an interactive 3D CIELAB convex hull color volume viewer, touch controls, and bundled sRGB reference wireframe comparison.
|
5. **Stage 5 — Verification & 3D Gamut (`profcheck` + `iccgamut`)**: Comprehensive mathematical validation report (Peak, Average, RMS $\Delta E$) paired with an interactive 3D CIELAB convex hull color volume viewer, per-vertex true-colour rendering, layer opacity controls, camera reset, keyboard shortcut, touch controls, bundled sRGB reference wireframe comparison, and robust parsing of both JSON and legacy profcheck output formats.
|
||||||
- 📋 **Profiling Presets**: One-click configuration presets (Standard RGB Photo, High-Gamut CMYK Proofing, Fast RGB Draft) with custom preset export/import and security validation.
|
- 📋 **Profiling Presets**: One-click configuration presets (Standard RGB Photo, High-Gamut CMYK Proofing, Fast RGB Draft) with custom preset export/import and security validation.
|
||||||
- 🐧 **glibc Compatibility**: Pre-built Linux packages compiled with Ubuntu 22.04 LTS compatibility for Debian/Ubuntu environments.
|
- 🐧 **glibc Compatibility**: Pre-built Linux packages compiled with Ubuntu 22.04 LTS compatibility for Debian/Ubuntu environments.
|
||||||
- 🛡️ **Disk Artefact Gating**: Stepper navigation strictly verifies generated artefacts on disk (`.ti1`, `.ti2`, `.ti3`, `.icc`/`.icm`), preventing out-of-order execution while preserving backward navigation.
|
- 🛡️ **Disk Artefact Gating**: Stepper navigation strictly verifies generated artefacts on disk (`.ti1`, `.ti2`, `.ti3`, `.icc`/`.icm`), preventing out-of-order execution while preserving backward navigation.
|
||||||
|
|||||||
+2
-2
@@ -105,8 +105,8 @@ ICCery is a native, cross-platform desktop application built with:
|
|||||||
- [x] **Swatch Grid White Patch & Orientation Polish (#178)**: Finalise `is_pad` guard documentation, diagonally split swatch tooltips, and validate `printtarg` row/column ordering.
|
- [x] **Swatch Grid White Patch & Orientation Polish (#178)**: Finalise `is_pad` guard documentation, diagonally split swatch tooltips, and validate `printtarg` row/column ordering.
|
||||||
- [x] **Configurable CIEDE2000 Thresholds (#184)**: User-configurable good/warning ΔE₀₀ upper bounds in Settings, persisted across sessions and applied to the Stage 3 swatch grid.
|
- [x] **Configurable CIEDE2000 Thresholds (#184)**: User-configurable good/warning ΔE₀₀ upper bounds in Settings, persisted across sessions and applied to the Stage 3 swatch grid.
|
||||||
- [x] **Stage 4 OBA/FWA Tooltips & Tests (#176)**: Contextual help for OBA/FWA, illuminant, observer, and viewing-condition controls; additional `colprof` arg builder tests.
|
- [x] **Stage 4 OBA/FWA Tooltips & Tests (#176)**: Contextual help for OBA/FWA, illuminant, observer, and viewing-condition controls; additional `colprof` arg builder tests.
|
||||||
- [ ] **3D Gamut Viewer Controls (#185)**: Camera reset, opacity sliders, keyboard shortcut, and full public-API JSDoc.
|
- [x] **3D Gamut Viewer Controls (#185)**: Camera reset, opacity sliders, keyboard shortcut, and full public-API JSDoc.
|
||||||
- [ ] **Gamut / Profcheck Hardening (#179)**: Validate `.gam` vertex/face parsing, improved `profcheck` regex fallbacks for legacy text output, and user-visible parser warnings.
|
- [x] **Gamut / Profcheck Hardening (#179)**: Validate `.gam` vertex/face parsing, improved `profcheck` regex fallbacks for legacy text output, and user-visible parser warnings.
|
||||||
|
|
||||||
### Milestone 12 — Future Workflow & Advanced Analytics (Deferred)
|
### Milestone 12 — Future Workflow & Advanced Analytics (Deferred)
|
||||||
- [ ] **Batch Verification & Drift Tracking (#95)**: Track printer drift over time by comparing periodic verification measurements against a baseline profile.
|
- [ ] **Batch Verification & Drift Tracking (#95)**: Track printer drift over time by comparing periodic verification measurements against a baseline profile.
|
||||||
|
|||||||
Generated
+1
-1
@@ -1423,7 +1423,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iccery"
|
name = "iccery"
|
||||||
version = "0.7.4"
|
version = "0.8.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"image",
|
"image",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "iccery"
|
name = "iccery"
|
||||||
version = "0.7.4"
|
version = "0.8.0"
|
||||||
description = "Modern Printer Profiling UI frontend for ArgyllCMS"
|
description = "Modern Printer Profiling UI frontend for ArgyllCMS"
|
||||||
authors = ["Gordon"]
|
authors = ["Gordon"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "ICCery",
|
"productName": "ICCery",
|
||||||
"version": "0.7.4",
|
"version": "0.8.0",
|
||||||
"identifier": "com.gronod.iccery",
|
"identifier": "com.gronod.iccery",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../src"
|
"frontendDist": "../src"
|
||||||
|
|||||||
@@ -827,6 +827,10 @@
|
|||||||
<span class="gamut-toggle-slider"></span>
|
<span class="gamut-toggle-slider"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="gamut-legend-item gamut-slider-item">
|
||||||
|
<label for="rngProfileOpacity" class="gamut-slider-label">Opacity</label>
|
||||||
|
<input type="range" id="rngProfileOpacity" min="0.1" max="1" step="0.05" value="0.88">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="gamut-legend-item">
|
<div class="gamut-legend-item">
|
||||||
<span class="gamut-swatch gamut-swatch-srgb"></span>
|
<span class="gamut-swatch gamut-swatch-srgb"></span>
|
||||||
@@ -836,6 +840,10 @@
|
|||||||
<span class="gamut-toggle-slider"></span>
|
<span class="gamut-toggle-slider"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="gamut-legend-item gamut-slider-item">
|
||||||
|
<label for="rngSrgbOpacity" class="gamut-slider-label">Opacity</label>
|
||||||
|
<input type="range" id="rngSrgbOpacity" min="0.1" max="1" step="0.05" value="0.55">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="gamut-legend-item">
|
<div class="gamut-legend-item">
|
||||||
<span class="gamut-swatch gamut-swatch-axes"></span>
|
<span class="gamut-swatch gamut-swatch-axes"></span>
|
||||||
@@ -845,6 +853,15 @@
|
|||||||
<span class="gamut-toggle-slider"></span>
|
<span class="gamut-toggle-slider"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="gamut-legend-item gamut-slider-item">
|
||||||
|
<label for="rngAxisOpacity" class="gamut-slider-label">Opacity</label>
|
||||||
|
<input type="range" id="rngAxisOpacity" min="0.1" max="1" step="0.05" value="0.8">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="gamut-controls-actions">
|
||||||
|
<button type="button" id="btnGamutResetCamera" class="btn-sm" title="Reset camera to default view (R)">⟲ Reset View</button>
|
||||||
|
<span class="gamut-keyboard-hint">Press R to reset</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+174
-16
@@ -204,30 +204,80 @@ function _line(from, to, material) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
// Parse .gam file text → { vertices: [[L,a,b],...], faces: [[v0,v1,v2],...] }
|
/**
|
||||||
|
* Parse an Argyll `.gam` text file into vertex and face arrays.
|
||||||
|
*
|
||||||
|
* Argyll `.gam` files contain a header followed by one or more `BEGIN_DATA`
|
||||||
|
* ... `END_DATA` blocks. The first data block is a vertex list
|
||||||
|
* (index L a b); subsequent blocks contain triangle face indices (v0 v1 v2).
|
||||||
|
* Blank lines and hash `#` comments outside data blocks are ignored.
|
||||||
|
*
|
||||||
|
* @param {string} text - Raw contents of the .gam file.
|
||||||
|
* @returns {{ vertices: number[][], faces: number[][], warnings: string[] }}
|
||||||
|
*/
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
export function parseGamutFile(text) {
|
export function parseGamutFile(text) {
|
||||||
const lines = text.split('\n');
|
const lines = text.split('\n');
|
||||||
const vertices = [];
|
const vertices = [];
|
||||||
const faces = [];
|
const faces = [];
|
||||||
|
const warnings = [];
|
||||||
let dataStarted = false;
|
let dataStarted = false;
|
||||||
let dataBlock = 0; // 1 = vertices section, 2 = faces section
|
let dataBlock = 0; // 1 = vertices section, 2+ = faces sections
|
||||||
|
|
||||||
for (const line of lines) {
|
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
||||||
const trimmed = line.trim();
|
const raw = lines[lineIdx];
|
||||||
if (trimmed === 'BEGIN_DATA') { dataBlock++; dataStarted = true; continue; }
|
const trimmed = raw.replace(/#.*$/, '').trim(); // strip inline comments
|
||||||
if (trimmed === 'END_DATA') { dataStarted = false; continue; }
|
if (trimmed === '') continue;
|
||||||
|
|
||||||
|
if (trimmed.toUpperCase() === 'BEGIN_DATA') {
|
||||||
|
dataBlock++;
|
||||||
|
dataStarted = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (trimmed.toUpperCase() === 'END_DATA') {
|
||||||
|
dataStarted = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!dataStarted) continue;
|
if (!dataStarted) continue;
|
||||||
|
|
||||||
const parts = trimmed.split(/\s+/).map(Number);
|
const parts = trimmed.split(/\s+/).map(Number);
|
||||||
if (dataBlock === 1 && parts.length >= 4) {
|
const allNumeric = parts.every(n => !Number.isNaN(n));
|
||||||
vertices.push([parts[1], parts[2], parts[3]]); // [L, a, b]
|
if (!allNumeric) {
|
||||||
} else if (dataBlock === 2 && parts.length >= 3) {
|
warnings.push(`Skipping non-numeric data at line ${lineIdx + 1}`);
|
||||||
faces.push([parts[0], parts[1], parts[2]]);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataBlock === 1) {
|
||||||
|
if (parts.length >= 4) {
|
||||||
|
// Vertex format: index L a b (index is usually ignored)
|
||||||
|
const [_, L, a, b] = parts;
|
||||||
|
if (L < 0 || L > 100 || Math.abs(a) > 128 || Math.abs(b) > 128) {
|
||||||
|
warnings.push(`Vertex at line ${lineIdx + 1} is outside plausible CIELAB bounds: L=${L}, a=${a}, b=${b}`);
|
||||||
|
}
|
||||||
|
vertices.push([L, a, b]);
|
||||||
|
} else {
|
||||||
|
warnings.push(`Vertex data at line ${lineIdx + 1} has only ${parts.length} values`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Face data can appear in multiple blocks (some .gam files use a
|
||||||
|
// separate DATA block per surface type or per convex-hull section).
|
||||||
|
if (parts.length >= 3) {
|
||||||
|
faces.push([parts[0], parts[1], parts[2]]);
|
||||||
|
} else {
|
||||||
|
warnings.push(`Face data at line ${lineIdx + 1} has only ${parts.length} values`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { vertices, faces };
|
if (vertices.length > 0 && faces.length === 0) {
|
||||||
|
warnings.push(`Parsed ${vertices.length} vertices but no faces; will compute convex hull on the fly.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataBlock === 0) {
|
||||||
|
warnings.push('No BEGIN_DATA blocks found; file may be empty or not a valid Argyll .gam file.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return { vertices, faces, warnings };
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
@@ -304,7 +354,10 @@ function _renderSrgbReference(text, previousGroup) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const { vertices, faces } = parseGamutFile(text);
|
const { vertices, faces, warnings } = parseGamutFile(text);
|
||||||
|
if (warnings.length > 0) {
|
||||||
|
console.warn('Gamut parser warnings:', warnings.join('\n'));
|
||||||
|
}
|
||||||
const built = _buildGeometry(vertices, faces);
|
const built = _buildGeometry(vertices, faces);
|
||||||
if (!built) return null;
|
if (!built) return null;
|
||||||
|
|
||||||
@@ -348,7 +401,10 @@ function _renderProfileGamut(text, previousMesh) {
|
|||||||
if (previousMesh.material) previousMesh.material.dispose();
|
if (previousMesh.material) previousMesh.material.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
const { vertices, faces } = parseGamutFile(text);
|
const { vertices, faces, warnings } = parseGamutFile(text);
|
||||||
|
if (warnings.length > 0) {
|
||||||
|
console.warn('Gamut parser warnings:', warnings.join('\n'));
|
||||||
|
}
|
||||||
const built = _buildGeometry(vertices, faces);
|
const built = _buildGeometry(vertices, faces);
|
||||||
if (!built) return null;
|
if (!built) return null;
|
||||||
|
|
||||||
@@ -383,7 +439,77 @@ function _renderProfileGamut(text, previousMesh) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
// Public: load bundled sRGB reference gamut
|
// Camera & view controls
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
/**
|
||||||
|
* Reset the camera to its default home position and orientation.
|
||||||
|
* Also resets orbit controls target to the centre of the CIELAB volume.
|
||||||
|
*/
|
||||||
|
export function resetCamera() {
|
||||||
|
if (!camera || !controls) return;
|
||||||
|
camera.position.set(180, 120, 180);
|
||||||
|
camera.lookAt(0, 50, 0);
|
||||||
|
controls.target.set(0, 50, 0);
|
||||||
|
controls.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the opacity of the rendered profile gamut surface (0–1).
|
||||||
|
* @param {number} opacity
|
||||||
|
*/
|
||||||
|
export function setProfileOpacity(opacity) {
|
||||||
|
if (currentProfileMesh && currentProfileMesh.material) {
|
||||||
|
currentProfileMesh.material.opacity = Math.max(0, Math.min(1, opacity));
|
||||||
|
currentProfileMesh.material.transparent = opacity < 1;
|
||||||
|
currentProfileMesh.material.needsUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the opacity of the sRGB reference wireframe and fill (0–1).
|
||||||
|
* @param {number} opacity
|
||||||
|
*/
|
||||||
|
export function setSrgbReferenceOpacity(opacity) {
|
||||||
|
if (sRgbGroup) {
|
||||||
|
sRgbGroup.traverse((child) => {
|
||||||
|
if (child.material) {
|
||||||
|
child.material.opacity = child.material.opacity >= 0.5
|
||||||
|
? Math.max(0.05, Math.min(1, opacity))
|
||||||
|
: Math.max(0.02, Math.min(0.2, opacity * 0.2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the opacity of the CIELAB axis scaffold (0–1).
|
||||||
|
* @param {number} opacity
|
||||||
|
*/
|
||||||
|
export function setAxisOpacity(opacity) {
|
||||||
|
if (axisScaffoldGroup) {
|
||||||
|
axisScaffoldGroup.traverse((child) => {
|
||||||
|
if (child.material) {
|
||||||
|
child.material.opacity = Math.max(0, Math.min(1, opacity));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle keyboard shortcuts for the gamut viewer.
|
||||||
|
* @param {KeyboardEvent} e
|
||||||
|
*/
|
||||||
|
function _onKeyDown(e) {
|
||||||
|
if (e.key === 'r' || e.key === 'R') {
|
||||||
|
resetCamera();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
/**
|
||||||
|
* Load and render the bundled sRGB reference gamut.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
export async function loadSrgbReferenceGamut() {
|
export async function loadSrgbReferenceGamut() {
|
||||||
try {
|
try {
|
||||||
@@ -398,7 +524,11 @@ export async function loadSrgbReferenceGamut() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
// Public: load and render a profile gamut from a .gam file path
|
/**
|
||||||
|
* Load and render a profile gamut from a `.gam` file path.
|
||||||
|
* @param {string} gamFilePath - Absolute path to the gamut file.
|
||||||
|
* @returns {Promise<THREE.Mesh|null>}
|
||||||
|
*/
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
export async function loadGamutMesh(gamFilePath) {
|
export async function loadGamutMesh(gamFilePath) {
|
||||||
try {
|
try {
|
||||||
@@ -428,7 +558,7 @@ export function toggleAxes(visible) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
// Wire legend toggle checkboxes to the toggle functions
|
// Wire legend toggle checkboxes, opacity sliders, and reset button
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
function _wireToggles() {
|
function _wireToggles() {
|
||||||
const bindings = [
|
const bindings = [
|
||||||
@@ -440,4 +570,32 @@ function _wireToggles() {
|
|||||||
const el = document.getElementById(id);
|
const el = document.getElementById(id);
|
||||||
if (el) el.addEventListener('change', (e) => fn(e.target.checked));
|
if (el) el.addEventListener('change', (e) => fn(e.target.checked));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resetBtn = document.getElementById('btnGamutResetCamera');
|
||||||
|
if (resetBtn) resetBtn.addEventListener('click', resetCamera);
|
||||||
|
|
||||||
|
const profileOpacity = document.getElementById('rngProfileOpacity');
|
||||||
|
if (profileOpacity) {
|
||||||
|
profileOpacity.addEventListener('input', (e) => setProfileOpacity(parseFloat(e.target.value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const srgbOpacity = document.getElementById('rngSrgbOpacity');
|
||||||
|
if (srgbOpacity) {
|
||||||
|
srgbOpacity.addEventListener('input', (e) => setSrgbReferenceOpacity(parseFloat(e.target.value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const axisOpacity = document.getElementById('rngAxisOpacity');
|
||||||
|
if (axisOpacity) {
|
||||||
|
axisOpacity.addEventListener('input', (e) => setAxisOpacity(parseFloat(e.target.value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only listen for 'R' reset when the viewer tab is active.
|
||||||
|
const stage5 = document.getElementById('stage-5');
|
||||||
|
if (stage5) {
|
||||||
|
stage5.addEventListener('keydown', (e) => {
|
||||||
|
if ((e.key === 'r' || e.key === 'R') && !stage5.classList.contains('hidden')) {
|
||||||
|
resetCamera();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
// Manual / browser-console tests for gamut_viewer.js and profcheck.js parsing.
|
||||||
|
// Run in a browser/devtools console after the app has loaded:
|
||||||
|
// import('./gamut_viewer.test.js').then(m => m.runAll())
|
||||||
|
|
||||||
|
import { parseGamutFile } from './gamut_viewer.js';
|
||||||
|
|
||||||
|
export function runAll() {
|
||||||
|
console.group('gamut/profcheck parser tests');
|
||||||
|
testParseGamutBasic();
|
||||||
|
testParseGamutDualTable();
|
||||||
|
testParseGamutWithComments();
|
||||||
|
console.groupEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertEqual(actual, expected, message) {
|
||||||
|
const ok = JSON.stringify(actual) === JSON.stringify(expected);
|
||||||
|
if (ok) {
|
||||||
|
console.log('PASS:', message);
|
||||||
|
} else {
|
||||||
|
console.error('FAIL:', message, 'expected', expected, 'got', actual);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
function testParseGamutBasic() {
|
||||||
|
const text = `GAMUT file
|
||||||
|
BEGIN_DATA
|
||||||
|
0 50 0 0
|
||||||
|
1 100 0 0
|
||||||
|
2 0 -128 0
|
||||||
|
3 0 0 128
|
||||||
|
END_DATA
|
||||||
|
BEGIN_DATA
|
||||||
|
0 1 2
|
||||||
|
1 2 3
|
||||||
|
END_DATA`;
|
||||||
|
const { vertices, faces, warnings } = parseGamutFile(text);
|
||||||
|
assertEqual(vertices.length, 4, 'basic gamut vertex count');
|
||||||
|
assertEqual(faces.length, 2, 'basic gamut face count');
|
||||||
|
assertEqual(warnings.length, 0, 'basic gamut no warnings');
|
||||||
|
}
|
||||||
|
|
||||||
|
function testParseGamutDualTable() {
|
||||||
|
const text = `GAMUT file
|
||||||
|
BEGIN_DATA
|
||||||
|
0 50 0 0
|
||||||
|
1 100 0 0
|
||||||
|
2 0 -128 0
|
||||||
|
3 0 0 128
|
||||||
|
END_DATA
|
||||||
|
BEGIN_DATA
|
||||||
|
0 1 2
|
||||||
|
END_DATA
|
||||||
|
BEGIN_DATA
|
||||||
|
1 2 3
|
||||||
|
END_DATA`;
|
||||||
|
const { vertices, faces, warnings } = parseGamutFile(text);
|
||||||
|
assertEqual(vertices.length, 4, 'dual-table gamut vertex count');
|
||||||
|
assertEqual(faces.length, 2, 'dual-table gamut face count');
|
||||||
|
assertEqual(warnings.length, 0, 'dual-table gamut no warnings');
|
||||||
|
}
|
||||||
|
|
||||||
|
function testParseGamutWithComments() {
|
||||||
|
const text = `GAMUT file
|
||||||
|
# this is a comment
|
||||||
|
BEGIN_DATA
|
||||||
|
0 50 0 0
|
||||||
|
1 100 0 0
|
||||||
|
# inline comment
|
||||||
|
2 0 -128 0
|
||||||
|
3 0 0 128
|
||||||
|
END_DATA
|
||||||
|
BEGIN_DATA
|
||||||
|
0 1 2
|
||||||
|
1 2 3
|
||||||
|
END_DATA`;
|
||||||
|
const { vertices, faces, warnings } = parseGamutFile(text);
|
||||||
|
assertEqual(vertices.length, 4, 'commented gamut vertex count');
|
||||||
|
assertEqual(faces.length, 2, 'commented gamut face count');
|
||||||
|
}
|
||||||
+76
-13
@@ -98,7 +98,14 @@ export function initProfcheck() {
|
|||||||
|
|
||||||
// Ensure gamut mesh is loaded into 3D viewer
|
// Ensure gamut mesh is loaded into 3D viewer
|
||||||
const gamFilePath = cwd ? `${cwd}${sep}${basename}.gam` : `${basename}.gam`;
|
const gamFilePath = cwd ? `${cwd}${sep}${basename}.gam` : `${basename}.gam`;
|
||||||
loadGamutMesh(gamFilePath, 0x3b82f6);
|
try {
|
||||||
|
const result = await loadGamutMesh(gamFilePath);
|
||||||
|
if (!result) {
|
||||||
|
logPre.textContent += `\n[WARN] Could not render 3D gamut mesh from ${gamFilePath}.\n`;
|
||||||
|
}
|
||||||
|
} catch (gamErr) {
|
||||||
|
logPre.textContent += `\n[WARN] 3D gamut render failed: ${gamErr}\n`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logPre.textContent += `\n[ERROR] profcheck exited with code ${event.payload.code}.\n`;
|
logPre.textContent += `\n[ERROR] profcheck exited with code ${event.payload.code}.\n`;
|
||||||
}
|
}
|
||||||
@@ -113,33 +120,89 @@ export function initProfcheck() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse profcheck output for Average, Peak, and RMS delta-E values.
|
||||||
|
* Supports both Argyll's JSON-style summary and plain-text legacy output.
|
||||||
|
* @param {string} stdout - Full profcheck stdout.
|
||||||
|
*/
|
||||||
function parseAndRenderReport(stdout) {
|
function parseAndRenderReport(stdout) {
|
||||||
reportCard.classList.remove("hidden");
|
reportCard.classList.remove("hidden");
|
||||||
|
|
||||||
let avgDe = 0.0;
|
let avgDe = 0.0;
|
||||||
let maxDe = 0.0;
|
let maxDe = 0.0;
|
||||||
let rmsDe = 0.0;
|
let rmsDe = 0.0;
|
||||||
|
let parserWarnings = [];
|
||||||
|
|
||||||
// Check if JSON output is present
|
// Argyll's JSON output can appear either as a compact object on a single
|
||||||
const jsonMatch = stdout.match(/\{[\s\S]*"avg_de"[\s\S]*\}/);
|
// line or embedded inside larger text. Try to find and parse the LAST valid
|
||||||
if (jsonMatch) {
|
// JSON object in the output, which is most likely the summary.
|
||||||
|
const jsonObjects = [];
|
||||||
|
const re = /\{[\s\S]*?\}/g;
|
||||||
|
let m;
|
||||||
|
while ((m = re.exec(stdout)) !== null) {
|
||||||
try {
|
try {
|
||||||
const json = JSON.parse(jsonMatch[0]);
|
const parsed = JSON.parse(m[0]);
|
||||||
avgDe = json.avg_de || 0;
|
if (typeof parsed === 'object' && parsed !== null && ('avg_de' in parsed || 'peak_de' in parsed || 'rms_de' in parsed)) {
|
||||||
maxDe = json.max_de || json.peak_de || 0;
|
jsonObjects.push(parsed);
|
||||||
rmsDe = json.rms_de || 0;
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("JSON parse error:", e);
|
// Not a valid JSON object, ignore.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonObjects.length > 0) {
|
||||||
|
const json = jsonObjects[jsonObjects.length - 1];
|
||||||
|
avgDe = typeof json.avg_de === 'number' ? json.avg_de : 0;
|
||||||
|
maxDe = typeof json.max_de === 'number' ? json.max_de : (typeof json.peak_de === 'number' ? json.peak_de : 0);
|
||||||
|
rmsDe = typeof json.rms_de === 'number' ? json.rms_de : 0;
|
||||||
} else {
|
} else {
|
||||||
// Regex fallbacks for standard profcheck output
|
// Regex fallbacks for standard profcheck text output
|
||||||
const avgMatch = stdout.match(/avg\.\s*(?:dE\s*)?=\s*([\d\.]+)/i) || stdout.match(/average\s*(?:dE\s*)?[:=]\s*([\d\.]+)/i);
|
const avgPatterns = [
|
||||||
const maxMatch = stdout.match(/max\.\s*(?:dE\s*)?=\s*([\d\.]+)/i) || stdout.match(/peak\s*(?:dE\s*)?[:=]\s*([\d\.]+)/i);
|
/avg(?:\.?|erage)\s*(?:dE\s*)?[:=]\s*([\d\.]+)/i,
|
||||||
const rmsMatch = stdout.match(/RMS\s*(?:dE\s*)?=\s*([\d\.]+)/i) || stdout.match(/rms\s*(?:dE\s*)?[:=]\s*([\d\.]+)/i);
|
/average\s+(?:dE\s*)?([\d\.]+)/i,
|
||||||
|
/mean\s+(?:dE\s*)?([\d\.]+)/i,
|
||||||
|
/dE\s+average[^\d]*([\d\.]+)/i,
|
||||||
|
];
|
||||||
|
const maxPatterns = [
|
||||||
|
/max(?:\.?|imum)\s*(?:dE\s*)?[:=]\s*([\d\.]+)/i,
|
||||||
|
/peak\s*(?:dE\s*)?[:=]\s*([\d\.]+)/i,
|
||||||
|
/worst\s*(?:dE\s*)?([\d\.]+)/i,
|
||||||
|
/dE\s+max[^\d]*([\d\.]+)/i,
|
||||||
|
];
|
||||||
|
const rmsPatterns = [
|
||||||
|
/RMS\s*(?:dE\s*)?[:=]\s*([\d\.]+)/i,
|
||||||
|
/rms\s*(?:dE\s*)?([\d\.]+)/i,
|
||||||
|
/root\s+mean\s+sq(?:uare)?\s*(?:dE\s*)?([\d\.]+)/i,
|
||||||
|
];
|
||||||
|
|
||||||
|
const find = (patterns) => {
|
||||||
|
for (const p of patterns) {
|
||||||
|
const match = stdout.match(p);
|
||||||
|
if (match) return match;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const avgMatch = find(avgPatterns);
|
||||||
|
const maxMatch = find(maxPatterns);
|
||||||
|
const rmsMatch = find(rmsPatterns);
|
||||||
|
|
||||||
if (avgMatch) avgDe = parseFloat(avgMatch[1]);
|
if (avgMatch) avgDe = parseFloat(avgMatch[1]);
|
||||||
|
else parserWarnings.push('Could not detect Average ΔE in profcheck output.');
|
||||||
|
|
||||||
if (maxMatch) maxDe = parseFloat(maxMatch[1]);
|
if (maxMatch) maxDe = parseFloat(maxMatch[1]);
|
||||||
|
else parserWarnings.push('Could not detect Peak ΔE in profcheck output.');
|
||||||
|
|
||||||
if (rmsMatch) rmsDe = parseFloat(rmsMatch[1]);
|
if (rmsMatch) rmsDe = parseFloat(rmsMatch[1]);
|
||||||
|
else parserWarnings.push('Could not detect RMS ΔE in profcheck output.');
|
||||||
|
|
||||||
|
if (!avgMatch && !maxMatch && !rmsMatch) {
|
||||||
|
parserWarnings.push('No delta-E values were found in profcheck output.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parserWarnings.length > 0) {
|
||||||
|
logPre.textContent += `\n[WARN] ${parserWarnings.join(' ')}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
avgDeEl.textContent = avgDe.toFixed(2);
|
avgDeEl.textContent = avgDe.toFixed(2);
|
||||||
|
|||||||
@@ -1530,6 +1530,43 @@ button.danger:hover {
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gamut-legend-item.gamut-slider-item {
|
||||||
|
margin: -2px 0 8px 27px;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gamut-slider-label {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
opacity: 0.65;
|
||||||
|
min-width: 46px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gamut-slider-item input[type="range"] {
|
||||||
|
flex: 1;
|
||||||
|
margin: 0;
|
||||||
|
height: 4px;
|
||||||
|
accent-color: var(--accent-color, #3b82f6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gamut-controls-actions {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding-top: 10px;
|
||||||
|
border-top: 1px solid rgba(255, 255, 255, 0.09);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gamut-controls-actions button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gamut-keyboard-hint {
|
||||||
|
font-size: 0.68rem;
|
||||||
|
opacity: 0.5;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.gamut-legend-label {
|
.gamut-legend-label {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|||||||
Reference in New Issue
Block a user