bytesToColor

Reads and converts a colour from a raw byte array to a specified colour format.

bytesToColor
(
ColourFormat = RGB888
)
(
const ubyte[] data
,)
if (
isColourFormat!ColourFormat
)

Parameters

data ubyte[]

raw data to read from

ColourFormat

colour format to convert to

Return Value

Type: auto

a colour in the specified format

Examples

assert(bytesToColor([0xA9, 0xFF], SupportedFormat.bgr555) == RGB888(72, 232, 248));
assert(bytesToColor([0xA9, 0xFF], SupportedFormat.bgr565) == RGB888(72, 244, 248));
assert(bytesToColor([72, 244, 248], SupportedFormat.rgb888) == RGB888(72, 244, 248));

Meta