mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 20:45:06 +00:00

Okay things kinda sorta work. Both Bochs and QEMU now boot into GUI mode. There's a ton of stuff that doesn't make sense and so many things to rework. Still it's quite cool to have made it this far. :^)
38 lines
937 B
C++
38 lines
937 B
C++
#include "Color.h"
|
|
#include "FrameBuffer.h"
|
|
|
|
Color::Color(byte r, byte g, byte b)
|
|
{
|
|
#ifdef USE_SDL
|
|
m_value = SDL_MapRGB(FrameBuffer::the().surface()->format, r, g, b);
|
|
#else
|
|
m_value = (r << 16) | (g << 8) | b;
|
|
#endif
|
|
}
|
|
|
|
Color::Color(NamedColor named)
|
|
{
|
|
struct {
|
|
byte r;
|
|
byte g;
|
|
byte b;
|
|
} rgb;
|
|
|
|
switch (named) {
|
|
case Black: rgb = { 0, 0, 0 }; break;
|
|
case White: rgb = { 255, 255, 255 }; break;
|
|
case Red: rgb = { 255, 0, 0}; break;
|
|
case Green: rgb = { 0, 255, 0}; break;
|
|
case Blue: rgb = { 0, 0, 255}; break;
|
|
case DarkGray: rgb = { 64, 64, 64 }; break;
|
|
case MidGray: rgb = { 127, 127, 127 }; break;
|
|
case LightGray: rgb = { 192, 192, 192 }; break;
|
|
default: ASSERT_NOT_REACHED(); break;
|
|
}
|
|
|
|
#ifdef USE_SDL
|
|
m_value = SDL_MapRGB(FrameBuffer::the().surface()->format, rgb.r, rgb.g, rgb.g);
|
|
#else
|
|
m_value = (rgb.r << 16) | (rgb.g << 8) | rgb.b;
|
|
#endif
|
|
}
|