MCPcopy Create free account
hub / github.com/IENT/YUView / read16AsRgb

Function read16AsRgb

YUViewLib/src/decoder/decoderTarga.cpp:216–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216color_t read16AsRgb(std::ifstream &file, bool hasAlpha)
217{
218 const auto v = read16(file);
219 uint8_t a = 255;
220 if (hasAlpha)
221 {
222 if ((v & 0x8000) == 0) // Transparent bit
223 a = 0;
224 }
225 return rgba(scale_5bits_to_8bits((v >> 10) & 0x1F),
226 scale_5bits_to_8bits((v >> 5) & 0x1F),
227 scale_5bits_to_8bits(v & 0x1F),
228 a);
229}
230
231color_t read24AsRgb(std::ifstream &file)
232{

Callers 2

readRunLengthColorFunction · 0.85
readImageFunction · 0.85

Calls 3

read16Function · 0.85
rgbaFunction · 0.85
scale_5bits_to_8bitsFunction · 0.85

Tested by

no test coverage detected