KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Framebuffer

API for framebuffer management More...

Functions

void vid_set_vram (uint32_t base)
 Set the VRAM convenience pointers.
 
void vid_set_start (uint32_t base)
 Set the VRAM base of the framebuffer.
 
uint32_t vid_get_start (int32_t fb)
 Get the VRAM base of a framebuffer.
 
void vid_set_fb (int32_t fb)
 Set the current framebuffer in a multibuffered setup.
 
void vid_flip (int32_t fb)
 Flip to a framebuffer in a multibuffered setup.
 
void vid_clear (uint8_t r, uint8_t g, uint8_t b)
 Clear the framebuffer.
 
void vid_empty (void)
 Clear VRAM.
 
int vid_screen_shot (const char *destfn)
 Take a screenshot.
 
size_t vid_screen_shot_data (uint8_t **buffer)
 Create image data from the current framebuffer.
 

Variables

uint16_t * vram_s
 16-bit size pointer to the current drawing area.
 
uint32_t * vram_l
 32-bit size pointer to the current drawing area.
 

Detailed Description

API for framebuffer management

Function Documentation

◆ vid_clear()

void vid_clear ( uint8_t r,
uint8_t g,
uint8_t b )

Clear the framebuffer.

This function sets the whole framebuffer to the specified color. Internally, this uses the store queues to actually clear the display entirely.

Note
This operates via the vram convenience pointers. In multibuffered mode, by default it will clear the framebuffer you are currently writing to rather than the one being displayed.
Parameters
rThe red value of the color (0-255).
gThe green value of the color (0-255).
bThe blue value of the color (0-255).

◆ vid_empty()

void vid_empty ( void )

Clear VRAM.

This function is essentially a memset() for the whole of VRAM that will clear it all to 0 bytes.

◆ vid_flip()

void vid_flip ( int32_t fb)

Flip to a framebuffer in a multibuffered setup.

This function sets the displayed framebuffer to the specified buffer and sets the vram_s and vram_l pointers to point at the next framebuffer, to allow for tearing-free framebuffer-direct drawing.

Parameters
fbThe framebuffer to display or any other value to display the next one.

◆ vid_get_start()

uint32_t vid_get_start ( int32_t fb)

Get the VRAM base of a framebuffer.

This function gets the position of the specified framebuffer within VRAM. Any invalid fb value will be treated as the current framebuffer.

Parameters
fbThe number of the framebuffer or -1 for current.

◆ vid_screen_shot()

int vid_screen_shot ( const char * destfn)

Take a screenshot.

This function takes the current framebuffer (/vram_l) and dumps it out to a PPM file.

Parameters
destfnThe filename to save to.
Returns
0 on success, <0 on failure.

◆ vid_screen_shot_data()

size_t vid_screen_shot_data ( uint8_t ** buffer)

Create image data from the current framebuffer.

This function takes the current framebuffer (/vram_l) and converts it into 24bpp image data. The function allocates memory for the image data, which the caller is responsible for freeing.

Parameters
bufferA pointer to a uint8_t* that will be allocated and filled with the image data.
Returns
The size of the created image data in bytes, or 0 on failure.

◆ vid_set_fb()

void vid_set_fb ( int32_t fb)

Set the current framebuffer in a multibuffered setup.

This function sets the displayed framebuffer to the specified buffer. Unlike vid_set_fb, this does not point the vram pointers to the next framebuffer, allowing for non-linear management of the FBs.

Parameters
fbThe framebuffer to display or any other value to display the next one.

◆ vid_set_start()

void vid_set_start ( uint32_t base)

Set the VRAM base of the framebuffer.

This function sets the vram_s and vram_l pointers to specified offset within VRAM and sets the start position of the framebuffer to the same offset.

Parameters
baseThe offset within VRAM to set the base to.

◆ vid_set_vram()

void vid_set_vram ( uint32_t base)

Set the VRAM convenience pointers.

This function sets the vram_s and vram_l pointers to specified offset within VRAM. In multibuffered mode it allows manual management of them.

Parameters
baseThe offset within VRAM to set the base to.

Variable Documentation

◆ vram_l

uint32_t* vram_l
extern

32-bit size pointer to the current drawing area.

◆ vram_s

uint16_t* vram_s
extern

16-bit size pointer to the current drawing area.