mirror of
https://github.com/mikage-emu/mikage-dev.git
synced 2025-01-09 15:01:00 +01:00
27 lines
601 B
C++
27 lines
601 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
namespace Color {
|
|
|
|
/// Convert a 1-bit color component to 8 bit
|
|
static inline uint8_t Convert1To8(uint8_t value) {
|
|
return value * 255;
|
|
}
|
|
|
|
/// Convert a 4-bit color component to 8 bit
|
|
static inline uint8_t Convert4To8(uint8_t value) {
|
|
return (value << 4) | value;
|
|
}
|
|
|
|
/// Convert a 5-bit color component to 8 bit
|
|
static inline uint8_t Convert5To8(uint8_t value) {
|
|
return (value << 3) | (value >> 2);
|
|
}
|
|
|
|
/// Convert a 6-bit color component to 8 bit
|
|
static inline uint8_t Convert6To8(uint8_t value) {
|
|
return (value << 2) | (value >> 4);
|
|
}
|
|
|
|
} // namespace
|