PowerBlocks SDK
 
Loading...
Searching...
No Matches
framebuffer.h File Reference

Functions for managing and rendering framebuffers. More...

#include <stdint.h>
#include "powerblocks/core/utils/math/vec2.h"

Go to the source code of this file.

Classes

struct  framebuffer_t
 Data format for framebuffers. More...
 
struct  framebuffer_font_t
 Used to describe a font for the framebuffer to use. More...
 

Macros

#define VIDEO_WIDTH   640
 
#define VIDEO_HEIGHT   480
 

Functions

void framebuffer_copy_rgba_into (framebuffer_t *framebuffer, const uint32_t *rgba, vec2i position, vec2i size)
 Copys RGBA8888 data into a frame buffer.
 
void framebuffer_fill_rgba (framebuffer_t *framebuffer, uint32_t rgba, vec2i a, vec2i b)
 Fills a section of the frame buffer with RGBA8888 data.
 
void framebuffer_put_text (framebuffer_t *framebuffer, uint32_t foreground, uint32_t background, vec2i position, const framebuffer_font_t *font, const char *str)
 Renders a bitmap font to the framebuffer.
 

Detailed Description

Functions for managing and rendering framebuffers.

Able to fill colors, copy data to and from, as well as render text into frame buffers.

Author
Samuel Fitzsimons (rainbain)
Date
2025 @license MIT (see LICENSE file)

Function Documentation

◆ framebuffer_copy_rgba_into()

void framebuffer_copy_rgba_into ( framebuffer_t * framebuffer,
const uint32_t * rgba,
vec2i position,
vec2i size )
extern

Copys RGBA8888 data into a frame buffer.

Copys data into a position of the framebuffer. Converts into the YUY data of the framebuffer.

Blends as it goes. Very nice

Parameters
framebufferFramebuffer to render into.
rgbaRGBA8888 color data of width x height.
x_posx position in the frame buffer.
y_posy position in the frame buffer.

◆ framebuffer_fill_rgba()

void framebuffer_fill_rgba ( framebuffer_t * framebuffer,
uint32_t rgba,
vec2i a,
vec2i b )
extern

Fills a section of the frame buffer with RGBA8888 data.

Fills the frame buffer with a color while doing blending as needed

Parameters
framebufferFramebuffer to render into.
rgbaRGBA8888 color
a- Start position of the fill
b- Stop position of the fill

◆ framebuffer_put_text()

void framebuffer_put_text ( framebuffer_t * framebuffer,
uint32_t foreground,
uint32_t background,
vec2i position,
const framebuffer_font_t * font,
const char * str )
extern

Renders a bitmap font to the framebuffer.

Renders a bitmap font to the frame buffer using the specified font. Special characters are not supported. It will just render that slot in the font.

Parameters
framebufferFramebuffer to render into.
foregroundRGBA8888 Color of the text itself
backgroundRGBA8888 Color of the background
positionPixel position of the top left corner of the text.
fontFont to use
strZero terminated string to render