|
FB Graphics
FBGraphics (FBG) : Simple C 16, 24, 32 bpp generic graphics library with parallelism support and custom backend.
|
#include <time.h>#include <sys/time.h>#include <stdint.h>#include <math.h>Go to the source code of this file.
Data Structures | |
| struct | _fbg_rgb |
| RGBA color data structure. More... | |
| struct | _fbg_hsl |
| HSL color data structure. More... | |
| struct | _fbg_img |
| Image data structure. More... | |
| struct | _fbg_font |
| Bitmap font data structure. More... | |
| struct | _fbg |
| FB Graphics context data structure. More... | |
Macros | |
| #define | fbg_fade(fbg, fade_amount) fbg_fadeDown(fbg, fade_amount) |
| background fade to black with controllable factor More... | |
| #define | fbg_write(fbg, text, x, y) fbg_text(fbg, &fbg->current_font, text, x, y, fbg->text_color.r, fbg->text_color.g, fbg->text_color.b) |
| draw a text by using the current font and the current color More... | |
| #define | fbg_imageScale(fbg, img, x, y, sx, sy) fbg_imageEx(fbg, img, x, y, sx, sy, 0, 0, img->width, img->height) |
| draw a scaled image (Nearest-neighbor algorithm) More... | |
| #define | _FBG_MAX(a, b) ((a) > (b) ? a : b) |
| integer MAX Math function More... | |
| #define | _FBG_MIN(a, b) ((a) < (b) ? a : b) |
| integer MIN Math function More... | |
| #define | _FBG_SGN(x) ((x<0)?-1:((x>0)?1:0)) |
| integer SIGN function More... | |
| #define | _FBG_DEGTORAD(angle_degree) ((angle_degree) * M_PI / 180.0) |
| convert a degree angle to radians More... | |
| #define | _FBG_RADTODEG(angle_radians) ((angle_radians) * 180.0 / M_PI) |
| convert a radian angle to degree More... | |
| #define | _FBG_SOURCE_OVER(a, b, c) (c * a + b * (1.f - a)) |
Functions | |
| struct _fbg * | fbg_customSetup (int width, int height, int components, int initialize_buffers, int allow_resizing, void *user_context, void(*user_draw)(struct _fbg *fbg), void(*user_flip)(struct _fbg *fbg), void(*backend_resize)(struct _fbg *fbg, unsigned int new_width, unsigned int new_height), void(*user_free)(struct _fbg *fbg)) |
| initialize a FB Graphics context (typically used by a custom rendering backend) More... | |
| void | fbg_close (struct _fbg *fbg) |
| free up the memory associated with a FB Graphics context and close the framebuffer device More... | |
| void | fbg_setResizeCallback (struct _fbg *fbg, void(*user_resize)(struct _fbg *fbg, unsigned int new_width, unsigned int new_height)) |
| register a user resize callback More... | |
| void | fbg_resize (struct _fbg *fbg, int new_width, int new_height) |
| void | fbg_pushResize (struct _fbg *fbg, int new_width, int new_height) |
| void | fbg_fadeDown (struct _fbg *fbg, unsigned char rgb_fade_amount) |
| background fade to black with controllable factor More... | |
| void | fbg_fadeUp (struct _fbg *fbg, unsigned char rgb_fade_amount) |
| background fade to white with controllable factor More... | |
| void | fbg_clear (struct _fbg *fbg, unsigned char brightness) |
| fast grayscale background clearing More... | |
| void | fbg_fill (struct _fbg *fbg, unsigned char r, unsigned char g, unsigned char b) |
| set the filling color for fast drawing operations More... | |
| void | fbg_getPixel (struct _fbg *fbg, int x, int y, struct _fbg_rgb *color) |
| get the RGB value of a pixel More... | |
| void | fbg_pixel (struct _fbg *fbg, int x, int y, unsigned char r, unsigned char g, unsigned char b) |
| draw a pixel More... | |
| void | fbg_pixela (struct _fbg *fbg, int x, int y, unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
| draw a pixel with alpha component (alpha blending) More... | |
| void | fbg_fpixel (struct _fbg *fbg, int x, int y) |
| fast pixel drawing which use the fill color set by fbg_fill() More... | |
| void | fbg_plot (struct _fbg *fbg, int index, unsigned char value) |
| direct pixel access from index value More... | |
| void | fbg_rect (struct _fbg *fbg, int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b) |
| draw a rectangle More... | |
| void | fbg_recta (struct _fbg *fbg, int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
| draw a rectangle with alpha transparency More... | |
| void | fbg_frect (struct _fbg *fbg, int x, int y, int w, int h) |
| fast rectangle drawing which use the fill color set by fbg_fill() More... | |
| void | fbg_hline (struct _fbg *fbg, int x, int y, int w, unsigned char r, unsigned char g, unsigned char b) |
| draw a horizontal line More... | |
| void | fbg_vline (struct _fbg *fbg, int x, int y, int h, unsigned char r, unsigned char g, unsigned char b) |
| draw a vertical line More... | |
| void | fbg_line (struct _fbg *fbg, int x1, int y1, int x2, int y2, unsigned char r, unsigned char g, unsigned char b) |
| draw a line from two points (Bresenham algorithm) More... | |
| void | fbg_polygon (struct _fbg *fbg, int num_vertices, int *vertices, unsigned char r, unsigned char g, unsigned char b) |
| draw a polygon More... | |
| void | fbg_background (struct _fbg *fbg, unsigned char r, unsigned char g, unsigned char b) |
| clear the background with a color More... | |
| void | fbg_hslToRGB (struct _fbg_rgb *color, float h, float s, float l) |
| convert HSL values to RGB color More... | |
| void | fbg_rgbToHsl (struct _fbg_hsl *color, float r, float g, float b) |
| convert RGB values to HSL color More... | |
| void | fbg_draw (struct _fbg *fbg) |
| draw to the screen More... | |
| void | fbg_flip (struct _fbg *fbg) |
| flip the buffers More... | |
| struct _fbg_img * | fbg_createImage (struct _fbg *fbg, unsigned int width, unsigned int height) |
| create an empty image More... | |
| struct _fbg_img * | fbg_loadPNG (struct _fbg *fbg, const char *filename) |
| load a PNG image from a file (lodePNG library) More... | |
| struct _fbg_img * | fbg_loadJPEG (struct _fbg *fbg, const char *filename) |
| load a JPEG image from a file (NanoJPEG library) More... | |
| struct _fbg_img * | fbg_loadImage (struct _fbg *fbg, const char *filename) |
| load an image (PNG or JPEG) More... | |
| void | fbg_image (struct _fbg *fbg, struct _fbg_img *img, int x, int y) |
| draw an image More... | |
| void | fbg_imageColorkey (struct _fbg *fbg, struct _fbg_img *img, int x, int y, int cr, int cg, int cb) |
| draw an image with colorkeying support (image colorkey value will be ignored) More... | |
| void | fbg_imageClip (struct _fbg *fbg, struct _fbg_img *img, int x, int y, int cx, int cy, int cw, int ch) |
| draw a clipped image More... | |
| void | fbg_imageFlip (struct _fbg_img *img) |
| flip an image vertically More... | |
| void | fbg_imageEx (struct _fbg *fbg, struct _fbg_img *img, int x, int y, float sx, float sy, int cx, int cy, int cw, int ch) |
| draw an image with support for clipping and scaling (Nearest-neighbor algorithm) More... | |
| void | fbg_freeImage (struct _fbg_img *img) |
| free the memory associated with an image More... | |
| struct _fbg_font * | fbg_createFont (struct _fbg *fbg, struct _fbg_img *img, int glyph_width, int glyph_height, unsigned char first_char) |
| create a bitmap font from an image More... | |
| void | fbg_textFont (struct _fbg *fbg, struct _fbg_font *font) |
| set the current font More... | |
| void | fbg_textColor (struct _fbg *fbg, unsigned char r, unsigned char g, unsigned char b) |
| set the current text color More... | |
| void | fbg_textBackground (struct _fbg *fbg, int r, int g, int b, int a) |
| set the current text background color (based on colorkey value!) More... | |
| void | fbg_textColorKey (struct _fbg *fbg, unsigned char v) |
| set the current text color key More... | |
| void | fbg_text (struct _fbg *fbg, struct _fbg_font *fnt, char *text, int x, int y, int r, int g, int b) |
| draw a text More... | |
| void | fbg_freeFont (struct _fbg_font *font) |
| free the memory associated with a font More... | |
| void | fbg_drawFramerate (struct _fbg *fbg, struct _fbg_font *fnt, int task, int x, int y, int r, int g, int b) |
| draw the framerate of a particular parallel task More... | |
| int | fbg_getFramerate (struct _fbg *fbg, int task) |
| get the framerate of a particular task More... | |
| void | fbg_drawInto (struct _fbg *fbg, unsigned char *buffer) |
| set an offscreen target for all subsequent fbg context draw calls, it is important to reset back to display target once done by calling fbg_drawInto(NULL) otherwise you may have segfaults / memory leaks upon resizing and other actions More... | |
| float | fbg_randf (float min, float max) |
| pseudo random number between min / max More... | |
| struct _fbg_hsl |
HSL color data structure.
Hold HSL components S/L [0,1], HUE [0, 360]
Definition at line 83 of file fbgraphics.h.
| Data Fields | ||
|---|---|---|
| int | h | |
| float | l | |
| float | s | |
| struct _fbg_img |
| struct _fbg_font |
Bitmap font data structure.
Hold bitmap font informations and associated image
Definition at line 103 of file fbgraphics.h.
| Data Fields | ||
|---|---|---|
| struct _fbg_img * | bitmap | Associated font image data structure. |
| unsigned char | first_char | First ASCII character of the bitmap font file. |
| int * | glyph_coord_x | Pre-computed X glyphs coordinates. |
| int * | glyph_coord_y | Pre-computed Y glyphs coordinates. |
| int | glyph_height | Height of a glyph. |
| int | glyph_width | Width of a glyph. |
| #define _FBG_DEGTORAD | ( | angle_degree | ) | ((angle_degree) * M_PI / 180.0) |
convert a degree angle to radians
Definition at line 851 of file fbgraphics.h.
| #define _FBG_MAX | ( | a, | |
| b | |||
| ) | ((a) > (b) ? a : b) |
integer MAX Math function
Definition at line 844 of file fbgraphics.h.
| #define _FBG_MIN | ( | a, | |
| b | |||
| ) | ((a) < (b) ? a : b) |
integer MIN Math function
Definition at line 846 of file fbgraphics.h.
| #define _FBG_RADTODEG | ( | angle_radians | ) | ((angle_radians) * 180.0 / M_PI) |
convert a radian angle to degree
Definition at line 853 of file fbgraphics.h.
| #define _FBG_SGN | ( | x | ) | ((x<0)?-1:((x>0)?1:0)) |
integer SIGN function
Definition at line 848 of file fbgraphics.h.
| #define _FBG_SOURCE_OVER | ( | a, | |
| b, | |||
| c | |||
| ) | (c * a + b * (1.f - a)) |
Definition at line 855 of file fbgraphics.h.
| #define fbg_fade | ( | fbg, | |
| fade_amount | |||
| ) | fbg_fadeDown(fbg, fade_amount) |
background fade to black with controllable factor
| fbg | pointer to a FBG context / data structure |
| fade_amount | fade amount |
Definition at line 819 of file fbgraphics.h.
| #define fbg_imageScale | ( | fbg, | |
| img, | |||
| x, | |||
| y, | |||
| sx, | |||
| sy | |||
| ) | fbg_imageEx(fbg, img, x, y, sx, sy, 0, 0, img->width, img->height) |
draw a scaled image (Nearest-neighbor algorithm)
| fbg | pointer to a FBG context / data structure |
| img | image structure pointer |
| x | image X position (upper left coordinate) |
| y | image Y position (upper left coordinate) |
| sx | The X scale factor |
| sy | The Y scale factor |
Definition at line 841 of file fbgraphics.h.
| #define fbg_write | ( | fbg, | |
| text, | |||
| x, | |||
| y | |||
| ) | fbg_text(fbg, &fbg->current_font, text, x, y, fbg->text_color.r, fbg->text_color.g, fbg->text_color.b) |
draw a text by using the current font and the current color
| fbg | pointer to a FBG context / data structure |
| text | the text to draw (' ' and ' ' are treated automatically) |
| x | |
| y |
Definition at line 829 of file fbgraphics.h.
| void fbg_background | ( | struct _fbg * | fbg, |
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
clear the background with a color
| fbg | pointer to a FBG context / data structure |
| r | |
| g | |
| b |
| void fbg_clear | ( | struct _fbg * | fbg, |
| unsigned char | brightness | ||
| ) |
fast grayscale background clearing
| fbg | pointer to a FBG context / data structure |
| brightness | pixel brightness (grayscale) |
| void fbg_close | ( | struct _fbg * | fbg | ) |
free up the memory associated with a FB Graphics context and close the framebuffer device
| fbg | pointer to a FBG context / data structure |
| struct _fbg_font* fbg_createFont | ( | struct _fbg * | fbg, |
| struct _fbg_img * | img, | ||
| int | glyph_width, | ||
| int | glyph_height, | ||
| unsigned char | first_char | ||
| ) |
create a bitmap font from an image
| fbg | pointer to a FBG context / data structure |
| img | image structure pointer |
| glyph_width | glyph / character width |
| glyph_height | glyph / character height |
| first_char | the first character of the bitmap font |
create an empty image
| fbg | pointer to a FBG context / data structure |
| width | image width |
| height | image height |
| struct _fbg* fbg_customSetup | ( | int | width, |
| int | height, | ||
| int | components, | ||
| int | initialize_buffers, | ||
| int | allow_resizing, | ||
| void * | user_context, | ||
| void(*)(struct _fbg *fbg) | user_draw, | ||
| void(*)(struct _fbg *fbg) | user_flip, | ||
| void(*)(struct _fbg *fbg, unsigned int new_width, unsigned int new_height) | backend_resize, | ||
| void(*)(struct _fbg *fbg) | user_free | ||
| ) |
initialize a FB Graphics context (typically used by a custom rendering backend)
| width | render width |
| height | render height |
| components | image components (3 = RGB, 4 = RGBA etc.) |
| initialize_buffers | wether internal buffers should be allocated / freed |
| allow_resizing | wether to allow internal context resize (any registered callbacks will still be called) |
| user_context | user rendering data storage (things like window context etc.) |
| user_draw | function to call upon fbg_draw() |
| user_flip | function to call upon fbg_flip() |
| backend_resize | function to call upon fbg_resize() |
| user_free | function to call upon fbg_close() |
| void fbg_draw | ( | struct _fbg * | fbg | ) |
draw to the screen
| fbg | pointer to a FBG context / data structure |
| void fbg_drawFramerate | ( | struct _fbg * | fbg, |
| struct _fbg_font * | fnt, | ||
| int | task, | ||
| int | x, | ||
| int | y, | ||
| int | r, | ||
| int | g, | ||
| int | b | ||
| ) |
draw the framerate of a particular parallel task
| fbg | pointer to a FBG context / data structure |
| fnt | _fbg_font structure pointer |
| task | the task id |
| x | |
| y | |
| r | |
| g | |
| b |
| void fbg_drawInto | ( | struct _fbg * | fbg, |
| unsigned char * | buffer | ||
| ) |
set an offscreen target for all subsequent fbg context draw calls, it is important to reset back to display target once done by calling fbg_drawInto(NULL) otherwise you may have segfaults / memory leaks upon resizing and other actions
| fbg | pointer to a FBG context / data structure |
| buffer | a buffer to render to, it should be the format of the display, target is the display if NULL |
| void fbg_fadeDown | ( | struct _fbg * | fbg, |
| unsigned char | rgb_fade_amount | ||
| ) |
background fade to black with controllable factor
| fbg | pointer to a FBG context / data structure |
| rgb_fade_amount | fade amount |
| void fbg_fadeUp | ( | struct _fbg * | fbg, |
| unsigned char | rgb_fade_amount | ||
| ) |
background fade to white with controllable factor
| fbg | pointer to a FBG context / data structure |
| rgb_fade_amount | fade amount |
| void fbg_fill | ( | struct _fbg * | fbg, |
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
set the filling color for fast drawing operations
| fbg | pointer to a FBG context / data structure |
| r | |
| g | |
| b |
| void fbg_flip | ( | struct _fbg * | fbg | ) |
flip the buffers
| fbg | pointer to a FBG context / data structure |
| void fbg_fpixel | ( | struct _fbg * | fbg, |
| int | x, | ||
| int | y | ||
| ) |
fast pixel drawing which use the fill color set by fbg_fill()
| fbg | pointer to a FBG context / data structure |
| x | pixel X position (upper left coordinate) |
| y | pixel Y position (upper left coordinate) |
| void fbg_frect | ( | struct _fbg * | fbg, |
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h | ||
| ) |
fast rectangle drawing which use the fill color set by fbg_fill()
| fbg | pointer to a FBG context / data structure |
| x | rectangle X position (upper left coordinate) |
| y | rectangle Y position (upper left coordinate) |
| w | rectangle width |
| h | rectangle height |
| void fbg_freeFont | ( | struct _fbg_font * | font | ) |
free the memory associated with a font
| font | _fbg_font structure pointer |
| void fbg_freeImage | ( | struct _fbg_img * | img | ) |
free the memory associated with an image
| img | image structure pointer |
| int fbg_getFramerate | ( | struct _fbg * | fbg, |
| int | task | ||
| ) |
get the framerate of a particular task
| fbg | pointer to a FBG context / data structure |
| task | the task id |
get the RGB value of a pixel
| fbg | pointer to a FBG context / data structure |
| x | |
| y | |
| color | a pointer to a _fbg_rgb data structure |
| void fbg_hline | ( | struct _fbg * | fbg, |
| int | x, | ||
| int | y, | ||
| int | w, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
draw a horizontal line
| fbg | pointer to a FBG context / data structure |
| x | line X position (upper left coordinate) |
| y | line Y position (upper left coordinate) |
| w | line width |
| r | |
| g | |
| b |
| void fbg_hslToRGB | ( | struct _fbg_rgb * | color, |
| float | h, | ||
| float | s, | ||
| float | l | ||
| ) |
convert HSL values to RGB color
| color | pointer to a _fbg_rgb data structure |
| h | the hue |
| s | the saturation |
| l | the lightness |
draw an image
| fbg | pointer to a FBG context / data structure |
| img | image structure pointer |
| x | image X position (upper left coordinate) |
| y | image Y position (upper left coordinate) |
| void fbg_imageClip | ( | struct _fbg * | fbg, |
| struct _fbg_img * | img, | ||
| int | x, | ||
| int | y, | ||
| int | cx, | ||
| int | cy, | ||
| int | cw, | ||
| int | ch | ||
| ) |
draw a clipped image
| fbg | pointer to a FBG context / data structure |
| img | image structure pointer |
| x | image X position (upper left coordinate) |
| y | image Y position (upper left coordinate) |
| cx | The X coordinate where to start clipping |
| cy | The Y coordinate where to start clipping |
| cw | The width of the clipped image (from cx) |
| ch | The height of the clipped image (from cy) |
| void fbg_imageColorkey | ( | struct _fbg * | fbg, |
| struct _fbg_img * | img, | ||
| int | x, | ||
| int | y, | ||
| int | cr, | ||
| int | cg, | ||
| int | cb | ||
| ) |
draw an image with colorkeying support (image colorkey value will be ignored)
| fbg | pointer to a FBG context / data structure |
| img | image structure pointer |
| x | image X position (upper left coordinate) |
| y | image Y position (upper left coordinate) |
| cr | colorkey red component |
| cg | colorkey green component |
| cb | colorkey blue component |
| void fbg_imageEx | ( | struct _fbg * | fbg, |
| struct _fbg_img * | img, | ||
| int | x, | ||
| int | y, | ||
| float | sx, | ||
| float | sy, | ||
| int | cx, | ||
| int | cy, | ||
| int | cw, | ||
| int | ch | ||
| ) |
draw an image with support for clipping and scaling (Nearest-neighbor algorithm)
| fbg | pointer to a FBG context / data structure |
| img | image structure pointer |
| x | image X position (upper left coordinate) |
| y | image Y position (upper left coordinate) |
| sx | The X scale factor |
| sy | The Y scale factor |
| cx | The X coordinate where to start clipping |
| cy | The Y coordinate where to start clipping |
| cw | The width of the clipped image (from cx) |
| ch | The height of the clipped image (from cy) |
| void fbg_imageFlip | ( | struct _fbg_img * | img | ) |
flip an image vertically
| img | image structure pointer |
| void fbg_line | ( | struct _fbg * | fbg, |
| int | x1, | ||
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
draw a line from two points (Bresenham algorithm)
| fbg | pointer to a FBG context / data structure |
| x1 | point 1 X position (upper left coordinate) |
| y1 | point 1 Y position (upper left coordinate) |
| x2 | point 2 X position (upper left coordinate) |
| y2 | point 2 Y position (upper left coordinate) |
| r | |
| g | |
| b |
load an image (PNG or JPEG)
| fbg | pointer to a FBG context / data structure |
| filename | JPEG/PNG image filename |
load a JPEG image from a file (NanoJPEG library)
| fbg | pointer to a FBG context / data structure |
| filename | JPEG image filename |
load a PNG image from a file (lodePNG library)
| fbg | pointer to a FBG context / data structure |
| filename | PNG image filename |
| void fbg_pixel | ( | struct _fbg * | fbg, |
| int | x, | ||
| int | y, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
draw a pixel
| fbg | pointer to a FBG context / data structure |
| x | pixel X position (upper left coordinate) |
| y | pixel Y position (upper left coordinate) |
| r | |
| g | |
| b |
| void fbg_pixela | ( | struct _fbg * | fbg, |
| int | x, | ||
| int | y, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b, | ||
| unsigned char | a | ||
| ) |
draw a pixel with alpha component (alpha blending)
| fbg | pointer to a FBG context / data structure |
| x | pixel X position (upper left coordinate) |
| y | pixel Y position (upper left coordinate) |
| r | |
| g | |
| b | |
| a |
| void fbg_plot | ( | struct _fbg * | fbg, |
| int | index, | ||
| unsigned char | value | ||
| ) |
direct pixel access from index value
| fbg | pointer to a FBG context / data structure |
| index | pixel index in the buffer |
| value | color value |
| void fbg_polygon | ( | struct _fbg * | fbg, |
| int | num_vertices, | ||
| int * | vertices, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
draw a polygon
| fbg | pointer to a FBG context / data structure |
| num_vertices | the number of vertices |
| vertices | pointer to a list of vertices (a list of X/Y points) |
| r | |
| g | |
| b |
| void fbg_pushResize | ( | struct _fbg * | fbg, |
| int | new_width, | ||
| int | new_height | ||
| ) |
push a resize event for the FB Graphics context note : the resize event is processed into the fbg_draw function note : resizing is not yet allowed in framebuffer mode note : if you want to immediately resize the context, see fbg_resize
| fbg | pointer to a FBG context / data structure |
| new_width | new render width |
| new_height | new render height |
| float fbg_randf | ( | float | min, |
| float | max | ||
| ) |
pseudo random number between min / max
| min | |
| max |
| void fbg_rect | ( | struct _fbg * | fbg, |
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
draw a rectangle
| fbg | pointer to a FBG context / data structure |
| x | rectangle X position (upper left coordinate) |
| y | rectangle Y position (upper left coordinate) |
| w | rectangle width |
| h | rectangle height |
| r | |
| g | |
| b |
| void fbg_recta | ( | struct _fbg * | fbg, |
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b, | ||
| unsigned char | a | ||
| ) |
draw a rectangle with alpha transparency
| fbg | pointer to a FBG context / data structure |
| x | rectangle X position (upper left coordinate) |
| y | rectangle Y position (upper left coordinate) |
| w | rectangle width |
| h | rectangle height |
| r | |
| g | |
| b | |
| a |
| void fbg_resize | ( | struct _fbg * | fbg, |
| int | new_width, | ||
| int | new_height | ||
| ) |
resize the FB Graphics context immediately note : prefer the usage of fbg_pushResize when integrating the resize event of a custom backend (fbg_pushResize is thread safe all the time) note : resizing is not yet allowed in framebuffer mode
| fbg | pointer to a FBG context / data structure |
| new_width | new render width |
| new_height | new render height |
| void fbg_rgbToHsl | ( | struct _fbg_hsl * | color, |
| float | r, | ||
| float | g, | ||
| float | b | ||
| ) |
convert RGB values to HSL color
| color | pointer to a _fbg_hsl data structure |
| r | |
| g | |
| b |
| void fbg_setResizeCallback | ( | struct _fbg * | fbg, |
| void(*)(struct _fbg *fbg, unsigned int new_width, unsigned int new_height) | user_resize | ||
| ) |
register a user resize callback
| fbg | pointer to a FBG context / data structure |
| user_resize | resize function |
| void fbg_text | ( | struct _fbg * | fbg, |
| struct _fbg_font * | fnt, | ||
| char * | text, | ||
| int | x, | ||
| int | y, | ||
| int | r, | ||
| int | g, | ||
| int | b | ||
| ) |
draw a text
| fbg | pointer to a FBG context / data structure |
| fnt | _fbg_font structure pointer |
| text | the text to draw (' ' and ' ' are treated automatically) |
| x | |
| y | |
| r | |
| g | |
| b |
| void fbg_textBackground | ( | struct _fbg * | fbg, |
| int | r, | ||
| int | g, | ||
| int | b, | ||
| int | a | ||
| ) |
set the current text background color (based on colorkey value!)
| fbg | pointer to a FBG context / data structure |
| r | |
| g | |
| b | |
| a | 0 = transparent background (based on colorkey), 255 = full text background |
| void fbg_textColor | ( | struct _fbg * | fbg, |
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
set the current text color
| fbg | pointer to a FBG context / data structure |
| r | |
| g | |
| b |
| void fbg_textColorKey | ( | struct _fbg * | fbg, |
| unsigned char | v | ||
| ) |
set the current text color key
| fbg | pointer to a FBG context / data structure |
| v | grayscale value |
set the current font
| fbg | pointer to a FBG context / data structure |
| font | _fbg_font structure pointer |
| void fbg_vline | ( | struct _fbg * | fbg, |
| int | x, | ||
| int | y, | ||
| int | h, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
draw a vertical line
| fbg | pointer to a FBG context / data structure |
| x | line X position (upper left coordinate) |
| y | line Y position (upper left coordinate) |
| h | line height |
| r | |
| g | |
| b |
1.8.13