Flutter Engine
The Flutter Engine
Functions
SkNDKConversions Namespace Reference

Functions

AndroidBitmapFormat toAndroidBitmapFormat (SkColorType colorType)
 
SkColorType toColorType (AndroidBitmapFormat format)
 
ADataSpace toDataSpace (SkColorSpace *cs)
 
sk_sp< SkColorSpacetoColorSpace (ADataSpace dataSpace)
 

Function Documentation

◆ toAndroidBitmapFormat()

AndroidBitmapFormat SkNDKConversions::toAndroidBitmapFormat ( SkColorType  colorType)

Definition at line 25 of file SkNDKConversions.cpp.

25 {
26 for (const auto& entry : gColorTypeTable) {
27 if (entry.colorType == colorType) {
28 return entry.format;
29 }
30 }
31 return ANDROID_BITMAP_FORMAT_NONE;
32 }
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)

◆ toColorSpace()

sk_sp< SkColorSpace > SkNDKConversions::toColorSpace ( ADataSpace  dataSpace)

Definition at line 110 of file SkNDKConversions.cpp.

110 {
111 for (const auto& entry : gColorSpaceTable) {
112 if (entry.dataSpace == dataSpace) {
113 return SkColorSpace::MakeRGB(entry.transferFunction, entry.gamut);
114 }
115 }
116 return nullptr;
117 }
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)

◆ toColorType()

SkColorType SkNDKConversions::toColorType ( AndroidBitmapFormat  format)

Definition at line 34 of file SkNDKConversions.cpp.

34 {
35 for (const auto& entry : gColorTypeTable) {
36 if (entry.format == format) {
37 return entry.colorType;
38 }
39 }
41 }
@ kUnknown_SkColorType
uninitialized
Definition: SkColorType.h:20
uint32_t uint32_t * format

◆ toDataSpace()

ADataSpace SkNDKConversions::toDataSpace ( SkColorSpace cs)

Definition at line 95 of file SkNDKConversions.cpp.

95 {
96 if (!cs) return ADATASPACE_SRGB;
97
99 skcms_Matrix3x3 gamut;
100 if (cs->isNumericalTransferFn(&fn) && cs->toXYZD50(&gamut)) {
101 for (const auto& entry : gColorSpaceTable) {
102 if (nearly_equal(gamut, entry.gamut) && nearly_equal(fn, entry.transferFunction)) {
103 return entry.dataSpace;
104 }
105 }
106 }
107 return ADATASPACE_UNKNOWN;
108 }
static bool nearly_equal(float a, float b)
bool isNumericalTransferFn(skcms_TransferFunction *fn) const
bool toXYZD50(skcms_Matrix3x3 *toXYZD50) const