Main Page   File List   Globals  

FBlib.h File Reference

Definitions common to all FBlib programs. More...

Go to the source code of this file.

Defines

#define DEFAULT_FONT   "/usr/share/consolefonts/iso01.f14.psf.gz"

Functions

int FB_initlib (char *dev)
int FB_exit ()
FB_pixel FB_makecol (u_char r, u_char g, u_char b, u_char t)
void FB_clear_screen (FB_pixel color)
void FB_putpixel (int x, int y, FB_pixel color)
FB_pixel FB_getpixel (int x, int y)
void FB_line (int sx, int sy, int ex, int ey, FB_pixel color)
void FB_vline (int x, int sy, int ey, FB_pixel color)
void FB_hline (int sx, int ex, int y, FB_pixel color)
void FB_rect (int sx, int sy, int ex, int ey, FB_pixel color)
void FB_rectfill (int sx, int sy, int ex, int ey, FB_pixel color)
void FB_triangle (int x1, int y1, int x2, int y2, int x3, int y3, FB_pixel col)
void FB_circle (int cx, int cy, int radius, FB_pixel color)
int FB_getVisual ()
void FB_getres (int *x, int *y)
int FB_getxres ()
int FB_getyres ()
int FB_getXVres ()
int FB_getYVres ()
int FB_getbpp ()
int FB_setbpp (int bpp)
int FB_kb_init ()
int FB_get_key ()
void FB_kb_end ()
int FB_change_font (char *psf_file)
int FB_putc (int c, int x, int y, FB_pixel col)
int FB_printf (int x, int y, FB_pixel col, char *format,...)

Variables

int FB_visible


Detailed Description

This file must be included in every program that will use libFB
begin : Mon Nov 20 2000
copyright : (C) 2000 by Daniele Venzano
email : venza@users.sf.net

Definition in file FBlib.h.


Define Documentation

#define DEFAULT_FONT   "/usr/share/consolefonts/iso01.f14.psf.gz"
 

Default font used by font engine

Definition at line 34 of file FBlib.h.

Referenced by FB_initlib().


Function Documentation

int FB_initlib char *    dev
 

This function must be called before any other call to other parts of FBlib, it makes some initialization and sets up the handler for a nice VT switch.

Parameters:
dev  The framebuffer device name (eg. "/dev/fb0")

Definition at line 19 of file FBinit.c.

References DEFAULT_FONT, and FB_change_font().

int FB_exit  
 

You must call this at the end of your program to free up memory and reset the framebuffer device.

Return values:
OK  No error
IOCTL_ERR  The framebuffer settings could't be restored to their initial value

Definition at line 120 of file FBinit.c.

References FB_kb_end(), and FB_visible.

FB_pixel FB_makecol u_char    r,
u_char    g,
u_char    b,
u_char    t
[inline]
 

Bit magic to create a framebuffer dependent representation of a 16/32 bit color. The bpp used is the one the fb is currently set at.

Parameters:
r  red component 0 - 255
g  green component 0 - 255
b  blue comoponent 0 - 255
t  transparency 0 - 255 (not supported on some kernel drivers)

Definition at line 17 of file FButil.c.

void FB_clear_screen FB_pixel    color
 

Fills all the screen with the same color. Currently VERY slow.

Parameters:
color  Color used to redraw the screen

Definition at line 320 of file FBdraw.c.

References FB_getxres(), FB_getyres(), and FB_putpixel().

void FB_putpixel int    x,
int    y,
FB_pixel    color
[inline]
 

Draws a pixel.

Parameters:
x  X coordinate
y  Y coordinate
color  Color of the pixel being drawn

Definition at line 71 of file FBdraw.c.

References FB_getxres(), and FB_getyres().

Referenced by FB_circle(), FB_clear_screen(), FB_hline(), FB_line(), FB_putc(), FB_rectfill(), and FB_vline().

FB_pixel FB_getpixel int    x,
int    y
 

Reads the color of a pixel.

Parameters:
x  X coordinate
y  Y coordinate

Definition at line 86 of file FBdraw.c.

References FB_getbpp().

void FB_line int    sx,
int    sy,
int    ex,
int    ey,
FB_pixel    color
 

Draws a line.

Parameters:
sx  Start x coordinate
sy  Start y coordinate
ex  End x coordinate
ey  End y coordinate
color  Color of the line

Definition at line 165 of file FBdraw.c.

References FB_hline(), FB_putpixel(), and FB_vline().

Referenced by FB_triangle().

void FB_vline int    x,
int    sy,
int    ey,
FB_pixel    color
 

Optimized version of line() to draw a vertical line

Definition at line 103 of file FBdraw.c.

References FB_getxres(), FB_getyres(), and FB_putpixel().

Referenced by FB_line(), and FB_rect().

void FB_hline int    sx,
int    ex,
int    y,
FB_pixel    color
 

Optimized version of line() to draw an horizontal line

Definition at line 135 of file FBdraw.c.

References FB_getxres(), FB_getyres(), and FB_putpixel().

Referenced by FB_line(), and FB_rect().

