Version 1 (modified by 17 years ago) (diff) | ,
---|
SocLib Components General Index
Component description
This component is a common utility component.
This creates a frame buffer, it uses soclib-fb from the utilities for a SDL-based viewer window.
For now, the only supported mode is YUV-422. This may change in the future.
User may directly modify a shared-memory buffer, and update it to screen on-demand.
Component usage
Object
soclib::common::FbController *fb;
Instanciation
soclib::common::FbController( const std::string &basename, unsigned long width, unsigned long height);
- basename
- The name of the created framebuffer window
- width
- Width of the window
- height
- Height of the window
Usage
const unsigned long width = 320; const unsigned long height = 240; soclib::common::FbController fb("fb0", width, height); ... // sample setter function: void set(soclib::common::FbController &fb, int line, int column, uint8_t y, uint8_t u, uint8_t v) { uint8_t* buffer = (uint8_t*)fb.surface(); const unsigned long width = fb.m_width; const unsigned long height = fb.m_height; buffer[ line*width +column ] = y; buffer[width*height +line*width/2+column/2] = u; buffer[width*height*3/2+line*width/2+column/2] = v; fb->update(); }