Matt Sarett | 8e04286 | 2016-12-19 09:43:30 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Hal Canary | 6b20a55 | 2017-02-07 14:09:38 -0500 | [diff] [blame] | 8 | #ifndef SkICCPriv_DEFINED |
| 9 | #define SkICCPriv_DEFINED |
| 10 | |
Hal Canary | 466c7d6 | 2017-07-03 15:11:49 -0400 | [diff] [blame] | 11 | #include "SkColorSpace.h" |
Hal Canary | 6b20a55 | 2017-02-07 14:09:38 -0500 | [diff] [blame] | 12 | #include "SkTypes.h" |
| 13 | |
Matt Sarett | 8e04286 | 2016-12-19 09:43:30 -0500 | [diff] [blame] | 14 | // This is equal to the header size according to the ICC specification (128) |
| 15 | // plus the size of the tag count (4). We include the tag count since we |
| 16 | // always require it to be present anyway. |
| 17 | static constexpr size_t kICCHeaderSize = 132; |
| 18 | |
| 19 | // Contains a signature (4), offset (4), and size (4). |
| 20 | static constexpr size_t kICCTagTableEntrySize = 12; |
| 21 | |
| 22 | static constexpr uint32_t kRGB_ColorSpace = SkSetFourByteTag('R', 'G', 'B', ' '); |
| 23 | static constexpr uint32_t kCMYK_ColorSpace = SkSetFourByteTag('C', 'M', 'Y', 'K'); |
| 24 | static constexpr uint32_t kGray_ColorSpace = SkSetFourByteTag('G', 'R', 'A', 'Y'); |
| 25 | static constexpr uint32_t kDisplay_Profile = SkSetFourByteTag('m', 'n', 't', 'r'); |
| 26 | static constexpr uint32_t kInput_Profile = SkSetFourByteTag('s', 'c', 'n', 'r'); |
| 27 | static constexpr uint32_t kOutput_Profile = SkSetFourByteTag('p', 'r', 't', 'r'); |
| 28 | static constexpr uint32_t kColorSpace_Profile = SkSetFourByteTag('s', 'p', 'a', 'c'); |
| 29 | static constexpr uint32_t kXYZ_PCSSpace = SkSetFourByteTag('X', 'Y', 'Z', ' '); |
| 30 | static constexpr uint32_t kLAB_PCSSpace = SkSetFourByteTag('L', 'a', 'b', ' '); |
| 31 | static constexpr uint32_t kACSP_Signature = SkSetFourByteTag('a', 'c', 's', 'p'); |
| 32 | |
| 33 | static constexpr uint32_t kTAG_rXYZ = SkSetFourByteTag('r', 'X', 'Y', 'Z'); |
| 34 | static constexpr uint32_t kTAG_gXYZ = SkSetFourByteTag('g', 'X', 'Y', 'Z'); |
| 35 | static constexpr uint32_t kTAG_bXYZ = SkSetFourByteTag('b', 'X', 'Y', 'Z'); |
| 36 | static constexpr uint32_t kTAG_rTRC = SkSetFourByteTag('r', 'T', 'R', 'C'); |
| 37 | static constexpr uint32_t kTAG_gTRC = SkSetFourByteTag('g', 'T', 'R', 'C'); |
| 38 | static constexpr uint32_t kTAG_bTRC = SkSetFourByteTag('b', 'T', 'R', 'C'); |
| 39 | static constexpr uint32_t kTAG_kTRC = SkSetFourByteTag('k', 'T', 'R', 'C'); |
| 40 | static constexpr uint32_t kTAG_A2B0 = SkSetFourByteTag('A', '2', 'B', '0'); |
| 41 | |
| 42 | static constexpr uint32_t kTAG_CurveType = SkSetFourByteTag('c', 'u', 'r', 'v'); |
| 43 | static constexpr uint32_t kTAG_ParaCurveType = SkSetFourByteTag('p', 'a', 'r', 'a'); |
Matt Sarett | 1bfcf88 | 2016-12-19 18:37:34 -0500 | [diff] [blame] | 44 | static constexpr uint32_t kTAG_TextType = SkSetFourByteTag('m', 'l', 'u', 'c'); |
| 45 | |
| 46 | enum ParaCurveType { |
| 47 | kExponential_ParaCurveType = 0, |
| 48 | kGAB_ParaCurveType = 1, |
| 49 | kGABC_ParaCurveType = 2, |
| 50 | kGABDE_ParaCurveType = 3, |
| 51 | kGABCDEF_ParaCurveType = 4, |
| 52 | }; |
Hal Canary | 7a808d6 | 2017-06-16 13:38:34 -0400 | [diff] [blame] | 53 | |
| 54 | /* |
Hal Canary | a8565e5 | 2017-06-19 12:43:28 -0400 | [diff] [blame] | 55 | * Given fn and toXYZD50, generate a decription tag that either includes a hash |
| 56 | * of the function and gamut or is a special name. |
| 57 | * Exposed for unit testing and tools. |
Hal Canary | 7a808d6 | 2017-06-16 13:38:34 -0400 | [diff] [blame] | 58 | */ |
Hal Canary | a8565e5 | 2017-06-19 12:43:28 -0400 | [diff] [blame] | 59 | SkString SkICCGetColorProfileTag(const SkColorSpaceTransferFn& fn, |
| 60 | const SkMatrix44& toXYZD50); |
Hal Canary | 6b20a55 | 2017-02-07 14:09:38 -0500 | [diff] [blame] | 61 | #endif // SkICCPriv_DEFINED |