MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ToHexString

Method ToHexString

Source/Engine/Core/Math/Color.cpp:116–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116String Color::ToHexString() const
117{
118 static const Char* digits = TEXT("0123456789ABCDEF");
119
120 const byte r = static_cast<byte>(R * MAX_uint8);
121 const byte g = static_cast<byte>(G * MAX_uint8);
122 const byte b = static_cast<byte>(B * MAX_uint8);
123 const byte a = static_cast<byte>(A * MAX_uint8);
124
125 Char result[8];
126
127 result[0] = digits[r >> 4 & 0x0f];
128 result[1] = digits[r & 0x0f];
129
130 result[2] = digits[g >> 4 & 0x0f];
131 result[3] = digits[g & 0x0f];
132
133 result[4] = digits[b >> 4 & 0x0f];
134 result[5] = digits[b & 0x0f];
135
136 result[6] = digits[a >> 4 & 0x0f];
137 result[7] = digits[a & 0x0f];
138
139 return String(result, 8);
140}
141
142bool Color::IsTransparent() const
143{

Callers 3

TestHexConversionMethod · 0.45
OnPostProcessMethod · 0.45
ColorPickerDialogClass · 0.45

Calls 1

StringFunction · 0.50

Tested by 1

TestHexConversionMethod · 0.36