#ifndef VIDEO_H #define VIDEO_H #include "driver.h" #include typedef enum { VIDEO_MODE_TYPE_TEXT, VIDEO_MODE_TYPE_GRAPHICS } video_mode_type_t; #define MAX_NOF_VIDEO_MODES 255 typedef struct { video_mode_type_t mode_type; int x; int y; int color_depth; } video_mode_t; typedef struct { driver_t base; unsigned int nof_modes; const video_mode_t *modes[MAX_NOF_VIDEO_MODES]; const video_mode_t *mode; } video_t; typedef struct { int R; int G; int B; } video_rgb_color_t; typedef struct { driver_vtable_t base; void (*register_mode)( void *obj, const video_mode_t *mode ); bool (*supports_mode)( void *obj, const video_mode_t mode ); bool (*set_mode)( void *obj, const video_mode_t mode ); bool (*switch_mode)( void *obj, const video_mode_t *mode ); void (*set_pixel)( void *obj, const int x, const int y, const video_rgb_color_t color ); void (*draw_rectangle)( void *obj, const int x, const int y, const int w, const int h, const video_rgb_color_t color ); void (*clear_screen)( void *obj, const video_rgb_color_t color ); void (*draw_char)( void *obj, const unsigned char c, const int x, const int y, const video_rgb_color_t background, const video_rgb_color_t foreground ); void (*wait_for_retrace)( void *obj ); void (*use_z_buffer)( void *obj, bool use ); void (*refresh)( void *obj ); } video_vtable_t; void video_init( video_t *video, interrupt_t *interrupt, void *context ); video_mode_t video_make_mode( const video_mode_type_t mode_type, const int x, const int y, const int color_depth ); void video_register_mode( void *obj, const video_mode_t *mode ); bool video_supports_mode( void *obj, const video_mode_t mode ); bool video_set_mode( void *obj, const video_mode_t mode ); bool video_switch_mode( void *obj, const video_mode_t *mode ); extern const video_rgb_color_t VIDEO_RGB_COLOR_BLACK; extern const video_rgb_color_t VIDEO_RGB_COLOR_BLUE; extern const video_rgb_color_t VIDEO_RGB_COLOR_GREEN; extern const video_rgb_color_t VIDEO_RGB_COLOR_CYAN; extern const video_rgb_color_t VIDEO_RGB_COLOR_RED; extern const video_rgb_color_t VIDEO_RGB_COLOR_MAGENTA; extern const video_rgb_color_t VIDEO_RGB_COLOR_BROWN; extern const video_rgb_color_t VIDEO_RGB_COLOR_GRAY; extern const video_rgb_color_t VIDEO_RGB_COLOR_WHITE; video_rgb_color_t video_make_rgb_color( const int R, const int G, const int B ); void video_set_pixel( void *obj, const int x, const int y, const video_rgb_color_t color ); void video_draw_rectangle( void *obj, const int x, const int y, const int w, const int h, const video_rgb_color_t color ); void video_clear_screen( void *obj, const video_rgb_color_t color ); void video_draw_char( void *obj, const unsigned char c, const int x, const int y, const video_rgb_color_t background, const video_rgb_color_t foreground ); void video_wait_for_retrace( void *obj ); void video_use_z_buffer( void *obj, bool use ); void video_refresh( void *obj ); #endif // VIDEO_H