void FB_rect int    sx,
int    sy,
int    ex,
int    ey,
FB_pixel    color
 

Draws a rectangle (only borders).

Parameters:
sx,sy  Upper left corner
ex,ey  Lower right corner

Definition at line 241 of file FBdraw.c.

References FB_hline(), and FB_vline().

void FB_rectfill int    sx,
int    sy,
int    ex,
int    ey,
FB_pixel    color
 

Same as FB_rect, but the rectangle is filled

Definition at line 253 of file FBdraw.c.

References FB_getxres(), FB_getyres(), and FB_putpixel().

void FB_triangle int    x1,
int    y1,
int    x2,
int    y2,
int    x3,
int    y3,
FB_pixel    col
 

Draws a triangle

Parameters:
x1,y1  First vertex
x2,y2  Second vertex
x3,y3  Third vertex
col  Color

Definition at line 288 of file FBdraw.c.

References FB_line().

void FB_circle int    cx,
int    cy,
int    radius,
FB_pixel    color
 

Draws a circle

Parameters:
cx,cy  Position of the center
radius  Radius of the circle
color  Color

Definition at line 297 of file FBdraw.c.

References FB_putpixel().

int FB_getVisual  
 

Returns one of the following values, they are all defined in linux/fb.h

Return values:
FB_VISUAL_MONO01  0 Monochr. 1=Black 0=White
FB_VISUAL_MONO10  1 Monochr. 1=White 0=Black
FB_VISUAL_TRUECOLOR  2 True color
FB_VISUAL_PSEUDOCOLOR  3 Pseudo color (like atari)
FB_VISUAL_DIRECTCOLOR  4 Direct color
FB_VISUAL_STATIC_PSEUDOCOLOR  5 Pseudo color readonly

Definition at line 34 of file FButil.c.

void FB_getres int *    x,
int *    y
 

Sets x and y respectively to the width and height of the visible screen

Definition at line 39 of file FButil.c.

int FB_getxres  
 

Returns the width of the visible screen

Definition at line 57 of file FButil.c.

Referenced by FB_clear_screen(), FB_hline(), FB_putpixel(), FB_rectfill(), and FB_vline().

int FB_getyres  
 

Returns the height of the visible screen

Definition at line 65 of file FButil.c.

Referenced by FB_clear_screen(), FB_hline(), FB_putpixel(), FB_rectfill(), and FB_vline().

int FB_getXVres  
 

Returns virtual screen width

Definition at line 73 of file FButil.c.

int FB_getYVres  
 

Returns virtual screen height

Definition at line 81 of file FButil.c.

int FB_getbpp  
 

Returns color depth the framebuffer is set to. It can be 16 or 32

Definition at line 89 of file FButil.c.

Referenced by FB_getpixel().

int FB_setbpp int    bpp
 

Change the color depth of the framebuffer, this function can fail, so check always the return value:

Return values:
OK  No error
PARAM_ERR  Color depth not supported
IOCTL_ERR  Probably the color depth is not supported by the graphic device

Definition at line 94 of file FButil.c.

int FB_kb_init  
 

Initialize keyboard handling, don't call if you don't need it

Definition at line 37 of file FBkeyb.c.

int FB_get_key  
 

Look at input buffer if there is some event not handled.

Return values:
NO_KEY  There are no keypresses unhandled
-anything  else- Keypress (look at ncurses.h and keys.h

Definition at line 76 of file FBkeyb.c.

void FB_kb_end  
 

Ends keyboard usage, is called, if necessary by FB_end()

Definition at line 88 of file FBkeyb.c.

Referenced by FB_exit().

int FB_change_font char *    psf_file
 

Change the font set used to draw caracters. Can also use psf files compressed with gzip.

Parameters:
psf_file  Path to the .psf or .psf.gz file that conteins the new font set
Return values:
OK  No error
PARAM_ERR  The file was not found or it wasn't in psf format

Definition at line 34 of file FBfont.c.

Referenced by FB_initlib().

int FB_putc int    c,
int    x,
int    y,
FB_pixel    col
 

Same as putc function from your favourite libc.

Parameters:
c  ASCII code of the caracter to display
x,y  position of the upper left corner of the caracter
col  color of the caracter
Return values:
OK  No error
PARAM_ERR  You requested a glyph with a code > 255 using a font set with only 255 gliphs

Definition at line 86 of file FBfont.c.

References FB_putpixel().

Referenced by FB_printf().

int FB_printf int    x,
int    y,
FB_pixel    col,
char *    format,
...   
 

Same as usula printf, extend to draw everywhere in the screen

Parameters:
x,y  Position of the upper left corner of the first caracter
col  Color of the whole string
format  Format string of the output, same format as printf, but only \r, \n %d %x %c %g %% are supported
...  format variables
Return values:
0  Should return something usefull, but will return always 0

Definition at line 107 of file FBfont.c.

References FB_putc().


Variable Documentation

int FB_visible
 

If TRUE user is on the same VT as FBlib program

Definition at line 66 of file FBlib.h.

Referenced by FB_exit().


Generated on Sat Jul 5 09:04:52 2003 for LibFB by doxygen1.2.18