Module: ui.backend.framebuffer

Source: ./ui/backend/framebuffer.reef


Overview

ui/backend/framebuffer.reef - Linux framebuffer backend Part of reef-stdlib UI module

This module provides direct access to the Linux framebuffer device (/dev/fb0). It's useful for:

  • Embedded systems without a display server
  • Kiosk applications
  • Boot splash screens
  • Console graphics applications

The framebuffer provides raw pixel access without any window manager. This backend uses a C helper for ioctl operations to get screen info.


Types

FramebufferInfo

Fields:

Name Type
width int
height int
virtual_width int
virtual_height int
depth int
pitch int
memory_size int

FramebufferError (enum)

Variants:

  • None
  • DeviceNotFound
  • PermissionDenied
  • NotAFramebuffer
  • UnsupportedFormat
  • MmapFailed
  • IoctlFailed
  • InvalidOperation

Framebuffer

Fields:

Name Type
fd int
tty_fd int
memory pointer
info FramebufferInfo
is_open bool

FramebufferResult (enum)

Variants:

  • Ok(Framebuffer)
  • Err(FramebufferError)

Functions

fn reef_fb_open(device: string): int

These are implemented in reef_fb.c (runtime helper)

fn reef_fb_close(fd: int): int

fn reef_fb_get_width(fd: int): int

fn reef_fb_get_height(fd: int): int

fn reef_fb_get_depth(fd: int): int

fn reef_fb_get_pitch(fd: int): int

fn reef_fb_get_memory_size(fd: int): int

fn reef_fb_mmap(fd: int, size: int): pointer

fn reef_fb_munmap(ptr: pointer, size: int): int

fn reef_fb_write(fd: int, buf: string, count: int): int

fn open(path: string, flags: int): int

fn close(fd: int): int

fn framebuffer_open_default(): FramebufferResult

fn framebuffer_open(device: string): FramebufferResult

fn framebuffer_width(fb: Framebuffer): int

fn framebuffer_height(fb: Framebuffer): int

fn framebuffer_depth(fb: Framebuffer): int

fn framebuffer_pitch(fb: Framebuffer): int

fn framebuffer_info(fb: Framebuffer): FramebufferInfo

fn framebuffer_get_pixel(fb: Framebuffer, x: int, y: int): core.Color

fn reef_fb_disable_cursor(fd: int): int

fn reef_fb_enable_cursor(fd: int): int

fn is_ok(r: FramebufferResult): bool

fn is_err(r: FramebufferResult): bool

fn unwrap(r: FramebufferResult): Framebuffer

fn empty_framebuffer(): Framebuffer

fn error(r: FramebufferResult): FramebufferError


Procedures

proc framebuffer_close(fb: Framebuffer)

proc framebuffer_set_pixel(fb: Framebuffer, x: int, y: int, color: core.Color)

proc framebuffer_clear(fb: Framebuffer, color: core.Color)

proc framebuffer_fill_rect(fb: Framebuffer, x: int, y: int, w: int, h: int, color: core.Color)

proc framebuffer_blit(fb: Framebuffer, img: image.Image, x: int, y: int)

proc framebuffer_disable_cursor(fb: Framebuffer)

proc framebuffer_enable_cursor(fb: Framebuffer)


Generated by reefc doc