import _ from 'lodash';
import '../../../globals.js';
// Copyright 2023-2024, University of Colorado Boulder
/**
 * Enumeration of color spaces we'll want to convert from/to
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { alpenglow, RenderColor, RenderLinearDisplayP3ToLinearSRGB, RenderLinearSRGBToLinearDisplayP3, RenderLinearSRGBToOklab, RenderLinearSRGBToSRGB, RenderOklabToLinearSRGB, RenderSRGBToLinearSRGB } from '../imports.js';
class RenderColorSpace {
    constructor(name, isPremultiplied, isLinear, toLinear, fromLinear, linearToLinearSRGB, linearSRGBToLinear, toLinearRenderProgram, fromLinearRenderProgram, linearToLinearSRGBRenderProgram, linearSRGBToLinearRenderProgram) {
        this.name = name;
        this.isPremultiplied = isPremultiplied;
        this.isLinear = isLinear;
        this.toLinear = toLinear;
        this.fromLinear = fromLinear;
        this.linearToLinearSRGB = linearToLinearSRGB;
        this.linearSRGBToLinear = linearSRGBToLinear;
        this.toLinearRenderProgram = toLinearRenderProgram;
        this.fromLinearRenderProgram = fromLinearRenderProgram;
        this.linearToLinearSRGBRenderProgram = linearToLinearSRGBRenderProgram;
        this.linearSRGBToLinearRenderProgram = linearSRGBToLinearRenderProgram;
    }
}
// TODO: better patterns for conversions
// TODO: remove this or fully support it
RenderColorSpace.XYZ = new RenderColorSpace('XYZ', false, true, _.identity, _.identity, RenderColor.xyzToLinear, RenderColor.linearToXYZ);
// TODO: remove this or fully support it
RenderColorSpace.xyY = new RenderColorSpace('xyY', false, false);
RenderColorSpace.sRGB = new RenderColorSpace('srgb', false, false, RenderColor.sRGBToLinear, RenderColor.linearToSRGB, _.identity, _.identity, renderProgram => new RenderSRGBToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToSRGB(renderProgram), _.identity, _.identity);
RenderColorSpace.premultipliedSRGB = new RenderColorSpace('srgb', true, false, RenderColor.sRGBToLinear, RenderColor.linearToSRGB, _.identity, _.identity, renderProgram => new RenderSRGBToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToSRGB(renderProgram), _.identity, _.identity);
RenderColorSpace.linearSRGB = new RenderColorSpace('srgb', false, true, RenderColor.sRGBToLinear, RenderColor.linearToSRGB, _.identity, _.identity, renderProgram => new RenderSRGBToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToSRGB(renderProgram), _.identity, _.identity);
RenderColorSpace.premultipliedLinearSRGB = new RenderColorSpace('srgb', true, true, RenderColor.sRGBToLinear, RenderColor.linearToSRGB, _.identity, _.identity, renderProgram => new RenderSRGBToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToSRGB(renderProgram), _.identity, _.identity);
RenderColorSpace.displayP3 = new RenderColorSpace('display-p3', false, false, RenderColor.displayP3ToLinearDisplayP3, RenderColor.linearDisplayP3ToDisplayP3, RenderColor.sRGBToLinear, RenderColor.linearToSRGB, renderProgram => new RenderSRGBToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToSRGB(renderProgram), renderProgram => new RenderLinearDisplayP3ToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToLinearDisplayP3(renderProgram));
RenderColorSpace.premultipliedDisplayP3 = new RenderColorSpace('display-p3', true, false, RenderColor.displayP3ToLinearDisplayP3, RenderColor.linearDisplayP3ToDisplayP3, RenderColor.sRGBToLinear, RenderColor.linearToSRGB, renderProgram => new RenderSRGBToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToSRGB(renderProgram), renderProgram => new RenderLinearDisplayP3ToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToLinearDisplayP3(renderProgram));
RenderColorSpace.linearDisplayP3 = new RenderColorSpace('display-p3', false, true, RenderColor.displayP3ToLinearDisplayP3, RenderColor.linearDisplayP3ToDisplayP3, RenderColor.sRGBToLinear, RenderColor.linearToSRGB, renderProgram => new RenderSRGBToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToSRGB(renderProgram), renderProgram => new RenderLinearDisplayP3ToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToLinearDisplayP3(renderProgram));
RenderColorSpace.premultipliedLinearDisplayP3 = new RenderColorSpace('display-p3', true, true, RenderColor.displayP3ToLinearDisplayP3, RenderColor.linearDisplayP3ToDisplayP3, RenderColor.sRGBToLinear, RenderColor.linearToSRGB, renderProgram => new RenderSRGBToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToSRGB(renderProgram), renderProgram => new RenderLinearDisplayP3ToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToLinearDisplayP3(renderProgram));
RenderColorSpace.oklab = new RenderColorSpace('oklab', false, false, 
// TODO: hmmm, we don't really have the "linear oklab" concept here
RenderColor.oklabToLinear, RenderColor.linearToOklab, _.identity, _.identity, renderProgram => new RenderOklabToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToOklab(renderProgram), _.identity, _.identity);
RenderColorSpace.premultipliedOklab = new RenderColorSpace('oklab', true, false, 
// TODO: hmmm, we don't really have the "linear oklab" concept here
RenderColor.oklabToLinear, RenderColor.linearToOklab, _.identity, _.identity, renderProgram => new RenderOklabToLinearSRGB(renderProgram), renderProgram => new RenderLinearSRGBToOklab(renderProgram), _.identity, _.identity);
export default RenderColorSpace;
alpenglow.register('RenderColorSpace', RenderColorSpace);
//# sourceMappingURL=RenderColorSpace.js.map