Overview

The Rendering System provides the foundation for graphical rendering in FreeWorld OS. It combines native assembly rendering primitives with Node.js-based windowing and compositing to deliver a complete graphics stack.

Architecture

The rendering system uses a hybrid approach:

  • Kernel Layer (ASM): Low-level graphics primitives (pixels, lines, rectangles, text)
  • Graphics Bridge: Interface between Node.js and kernel graphics
  • Node.js Layer: High-level rendering, windowing, and compositing

Components

1. Kernel Graphics (ASM)

Location: kernel/gui/renderer.asm

Native assembly rendering primitives:

  • Direct VESA framebuffer access
  • Pixel drawing
  • Line drawing (horizontal, vertical, diagonal)
  • Rectangle drawing (filled and outlined)
  • Circle drawing
  • Bitmap font rendering

2. Graphics Bridge

Location: system/graphics-bridge.js

Interface to kernel graphics:

  • Framebuffer initialization
  • Pixel operations
  • Window buffer blitting
  • Screen clearing

3. Device Context (DC)

Location: system/dc.js

Off-screen rendering surfaces:

  • RGBA bitmap buffers
  • Drawing primitives
  • Clipping regions
  • Alpha blending support

4. Compositor

Location: system/compositor.js

Window compositing:

  • Z-order management
  • Alpha blending
  • Shadow rendering
  • Dirty region tracking

Rendering Pipeline

  1. Application Drawing: Node.js applications draw to Device Contexts
  2. Window Buffers: DCs are registered as window buffers
  3. Compositing: Compositor merges all window buffers
  4. Framebuffer Blit: Final composite is blitted to VESA framebuffer
  5. Display: Graphics card displays the framebuffer

Graphics Modes

Supported graphics modes:

  • 1024x768x32: 32-bit color (RGBA), 1024x768 resolution
  • VESA 2.0: VESA BIOS Extensions support
  • Linear Framebuffer: Direct memory-mapped framebuffer access

Related Documentation