#pragma once #include "Document/Curves.h" #include #include #include // Swift's CameraRawColor.swift: Curve, Color Mixer, Color Grading. enum class CameraRawCurvePage { parametric, point }; enum class CameraRawPointChannel { rgb, red, green, blue }; enum class CameraRawMixerPage { hsl, color, point }; enum class CameraRawMixerTab { hue, saturation, luminance }; enum class CameraRawGradePage { threeWay, shadows, midtones, highlights, global }; // Parametric regions and point curves, points 0 to 1. struct CameraRawCurveSettings { double shadows = 0; double darks = 0; double lights = 0; double highlights = 0; // Dividers, 0 to 100: where each region hands off. double shadowSplit = 25; double darkSplit = 50; double lightSplit = 75; std::vector rgb = linear(); std::vector red = linear(); std::vector green = linear(); std::vector blue = linear(); // How far the composite curve moves saturation too. double refineSaturation = 0; static std::vector linear(); static std::vector mediumContrast(); static std::vector strongContrast(); static bool isLinear(const std::vector &points); bool adjusts() const; // Lifts or lowers the region a tone belongs to. double parametric(double tone) const; std::vector lumaTable() const; std::vector channelTable(const std::vector &points) const; CameraRawCurveSettings nudged(CameraRawPointChannel channel, double tone, double delta) const; // Swift's region(for:): the parametric amount a tone moves. double ®ion(double tone); CameraRawCurveSettings normalized() const; friend bool operator==(const CameraRawCurveSettings &, const CameraRawCurveSettings &) = default; }; // One picked colour and how far its adjustment reaches. struct CameraRawPointColor { double hue = 0; double saturation = 0; double luminance = 0; double hueShift = 0; double saturationShift = 0; double luminanceShift = 0; double hueRange = 30; double saturationRange = 0.4; double luminanceRange = 0.4; bool visualize = false; CameraRawPointColor normalized() const; friend bool operator==(const CameraRawPointColor &, const CameraRawPointColor &) = default; }; // Eight colour families, each hue, saturation, luminance −100 to 100. struct CameraRawMixerSettings { static const std::array names; static constexpr std::array centers{0, 30, 60, 120, 180, 240, 270, 300}; std::array hue{}; std::array saturation{}; std::array luminance{}; std::vector points{}; bool adjusts() const; // How much each family shares a hue; neighbours overlap. static std::array weights(double degrees); std::vector mixerFloats() const; std::vector pointFloats() const; CameraRawMixerSettings normalized() const; friend bool operator==(const CameraRawMixerSettings &, const CameraRawMixerSettings &) = default; }; struct CameraRawGradeWheel { double hue = 0; double saturation = 0; double luminance = 0; CameraRawGradeWheel normalized() const; friend bool operator==(const CameraRawGradeWheel &, const CameraRawGradeWheel &) = default; }; // Four wheels, their overlap and which end they favour. struct CameraRawGradingSettings { CameraRawGradeWheel shadows; CameraRawGradeWheel midtones; CameraRawGradeWheel highlights; CameraRawGradeWheel global; // 0 to 100: more lets the tonal wheels overlap. double blending = 50; // −100 to 100: negative favours shadows, positive highlights. double balance = 0; std::array wheels() const; bool adjusts() const; std::vector gradeFloats() const; CameraRawGradingSettings normalized() const; friend bool operator==(const CameraRawGradingSettings &, const CameraRawGradingSettings &) = default; };