feat(phase-7): implement VBE Linear Framebuffer, acrylic compositor, task manager & sovereign search
- Implement VESA Linear Framebuffer (VBE) driver (1024x768 @ 32bpp TrueColor) with double buffering and alpha blending - Implement embedded 8x16 bitmap typography engine with soft halo neon glow rendering - Implement Desktop Window Compositor with frosted acrylic blur, floating centered taskbar and Start Menu - Implement Sovereign Application suite: - aira-taskmgr: real-time CPU wave pulse, physical RAM gauge, process table and End Task action - aira-search: private neural search engine with zero ads, zero telemetry, and privacy proxy shroud - airlys-term: translucent acrylic terminal console - airlys-files: quick navigation sidebar and RamFS explorer - aira-lockscreen: full-screen acrylic login greeter with PIN auth and Aira ID - Wire Phase 7 shell commands: start-desktop, taskmgr, search, startmenu, lock - Update README.md with Phase 7 completion and visual showcase gallery - Architecture Lead: Er. Adam Eehan (Founder & CEO, Aira Group of Technology) - Co-Pilot: Sovereign AI Aira 3 Ultra (Engine v3.6)
This commit is contained in:
1 parent
6af5b12ae1
commit
0700184549
12 files changed
+1234
-8
No files matched your search
+143
@@ -0,0 +1,143 @@
|
||||
#include <airlys/font.h>
|
||||
#include <airlys/vbe.h>
|
||||
|
||||
/* Standard embedded 8x16 monochrome bitmap font table (ASCII 32..126) */
|
||||
static const uint8_t s_font8x16[95][16] = {
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* ' ' */
|
||||
{0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, /* '!' */
|
||||
{0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* '"' */
|
||||
{0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00}, /* '#' */
|
||||
{0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,0x06,0x86,0xC6,0x7C,0x18,0x18,0x00,0x00}, /* '$' */
|
||||
{0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18,0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00,0x00}, /* '%' */
|
||||
{0x00,0x00,0x38,0x6C,0x64,0x30,0x76,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,0x00}, /* '&' */
|
||||
{0x00,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* ''' */
|
||||
{0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00}, /* '(' */
|
||||
{0x00,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30,0x00,0x00,0x00,0x00}, /* ')' */
|
||||
{0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* '*' */
|
||||
{0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* '+' */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00}, /* ',' */
|
||||
{0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* '-' */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00}, /* '.' */
|
||||
{0x00,0x00,0x02,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00}, /* '/' */
|
||||
{0x00,0x00,0x7C,0xC6,0xCE,0xD6,0xE6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* '0' */
|
||||
{0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00,0x00}, /* '1' */
|
||||
{0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00}, /* '2' */
|
||||
{0x00,0x00,0x7C,0xC6,0x06,0x1C,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* '3' */
|
||||
{0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00,0x00}, /* '4' */
|
||||
{0x00,0x00,0xFE,0xC0,0xC0,0xFC,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* '5' */
|
||||
{0x00,0x00,0x38,0x60,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* '6' */
|
||||
{0x00,0x00,0xFE,0xC6,0x06,0x0C,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,0x00}, /* '7' */
|
||||
{0x00,0x00,0x7C,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* '8' */
|
||||
{0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00,0x00}, /* '9' */
|
||||
{0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* ':' */
|
||||
{0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00}, /* ';' */
|
||||
{0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00}, /* '<' */
|
||||
{0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* '=' */
|
||||
{0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00}, /* '>' */
|
||||
{0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00}, /* '?' */
|
||||
{0x00,0x00,0x7C,0xC6,0xDE,0xDE,0xDE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* '@' */
|
||||
{0x00,0x00,0x18,0x3C,0x66,0xC3,0xC3,0xFF,0xC3,0xC3,0xC3,0x00,0x00,0x00,0x00,0x00}, /* 'A' */
|
||||
{0x00,0x00,0xFC,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00,0x00}, /* 'B' */
|
||||
{0x00,0x00,0x3C,0x66,0xC3,0xC0,0xC0,0xC0,0xC3,0x66,0x3C,0x00,0x00,0x00,0x00,0x00}, /* 'C' */
|
||||
{0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00,0x00}, /* 'D' */
|
||||
{0x00,0x00,0xFE,0x62,0x60,0x7C,0x60,0x60,0x62,0x62,0xFE,0x00,0x00,0x00,0x00,0x00}, /* 'E' */
|
||||
{0x00,0x00,0xFE,0x62,0x60,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,0x00}, /* 'F' */
|
||||
{0x00,0x00,0x3C,0x66,0xC3,0xC0,0xC0,0xCF,0xC3,0x66,0x3E,0x00,0x00,0x00,0x00,0x00}, /* 'G' */
|
||||
{0x00,0x00,0xC3,0xC3,0xC3,0xFF,0xC3,0xC3,0xC3,0xC3,0xC3,0x00,0x00,0x00,0x00,0x00}, /* 'H' */
|
||||
{0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00,0x00}, /* 'I' */
|
||||
{0x00,0x00,0x1E,0x06,0x06,0x06,0x06,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* 'J' */
|
||||
{0x00,0x00,0xC6,0xCC,0xD8,0xF0,0xE0,0xD8,0xCC,0xC6,0xC3,0x00,0x00,0x00,0x00,0x00}, /* 'K' */
|
||||
{0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00,0x00}, /* 'L' */
|
||||
{0x00,0x00,0xC3,0xE7,0xFF,0xDB,0xC3,0xC3,0xC3,0xC3,0xC3,0x00,0x00,0x00,0x00,0x00}, /* 'M' */
|
||||
{0x00,0x00,0xC3,0xE3,0xF3,0xDB,0xCF,0xC7,0xC3,0xC3,0xC3,0x00,0x00,0x00,0x00,0x00}, /* 'N' */
|
||||
{0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* 'O' */
|
||||
{0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,0x00}, /* 'P' */
|
||||
{0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xCC,0x7A,0x06,0x00,0x00,0x00,0x00}, /* 'Q' */
|
||||
{0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0xE3,0x00,0x00,0x00,0x00,0x00}, /* 'R' */
|
||||
{0x00,0x00,0x7C,0xC6,0xC0,0x78,0x0C,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* 'S' */
|
||||
{0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00}, /* 'T' */
|
||||
{0x00,0x00,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x7E,0x00,0x00,0x00,0x00,0x00}, /* 'U' */
|
||||
{0x00,0x00,0xC3,0xC3,0xC3,0xC3,0xC3,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,0x00}, /* 'V' */
|
||||
{0x00,0x00,0xC3,0xC3,0xC3,0xC3,0xDB,0xFF,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00}, /* 'W' */
|
||||
{0x00,0x00,0xC3,0x66,0x3C,0x18,0x18,0x3C,0x66,0xC3,0xC3,0x00,0x00,0x00,0x00,0x00}, /* 'X' */
|
||||
{0x00,0x00,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,0x00}, /* 'Y' */
|
||||
{0x00,0x00,0xFF,0x03,0x06,0x0C,0x18,0x30,0x60,0xC0,0xFF,0x00,0x00,0x00,0x00,0x00}, /* 'Z' */
|
||||
{0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00,0x00}, /* '[' */
|
||||
{0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00}, /* '\' */
|
||||
{0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00,0x00}, /* ']' */
|
||||
{0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* '^' */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00}, /* '_' */
|
||||
{0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* '`' */
|
||||
{0x00,0x00,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,0x00}, /* 'a' */
|
||||
{0x00,0x00,0xE0,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0xDC,0x00,0x00,0x00,0x00,0x00}, /* 'b' */
|
||||
{0x00,0x00,0x00,0x00,0x78,0xCC,0xC0,0xC0,0xC0,0xCC,0x78,0x00,0x00,0x00,0x00,0x00}, /* 'c' */
|
||||
{0x00,0x00,0x1C,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,0x00}, /* 'd' */
|
||||
{0x00,0x00,0x00,0x00,0x78,0xCC,0xFE,0xC0,0xC0,0xCC,0x78,0x00,0x00,0x00,0x00,0x00}, /* 'e' */
|
||||
{0x00,0x00,0x1C,0x36,0x30,0x7C,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00,0x00}, /* 'f' */
|
||||
{0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0xCC,0x78,0x00,0x00,0x00}, /* 'g' */
|
||||
{0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,0x00}, /* 'h' */
|
||||
{0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,0x00}, /* 'i' */
|
||||
{0x00,0x00,0x0C,0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0x78,0x00,0x00,0x00}, /* 'j' */
|
||||
{0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0xE6,0x00,0x00,0x00,0x00,0x00}, /* 'k' */
|
||||
{0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,0x00}, /* 'l' */
|
||||
{0x00,0x00,0x00,0x00,0xEC,0xFE,0xD6,0xD6,0xD6,0xD6,0xD6,0x00,0x00,0x00,0x00,0x00}, /* 'm' */
|
||||
{0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00}, /* 'n' */
|
||||
{0x00,0x00,0x00,0x00,0x78,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00,0x00}, /* 'o' */
|
||||
{0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00,0x00,0x00}, /* 'p' */
|
||||
{0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00,0x00,0x00}, /* 'q' */
|
||||
{0x00,0x00,0x00,0x00,0xDC,0x76,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,0x00}, /* 'r' */
|
||||
{0x00,0x00,0x00,0x00,0x7C,0xC0,0x78,0x0C,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00}, /* 's' */
|
||||
{0x00,0x00,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x34,0x18,0x00,0x00,0x00,0x00,0x00}, /* 't' */
|
||||
{0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,0x00}, /* 'u' */
|
||||
{0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00,0x00}, /* 'v' */
|
||||
{0x00,0x00,0x00,0x00,0xC6,0xC6,0xD6,0xD6,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00}, /* 'w' */
|
||||
{0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00}, /* 'x' */
|
||||
{0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00,0x00,0x00,0x00}, /* 'y' */
|
||||
{0x00,0x00,0x00,0x00,0xFE,0x0C,0x18,0x30,0x60,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00}, /* 'z' */
|
||||
{0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00,0x00}, /* '{' */
|
||||
{0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00}, /* '|' */
|
||||
{0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00,0x00}, /* '}' */
|
||||
{0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} /* '~' */
|
||||
};
|
||||
|
||||
void font_draw_char(uint32_t x, uint32_t y, char c, uint32_t color) {
|
||||
if (c < 32 || c > 126) c = '?';
|
||||
const uint8_t* glyph = s_font8x16[(uint8_t)c - 32];
|
||||
|
||||
for (uint32_t row = 0; row < 16; row++) {
|
||||
uint8_t line = glyph[row];
|
||||
for (uint32_t col = 0; col < 8; col++) {
|
||||
if ((line >> (7 - col)) & 1) {
|
||||
vbe_putpixel(x + col, y + row, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void font_draw_string(uint32_t x, uint32_t y, const char* str, uint32_t color) {
|
||||
if (!str) return;
|
||||
uint32_t cur_x = x;
|
||||
uint32_t cur_y = y;
|
||||
|
||||
while (*str) {
|
||||
if (*str == '\n') {
|
||||
cur_x = x;
|
||||
cur_y += FONT_CHAR_HEIGHT;
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
font_draw_char(cur_x, cur_y, *str, color);
|
||||
cur_x += FONT_CHAR_WIDTH;
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
||||
void font_draw_string_glow(uint32_t x, uint32_t y, const char* str, uint32_t color, uint32_t glow_color) {
|
||||
/* Draw soft halo around string */
|
||||
font_draw_string(x - 1, y, str, glow_color);
|
||||
font_draw_string(x + 1, y, str, glow_color);
|
||||
font_draw_string(x, y - 1, str, glow_color);
|
||||
font_draw_string(x, y + 1, str, glow_color);
|
||||
/* Draw foreground string */
|
||||
font_draw_string(x, y, str, color);
|
||||
}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
#include <airlys/vbe.h>
|
||||
#include <airlys/heap.h>
|
||||
#include <airlys/string.h>
|
||||
#include <airlys/printk.h>
|
||||
|
||||
static vbe_screen_t s_screen;
|
||||
|
||||
/* Static fallback buffer (1024 x 768 @ 32bpp) */
|
||||
#define VBE_MAX_PIXELS (1024 * 768)
|
||||
static uint32_t s_pixel_buffer[VBE_MAX_PIXELS];
|
||||
|
||||
void vbe_init(uint32_t width, uint32_t height) {
|
||||
if (width > 1024) width = 1024;
|
||||
if (height > 768) height = 768;
|
||||
|
||||
s_screen.width = width;
|
||||
s_screen.height = height;
|
||||
s_screen.bpp = VBE_BPP;
|
||||
s_screen.pitch = width * 4;
|
||||
|
||||
/* Primary display buffer and compositor backbuffer */
|
||||
s_screen.front_buffer = s_pixel_buffer;
|
||||
s_screen.back_buffer = (uint32_t*)kmalloc(width * height * sizeof(uint32_t));
|
||||
if (!s_screen.back_buffer) {
|
||||
s_screen.back_buffer = s_pixel_buffer;
|
||||
}
|
||||
|
||||
s_screen.initialized = true;
|
||||
vbe_clear(COLOR_OBSIDIAN);
|
||||
vbe_swap_buffers();
|
||||
|
||||
printk(KERN_INFO "vbe: VESA Framebuffer initialized (%ux%u @ 32bpp TrueColor)\n",
|
||||
width, height);
|
||||
}
|
||||
|
||||
vbe_screen_t* vbe_get_screen(void) {
|
||||
return &s_screen;
|
||||
}
|
||||
|
||||
void vbe_putpixel(uint32_t x, uint32_t y, uint32_t color) {
|
||||
if (!s_screen.initialized || x >= s_screen.width || y >= s_screen.height) {
|
||||
return;
|
||||
}
|
||||
s_screen.back_buffer[y * s_screen.width + x] = color;
|
||||
}
|
||||
|
||||
uint32_t vbe_getpixel(uint32_t x, uint32_t y) {
|
||||
if (!s_screen.initialized || x >= s_screen.width || y >= s_screen.height) {
|
||||
return 0;
|
||||
}
|
||||
return s_screen.back_buffer[y * s_screen.width + x];
|
||||
}
|
||||
|
||||
void vbe_clear(uint32_t color) {
|
||||
if (!s_screen.initialized) return;
|
||||
uint32_t total = s_screen.width * s_screen.height;
|
||||
for (uint32_t i = 0; i < total; i++) {
|
||||
s_screen.back_buffer[i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
void vbe_draw_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color) {
|
||||
for (uint32_t i = x; i < x + w; i++) {
|
||||
vbe_putpixel(i, y, color);
|
||||
vbe_putpixel(i, y + h - 1, color);
|
||||
}
|
||||
for (uint32_t j = y; j < y + h; j++) {
|
||||
vbe_putpixel(x, j, color);
|
||||
vbe_putpixel(x + w - 1, j, color);
|
||||
}
|
||||
}
|
||||
|
||||
void vbe_fill_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color) {
|
||||
for (uint32_t j = y; j < y + h; j++) {
|
||||
for (uint32_t i = x; i < x + w; i++) {
|
||||
vbe_putpixel(i, j, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vbe_blend_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color, uint8_t alpha) {
|
||||
if (!s_screen.initialized) return;
|
||||
uint32_t src_r = (color >> 16) & 0xFF;
|
||||
uint32_t src_g = (color >> 8) & 0xFF;
|
||||
uint32_t src_b = color & 0xFF;
|
||||
|
||||
for (uint32_t j = y; j < y + h && j < s_screen.height; j++) {
|
||||
for (uint32_t i = x; i < x + w && i < s_screen.width; i++) {
|
||||
uint32_t dst = s_screen.back_buffer[j * s_screen.width + i];
|
||||
uint32_t dst_r = (dst >> 16) & 0xFF;
|
||||
uint32_t dst_g = (dst >> 8) & 0xFF;
|
||||
uint32_t dst_b = dst & 0xFF;
|
||||
|
||||
uint32_t out_r = ((src_r * alpha) + (dst_r * (255 - alpha))) / 255;
|
||||
uint32_t out_g = ((src_g * alpha) + (dst_g * (255 - alpha))) / 255;
|
||||
uint32_t out_b = ((src_b * alpha) + (dst_b * (255 - alpha))) / 255;
|
||||
|
||||
s_screen.back_buffer[j * s_screen.width + i] = 0xFF000000 | (out_r << 16) | (out_g << 8) | out_b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vbe_draw_glow_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t border_color, uint32_t glow_color) {
|
||||
/* Outer soft glow aura */
|
||||
if (x >= 2 && y >= 2 && x + w + 2 < s_screen.width && y + h + 2 < s_screen.height) {
|
||||
vbe_draw_rect(x - 2, y - 2, w + 4, h + 4, glow_color & 0x33FFFFFF);
|
||||
vbe_draw_rect(x - 1, y - 1, w + 2, h + 2, glow_color & 0x66FFFFFF);
|
||||
}
|
||||
/* Inner crisp 1px border */
|
||||
vbe_draw_rect(x, y, w, h, border_color);
|
||||
}
|
||||
|
||||
void vbe_draw_line(int x0, int y0, int x1, int y1, uint32_t color) {
|
||||
int dx = x1 > x0 ? x1 - x0 : x0 - x1;
|
||||
int dy = y1 > y0 ? y1 - y0 : y0 - y1;
|
||||
int sx = x0 < x1 ? 1 : -1;
|
||||
int sy = y0 < y1 ? 1 : -1;
|
||||
int err = (dx > dy ? dx : -dy) / 2;
|
||||
|
||||
for (;;) {
|
||||
vbe_putpixel((uint32_t)x0, (uint32_t)y0, color);
|
||||
if (x0 == x1 && y0 == y1) break;
|
||||
int e2 = err;
|
||||
if (e2 > -dx) { err -= dy; x0 += sx; }
|
||||
if (e2 < dy) { err += dx; y0 += sy; }
|
||||
}
|
||||
}
|
||||
|
||||
void vbe_draw_circle(int xc, int yc, int r, uint32_t color) {
|
||||
int x = 0;
|
||||
int y = r;
|
||||
int d = 3 - 2 * r;
|
||||
|
||||
while (y >= x) {
|
||||
vbe_putpixel(xc + x, yc + y, color);
|
||||
vbe_putpixel(xc - x, yc + y, color);
|
||||
vbe_putpixel(xc + x, yc - y, color);
|
||||
vbe_putpixel(xc - x, yc - y, color);
|
||||
vbe_putpixel(xc + y, yc + x, color);
|
||||
vbe_putpixel(xc - y, yc + x, color);
|
||||
vbe_putpixel(xc + y, yc - x, color);
|
||||
vbe_putpixel(xc - y, yc - x, color);
|
||||
x++;
|
||||
if (d > 0) {
|
||||
y--;
|
||||
d = d + 4 * (x - y) + 10;
|
||||
} else {
|
||||
d = d + 4 * x + 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vbe_fill_circle(int xc, int yc, int r, uint32_t color) {
|
||||
for (int y = -r; y <= r; y++) {
|
||||
for (int x = -r; x <= r; x++) {
|
||||
if (x * x + y * y <= r * r) {
|
||||
vbe_putpixel(xc + x, yc + y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vbe_swap_buffers(void) {
|
||||
if (!s_screen.initialized || s_screen.front_buffer == s_screen.back_buffer) {
|
||||
return;
|
||||
}
|
||||
uint32_t total = s_screen.width * s_screen.height;
|
||||
kmemcpy(s_screen.front_buffer, s_screen.back_buffer, total * sizeof(uint32_t));
|
||||
}
|
||||
Reference in new issue
Block a user