![]() |
Max OS 0.3
|
Handles the printing of characters and strings to the screen using a framebuffer. More...
#include <framebuffer.h>
Public Member Functions | |
| FramebufferConsole (multiboot_tag_framebuffer *framebuffer_info) | |
| Constructs a new VESA Boot Console object, initializing the console area for text output. | |
| uint16_t | width () final |
| Gets the width of the console. | |
| uint16_t | height () final |
| Gets the height of the console. | |
| void | finish () const |
| Cleans up the boot console. | |
| void | put_character (uint16_t x, uint16_t y, char) final |
| Places a character at the specified location. | |
| void | set_foreground_color (uint16_t x, uint16_t y, common::ConsoleColour) final |
| Sets the foreground color at the specified location. | |
| void | set_background_color (uint16_t x, uint16_t y, common::ConsoleColour) final |
| Sets the background color at the specified location. | |
| void | scroll_up (uint16_t left, uint16_t top, uint16_t width, uint16_t height, common::ConsoleColour foreground, common::ConsoleColour background, char fill) final |
| Scrolls the console up by 1 line. | |
| char | get_character (uint16_t x, uint16_t y) final |
| Gets the character at the specified location. | |
| common::ConsoleColour | get_foreground_color (uint16_t x, uint16_t y) final |
| Gets the foreground color at the specified location. | |
| common::ConsoleColour | get_background_color (uint16_t x, uint16_t y) final |
| Gets the background color at the specified location. | |
Public Member Functions inherited from MaxOS::console::Console | |
| virtual void | put_character (uint16_t x, uint16_t y, char c, common::ConsoleColour foreground, common::ConsoleColour background) |
| Put a character on the console with a given foreground and background color. | |
| virtual void | put_string (uint16_t x, uint16_t y, string string, common::ConsoleColour foreground=common::ConsoleColour::LightGrey, common::ConsoleColour background=common::ConsoleColour::Black) |
| Put a string on the console. | |
| virtual void | scroll_up () |
| Scroll the entire console up by 1 line. | |
| virtual void | clear () |
| virtual void | clear (uint16_t left, uint16_t top, uint16_t width, uint16_t height, common::ConsoleColour foreground=common::ConsoleColour::LightGrey, common::ConsoleColour background=common::ConsoleColour::Black, char fill=' ') |
| Clear an area of the console. | |
| virtual void | invert_colors (uint16_t x, uint16_t y) |
| Invert the colors of a character on the console. | |
Static Public Member Functions | |
| static void | print_logo (bool is_panic=false) |
| Prints the logo to the center of the screen. | |
| static void | update_progress_bar (uint8_t percentage) |
| Updates the progress bar. | |
Public Attributes | |
| ConsoleStream * | cout |
| The boot console output stream. | |
Handles the printing of characters and strings to the screen using a framebuffer.
Definition at line 295 of file framebuffer.h.
|
explicit |
Constructs a new VESA Boot Console object, initializing the console area for text output.
| framebuffer_info | The frame buffer to draw text onto |
Definition at line 25 of file framebuffer.cpp.
References MaxOS::Logger::active_logger(), MaxOS::Logger::add_log_writer(), MaxOS::console::Console::clear(), multiboot_tag_framebuffer::common, cout, MaxOS::Logger::DEBUG(), multiboot_tag_framebuffer_common::framebuffer_addr, multiboot_tag_framebuffer_common::framebuffer_bpp, multiboot_tag_framebuffer_common::framebuffer_height, multiboot_tag_framebuffer_common::framebuffer_pitch, height(), MaxOS::Logger::INFO(), MaxOS::memory::MemoryManager::kmalloc(), MaxOS::memory::PhysicalMemoryManager::map_area(), MaxOS::memory::PRESENT, print_logo(), MaxOS::memory::PhysicalMemoryManager::reserve(), MaxOS::memory::PhysicalMemoryManager::s_current_manager, MaxOS::memory::PhysicalMemoryManager::size_to_frames(), MaxOS::memory::PhysicalMemoryManager::to_dm_region(), width(), and MaxOS::memory::WRITE.
| void FramebufferConsole::finish | ( | ) | const |
Cleans up the boot console.
Definition at line 379 of file framebuffer.cpp.
References MaxOS::Logger::active_logger(), cout, MaxOS::Logger::disable_log_writer(), MaxOS::Logger::HEADER(), and MaxOS::console::ConsoleStream::set_cursor().
Referenced by kernel_main().
|
finalvirtual |
Gets the background color at the specified location.
| x | The x coordinate |
| y | The y coordinate |
Reimplemented from MaxOS::console::Console.
Definition at line 259 of file framebuffer.cpp.
References height(), MaxOS::system::CPU::panic_lock, and width().
Referenced by put_character(), and scroll_up().
|
finalvirtual |
Gets the character at the specified location.
| x | The x coordinate |
| y | The y coordinate |
Reimplemented from MaxOS::console::Console.
Definition at line 216 of file framebuffer.cpp.
|
finalvirtual |
Gets the foreground color at the specified location.
| x | The x coordinate |
| y | The y coordinate |
Reimplemented from MaxOS::console::Console.
Definition at line 236 of file framebuffer.cpp.
References height(), MaxOS::system::CPU::panic_lock, and width().
Referenced by put_character(), and scroll_up().
|
finalvirtual |
Gets the height of the console.
Reimplemented from MaxOS::console::Console.
Definition at line 80 of file framebuffer.cpp.
References multiboot_tag_framebuffer::common, MaxOS::console::FONT_HEIGHT, and multiboot_tag_framebuffer_common::framebuffer_height.
Referenced by FramebufferConsole(), get_background_color(), get_character(), get_foreground_color(), put_character(), scroll_up(), set_background_color(), and set_foreground_color().
|
static |
Prints the logo to the center of the screen.
| is_panic | Whether to print the kernel panic logo or the normal logo |
Definition at line 280 of file framebuffer.cpp.
References MaxOS::common::GraphicsContext::colour_to_int(), multiboot_tag_framebuffer::common, multiboot_tag_framebuffer_common::framebuffer_addr, multiboot_tag_framebuffer_common::framebuffer_bpp, multiboot_tag_framebuffer_common::framebuffer_height, multiboot_tag_framebuffer_common::framebuffer_width, LOGO_HEADER_PIXEL, LOGO_HEIGHT, LOGO_WIDTH, MaxOS::memory::PhysicalMemoryManager::to_dm_region(), and update_progress_bar().
Referenced by FramebufferConsole(), and MaxOS::system::CPU::prepare_for_panic().
|
finalvirtual |
Places a character at the specified location.
| x | The x coordinate |
| y | The y coordinate |
| c | The character to place |
Reimplemented from MaxOS::console::Console.
Definition at line 91 of file framebuffer.cpp.
References MaxOS::common::GraphicsContext::colour_to_int(), MaxOS::console::FONT_HEIGHT, MaxOS::console::FONT_PADDING, MaxOS::console::FONT_WIDTH, get_background_color(), get_foreground_color(), height(), and width().
|
finalvirtual |
Scrolls the console up by 1 line.
| left | The left coordinate of the area to scroll |
| top | The top coordinate of the area to scroll |
| width | The width of the area to scroll |
| height | The height of the area to scroll |
| foreground | The foreground color of the new line |
| background | The background color of the new line |
| fill | The character to fill the new line with |
Reimplemented from MaxOS::console::Console.
Definition at line 326 of file framebuffer.cpp.
References MaxOS::common::GraphicsContext::colour_to_int(), multiboot_tag_framebuffer::common, MaxOS::console::FONT_HEIGHT, MaxOS::console::FONT_WIDTH, multiboot_tag_framebuffer_common::framebuffer_width, get_background_color(), get_foreground_color(), height(), set_background_color(), set_foreground_color(), and width().
|
finalvirtual |
Sets the background color at the specified location.
| x | The x coordinate |
| y | The y coordinate |
| background | The background color |
Reimplemented from MaxOS::console::Console.
Definition at line 196 of file framebuffer.cpp.
References height(), and width().
Referenced by scroll_up().
|
finalvirtual |
Sets the foreground color at the specified location.
| x | The x coordinate |
| y | The y coordinate |
| foreground | The foreground color |
Reimplemented from MaxOS::console::Console.
Definition at line 176 of file framebuffer.cpp.
References height(), and width().
Referenced by scroll_up().
|
static |
Updates the progress bar.
| percentage | The percentage to update the progress bar to (0-100) |
Definition at line 392 of file framebuffer.cpp.
References MaxOS::common::GraphicsContext::colour_to_int(), multiboot_tag_framebuffer::common, multiboot_tag_framebuffer_common::framebuffer_bpp, multiboot_tag_framebuffer_common::framebuffer_height, multiboot_tag_framebuffer_common::framebuffer_width, LOGO_HEIGHT, and LOGO_WIDTH.
Referenced by print_logo(), and MaxOS::Logger::set_log_level().
|
finalvirtual |
Gets the width of the console.
Reimplemented from MaxOS::console::Console.
Definition at line 71 of file framebuffer.cpp.
References multiboot_tag_framebuffer::common, MaxOS::console::FONT_WIDTH, and multiboot_tag_framebuffer_common::framebuffer_width.
Referenced by FramebufferConsole(), get_background_color(), get_character(), get_foreground_color(), put_character(), scroll_up(), set_background_color(), and set_foreground_color().
| ConsoleStream* MaxOS::console::FramebufferConsole::cout |
The boot console output stream.
Definition at line 322 of file framebuffer.h.
Referenced by finish(), and FramebufferConsole().