Lab2
Functions

video_gr

Functions

void * vg_init (unsigned short mode)
 Initializes the video module in graphics mode.
int vg_fill (unsigned long color)
 Fills the screen with the input color.
int vg_set_pixel (unsigned long x, unsigned long y, unsigned long color)
 Sets input pixel with input color.
long vg_get_pixel (unsigned long x, unsigned long y)
 Returns the color of the input pixel.
int vg_draw_line (unsigned long xi, unsigned long yi, unsigned long xf, unsigned long yf, unsigned long color)
 Draw line segment with specifed end points and color.
int vg_exit (void)
 Returns to default Minix 3 text mode (0x03: 25 x 80, 16 colors)

Detailed Description

Functions for outputing data to screen in graphics mode


Function Documentation

void* vg_init ( unsigned short  mode)

Initializes the video module in graphics mode.

Uses the VBE INT 0x10 interface to set the desired graphics mode, maps VRAM to the process' address space and initializes static global variables with the resolution of the screen, and the number of colors

Parameters:
mode16-bit VBE mode to set
Returns:
Virtual address VRAM was mapped to. NULL, upon failure.
int vg_fill ( unsigned long  color)

Fills the screen with the input color.

Parameters:
colorcolor to fill the screen with
Returns:
0 on success, non-zero upon failure
int vg_set_pixel ( unsigned long  x,
unsigned long  y,
unsigned long  color 
)

Sets input pixel with input color.

Sets the color of the pixel at the specified position to the input value, by writing to the corresponding location in VRAM

Parameters:
xhorizontal coordinate, starts at 0 (leftmost pixel)
yvertical coordinate, starts at 0 (top pixel)
colorcolor to set the pixel
Returns:
0 on success, non-zero otherwise
long vg_get_pixel ( unsigned long  x,
unsigned long  y 
)

Returns the color of the input pixel.

Returns the color of the pixel at the specified position, by reading to the corresponding location in VRAM

Parameters:
xhorizontal coordinate, starts at 0 (leftmost pixel)
yvertical coordinate, starts at 0 (top pixel)
Returns:
color of the pixel at coordinates (x,y), or -1 if some input argument is not valid
int vg_draw_line ( unsigned long  xi,
unsigned long  yi,
unsigned long  xf,
unsigned long  yf,
unsigned long  color 
)

Draw line segment with specifed end points and color.

Draws a line segment with the specified end points and the input color, by writing to VRAM

Parameters:
xihorizontal coordinate of "first" endpoint, starts at 0 (leftmost pixel)
yivertical coordinate of "first" endpoint, starts at 0 (top pixel)
xfhorizontal coordinate of "last" endpoint, starts at 0 (leftmost pixel)
yfvertical coordinate of "last" endpoint, starts at 0 (top pixel)
colorcolor of the line segment to draw
Returns:
0 upon success, non-zero upon failure
int vg_exit ( void  )

Returns to default Minix 3 text mode (0x03: 25 x 80, 16 colors)

Returns:
0 upon success, non-zero upon failure
 All Data Structures Variables