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