xref: /aosp_15_r20/external/skia/include/encode/SkICC.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 
8 #ifndef SkICC_DEFINED
9 #define SkICC_DEFINED
10 
11 #include "include/core/SkRefCnt.h"
12 #include "include/private/base/SkAPI.h"
13 
14 #include <cstdint>
15 
16 class SkData;
17 struct skcms_ICCProfile;
18 struct skcms_Matrix3x3;
19 struct skcms_TransferFunction;
20 
21 SK_API sk_sp<SkData> SkWriteICCProfile(const skcms_TransferFunction&,
22                                        const skcms_Matrix3x3& toXYZD50);
23 
24 SK_API sk_sp<SkData> SkWriteICCProfile(const skcms_ICCProfile*, const char* description);
25 
26 // Utility function for populating the grid_16 member of skcms_A2B and skcms_B2A
27 // structures. This converts a point in XYZD50 to its representation in grid_16_lab.
28 // It will write 6 bytes. The behavior of this function matches how skcms will decode
29 // values, but might not match the specification, see https://crbug.com/skia/13807.
30 SK_API void SkICCFloatXYZD50ToGrid16Lab(const float* float_xyz, uint8_t* grid16_lab);
31 
32 // Utility function for popluating the table_16 member of skcms_Curve structure.
33 // This converts a float to its representation in table_16. It will write 2 bytes.
34 SK_API void SkICCFloatToTable16(const float f, uint8_t* table_16);
35 
36 #endif//SkICC_DEFINED
37