mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-11-25 06:13:13 -05:00
parent
a27881ecd6
commit
b4da86d491
24 changed files with 1457 additions and 21 deletions
|
|
@ -57,6 +57,16 @@ struct Color {
|
|||
)}
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t to_greyscale() {
|
||||
uint32_t r = ((v >> 11) & 31U) << 3;
|
||||
uint32_t g = ((v >> 5) & 63U) << 2;
|
||||
uint32_t b = (v & 31U) << 3;
|
||||
|
||||
uint32_t grey = (r * 299 + g * 587 + b * 114) / 1000;
|
||||
|
||||
return (uint8_t)grey;
|
||||
}
|
||||
|
||||
Color operator-() const {
|
||||
return (v ^ 0xffff);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue