// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SKIA_EXT_SKCOLORSPACE_PRIMARIES_H_ #define SKIA_EXT_SKCOLORSPACE_PRIMARIES_H_ #include "third_party/skia/include/core/SkColorSpace.h" #include <string> // TODO(https://crbug.com/skia/13721): Add these operators to Skia source. SK_API bool operator==(const SkColorSpacePrimaries& a, const SkColorSpacePrimaries& b); SK_API bool operator!=(const SkColorSpacePrimaries& a, const SkColorSpacePrimaries& b); namespace skia { // Display SkColorSpacePrimaries as a string. SK_API std::string SkColorSpacePrimariesToString( const SkColorSpacePrimaries& primaries); // Given a matrix that transforms to XYZD50, compute the primaries with a D65 // white point that would produce this matrix. SK_API SkColorSpacePrimaries GetD65PrimariesFromToXYZD50Matrix(const skcms_Matrix3x3& m); } // namespace skia namespace SkNamedPrimariesExt { //////////////////////////////////////////////////////////////////////////////// // Color primaries defined by ITU-T H.273, table 2. Names are given by the first // specification referenced in the value's row. // Rec. ITU-R BT.709-6, value 1. static constexpr SkColorSpacePrimaries kRec709 = …; // Rec. ITU-R BT.470-6 System M (historical), value 4. static constexpr SkColorSpacePrimaries kRec470SystemM = …; // Rec. ITU-R BT.470-6 System B, G (historical), value 5. static constexpr SkColorSpacePrimaries kRec470SystemBG = …; // Rec. ITU-R BT.601-7 525, value 6. static constexpr SkColorSpacePrimaries kRec601 = …; // SMPTE ST 240, value 7 (functionally the same as value 6). static constexpr SkColorSpacePrimaries kSMPTE_ST_240 = …; // Generic film (colour filters using Illuminant C), value 8. static constexpr SkColorSpacePrimaries kGenericFilm = …; // Rec. ITU-R BT.2020-2, value 9. static constexpr SkColorSpacePrimaries kRec2020{ … }; // SMPTE ST 428-1, value 10. static constexpr SkColorSpacePrimaries kSMPTE_ST_428_1 = …; // SMPTE RP 431-2, value 11. static constexpr SkColorSpacePrimaries kSMPTE_RP_431_2 = …; // SMPTE EG 432-1, value 12. static constexpr SkColorSpacePrimaries kSMPTE_EG_432_1 = …; // No corresponding industry specification identified, value 22. // This is sometimes referred to as EBU 3213-E, but that document doesn't // specify these values. static constexpr SkColorSpacePrimaries kITU_T_H273_Value22 = …; //////////////////////////////////////////////////////////////////////////////// // CSS Color Level 4 predefined and xyz color spaces. // 'srgb' static constexpr SkColorSpacePrimaries kSRGB = …; // 'display-p3' (and also 'p3' as a color gamut). static constexpr SkColorSpacePrimaries kP3 = …; // 'a98-rgb' static constexpr SkColorSpacePrimaries kA98RGB = …; // 'prophoto-rgb' static constexpr SkColorSpacePrimaries kProPhotoRGB = …; // 'rec2020' (as both a predefined color space and color gamut). // The value kRec2020 is already defined above. // 'xyzd50' static constexpr SkColorSpacePrimaries kXYZD50 = …; // 'xyz' and 'xyzd65' static constexpr SkColorSpacePrimaries kXYZD65 = …; //////////////////////////////////////////////////////////////////////////////// // Additional helper color primaries. // Invalid primaries, initialized to zero. static constexpr SkColorSpacePrimaries kInvalid = …; // The GenericRGB space on macOS. static constexpr SkColorSpacePrimaries kAppleGenericRGB = …; // Primaries where the colors are rotated and the gamut is huge. Good for // testing. static constexpr SkColorSpacePrimaries kWideGamutColorSpin = …; } // namespace SkNamedPrimariesExt #endif // SKIA_EXT_SKCOLORSPACE_PRIMARIES_H_