Next: Bitmap API, Previous: Video API, Up: Video Subsystem [Contents][Index]
grub_err_t rc; /* Try to initialize video mode 1024 x 768 with direct RGB. */ rc = grub_video_setup (1024, 768, GRUB_VIDEO_MODE_TYPE_RGB); if (rc != GRUB_ERR_NONE) { /* Fall back to standard VGA Index Color mode. */ rc = grub_video_setup (640, 480, GRUB_VIDEO_MODE_TYPE_INDEX); if (rc != GRUB_ERR_NONE) { /* Handle error. */ } }
grub_uint32_t x, y, width, height; grub_video_color_t color; struct grub_font_glyph glyph; grub_err_t rc; /* Query existing viewport. */ grub_video_get_viewport (&x, &y, &width, &height); /* Fill background. */ color = grub_video_map_color (GRUB_COLOR_BACKGROUND); grub_video_fill_rect (color, 0, 0, width, height); /* Setup console viewport. */ grub_video_set_viewport (x + 10, y + 10, width - 20, height - 20); grub_video_get_viewport (&x, &y, &width, &height); color = grub_video_map_color (GRUB_COLOR_CONSOLE_BACKGROUND); grub_video_fill_rect (color, 0, 0, width, height); /* Draw text to viewport. */ color = grub_video_map_color (GRUB_COLOR_CONSOLE_TEXT); grub_font_get_glyph ('X', &glyph); grub_video_blit_glyph (&glyph, color, 0, 0);