MentOS  0.8.0
The Mentoring Operating System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Functions
vga.h File Reference

Functions required to manage the Video Graphics Array (VGA). More...

Go to the source code of this file.

Functions

void vga_initialize (void)
 Initializes the VGA.
 
void vga_finalize (void)
 Finalizes the VGA.
 
void vga_update (void)
 Updates the graphic elements.
 
int vga_is_enabled (void)
 Checks if the VGA is enabled. More...
 
int vga_width (void)
 Returns the width of the screen. More...
 
int vga_height (void)
 Returns the height of the screen. More...
 
void vga_clear_screen (void)
 Clears the screen.
 
void vga_draw_pixel (int x, int y, unsigned char color)
 Draws a pixel at the given position. More...
 
unsigned int vga_read_pixel (int x, int y)
 Reads a pixel at the given position. More...
 
void vga_draw_char (int x, int y, unsigned char c, unsigned char color)
 Draws a character at the given position. More...
 
void vga_draw_string (int x, int y, const char *str, unsigned char color)
 Draws a string at the given position. More...
 
void vga_draw_line (int x0, int y0, int x1, int y1, unsigned char color)
 Draws a line from point 1 to point 2. More...
 
void vga_draw_rectangle (int sx, int sy, int w, int h, unsigned char color)
 Draws a rectangle provided the position of the starting corner and the ending corner. More...
 
void vga_draw_circle (int xc, int yc, int r, unsigned char color)
 Draws a circle provided the position of the center and the radius. More...
 
void vga_draw_triangle (int x1, int y1, int x2, int y2, int x3, int y3, unsigned char color)
 Draws a triangle. More...
 
void vga_putc (int c)
 Print the given character on the screen. More...
 
void vga_puts (const char *str)
 Prints the given string on the screen. More...
 
void vga_move_cursor (unsigned int x, unsigned int y)
 Move the cursor at the position x, y on the screen. More...
 
void vga_get_cursor_position (unsigned int *x, unsigned int *y)
 Returns cursor's position on the screen. More...
 
void vga_get_screen_size (unsigned int *width, unsigned int *height)
 Returns screen size. More...
 
void vga_new_line (void)
 Move to the following line (the effect of
character).
 
void vga_set_color (unsigned int color)
 Change the color. More...
 
void vga_run_test (void)
 Run some VGA tests.
 

Detailed Description

Functions required to manage the Video Graphics Array (VGA).

Function Documentation

◆ vga_draw_char()

void vga_draw_char ( int  x,
int  y,
unsigned char  c,
unsigned char  color 
)

Draws a character at the given position.

Parameters
xx-axis position.
yy-axis position.
ccharacter to draw.
colorcolor of the character.

◆ vga_draw_circle()

void vga_draw_circle ( int  xc,
int  yc,
int  r,
unsigned char  color 
)

Draws a circle provided the position of the center and the radius.

Parameters
xcx-axis position.
ycy-axis position.
rradius.
colorused to draw the circle.

◆ vga_draw_line()

void vga_draw_line ( int  x0,
int  y0,
int  x1,
int  y1,
unsigned char  color 
)

Draws a line from point 1 to point 2.

Parameters
x0point 1 x-axis position.
y0point 1 y-axis position.
x1point 2 x-axis position.
y1point 2 y-axis position.
colorcolor of the line.

◆ vga_draw_pixel()

void vga_draw_pixel ( int  x,
int  y,
unsigned char  color 
)

Draws a pixel at the given position.

Parameters
xx-axis position.
yy-axis position.
colorcolor of the character.

◆ vga_draw_rectangle()

void vga_draw_rectangle ( int  sx,
int  sy,
int  w,
int  h,
unsigned char  color 
)

Draws a rectangle provided the position of the starting corner and the ending corner.

Parameters
sxtop-left corner x-axis position.
sytop-left corner y-axis position.
wwidth.
hheight.
colorcolor of the rectangle.

◆ vga_draw_string()

void vga_draw_string ( int  x,
int  y,
const char *  str,
unsigned char  color 
)

Draws a string at the given position.

Parameters
xx-axis position.
yy-axis position.
strstring to draw.
colorcolor of the character.

◆ vga_draw_triangle()

void vga_draw_triangle ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3,
unsigned char  color 
)

Draws a triangle.

Parameters
x11st point x-axis position.
y11st point y-axis position.
x22nd point x-axis position.
y22nd point y-axis position.
x33rd point x-axis position.
y33rd point y-axis position.
colorused to draw the triangle.

◆ vga_get_cursor_position()

void vga_get_cursor_position ( unsigned int *  x,
unsigned int *  y 
)

Returns cursor's position on the screen.

Parameters
xThe output x coordinate.
yThe output y coordinate.

◆ vga_get_screen_size()

void vga_get_screen_size ( unsigned int *  width,
unsigned int *  height 
)

Returns screen size.

Parameters
widthThe screen width.
heightThe screen height.

◆ vga_height()

int vga_height ( void  )

Returns the height of the screen.

Returns
the height of the screen.

◆ vga_is_enabled()

int vga_is_enabled ( void  )

Checks if the VGA is enabled.

Returns
1 if enabled, 0 otherwise.

◆ vga_move_cursor()

void vga_move_cursor ( unsigned int  x,
unsigned int  y 
)

Move the cursor at the position x, y on the screen.

Parameters
xThe x coordinate.
yThe y coordinate.

◆ vga_putc()

void vga_putc ( int  c)

Print the given character on the screen.

Parameters
cThe character to print.

◆ vga_puts()

void vga_puts ( const char *  str)

Prints the given string on the screen.

Parameters
strThe string to print.

◆ vga_read_pixel()

unsigned int vga_read_pixel ( int  x,
int  y 
)

Reads a pixel at the given position.

Parameters
xx-axis position.
yy-axis position.
Returns
the pixel we read.

◆ vga_set_color()

void vga_set_color ( unsigned int  color)

Change the color.

Parameters
colorthe color to set.

◆ vga_width()

int vga_width ( void  )

Returns the width of the screen.

Returns
the width of the screen.