Skip to content

Add contrib/colour header-only colour-conversion library (#158)#244

Open
garyo wants to merge 1 commit into
mainfrom
feature/colour-convert-158
Open

Add contrib/colour header-only colour-conversion library (#158)#244
garyo wants to merge 1 commit into
mainfrom
feature/colour-convert-158

Conversation

@garyo

@garyo garyo commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Part of the Colour Managed Color Parameter work (#158). Companion to #245 (the kOfxParamPropColourManagement spec change).

What

Adds contrib/colour/ofxColourConvert.h: a small, dependency-free, header-only C++17 library that converts RGB triplets between the OFX native colourspaces and ACES2065-1, for plug-in and host authors who want exact conversions without taking on a full OpenColorIO dependency. It is not a replacement for OCIO — display rendering and the display-referred / ADX / "basic" spaces are out of scope.

This is the conversion helper referenced by #245: a plug-in that declares a parameter kOfxParamColourManagementManaged receives its values in ACES2065-1, and can use this library to convert them to or from whatever working space it needs.

Every supported space reduces to code value --(transfer function)--> linear RGB --(3x3 matrix)--> AP0 and back; gamut matrices are derived at compile time (NPM + von Kries adaptation) to match the OCIO ACES config the OFX native colourspaces are based on.

Layout & integration

  • contrib/colour/ofxColourConvert.h — the library, with a README.
  • contrib/colour/tests/ — validation suite comparing every supported colourspace against OpenColorIO in both directions, plus round-trip and name-lookup checks.
  • CMake/Conan package only the header: an INTERFACE target OpenFX::ColourConvert that installs it, plus a ColourConvert Conan component. No test dependencies leak into the core package.
  • CI release tarball ships the header under openfx/contrib/colour/.
  • Tests are pcons-driven (pcons fetches OpenColorIO + GoogleTest via Conan), gated behind OFX_BUILD_COLOUR_TESTS (default OFF). When on, a CTest fixture delegates to uvx pcons, so ctest runs them with zero install and no impact on the main build.

Validation

  • Header compiles clean under -Wall -Wextra; all 39 colourspaces round-trip to 1e-9.
  • Full Conan→CMake→CTest path: 77/77 gtest cases pass, 0 skipped (every space compared against OCIO in both directions).
  • OpenFX::ColourConvert links from a consumer; cmake --install and the CI tarball both place the header.

🤖 Generated with Claude Code

Add ofxColourConvert.h, a small, dependency-free, header-only C++17
library that converts RGB triplets between the OFX native colourspaces
and ACES2065-1, for plug-in and host authors who want exact conversions
without a full OpenColorIO dependency. It is not a replacement for OCIO:
display rendering and the display-referred/ADX/basic spaces are out of
scope.

Layout and integration:

- contrib/colour/ofxColourConvert.h - the library, with README.
- contrib/colour/tests/ - validation suite comparing every supported
  colourspace against OpenColorIO in both directions, plus round-trip
  and name-lookup checks.
- An INTERFACE target OpenFX::ColourConvert exposes the header to in-tree
  consumers, plus a ColourConvert Conan component. The header is
  distributed via the Conan package and the CI release tarball (under
  openfx/contrib/colour/), matching the other OFX headers; it is not
  CMake-installed (the install target only installs example plugins).
- The tests are built and run by pcons (which fetches OpenColorIO and
  GoogleTest via Conan). They are gated behind OFX_BUILD_COLOUR_TESTS
  (default OFF); when on, a CTest fixture delegates to pcons via uvx, so
  `ctest` runs them with zero install and no impact on the main build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
@garyo garyo force-pushed the feature/colour-convert-158 branch from aefcff8 to 911a493 Compare June 18, 2026 21:07
@garyo

garyo commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

I should note that most of this code was co-written with Claude Opus 4.8 and reviewed by me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant