Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::drivers::video::VideoDriver Class Reference

Driver for the video controller, handles the setting of the video mode. More...

#include <video.h>

Inheritance diagram for MaxOS::drivers::video::VideoDriver:
MaxOS::drivers::Driver MaxOS::common::GraphicsContext MaxOS::drivers::video::VideoElectronicsStandardsAssociation MaxOS::drivers::video::VideoGraphicsArray

Public Member Functions

virtual bool supports_mode (uint32_t width, uint32_t height, uint32_t color_depth)
 Check if the video driver supports a certain mode.
 
bool set_mode (uint32_t width, uint32_t height, uint32_t color_depth)
 Set the mode of the video driver.
 
- Public Member Functions inherited from MaxOS::drivers::Driver
virtual void activate ()
 Activate the driver.
 
virtual void deactivate ()
 Deactivate the driver.
 
virtual void initialise ()
 Initialise the driver.
 
virtual uint32_t reset ()
 Reset the driver.
 
virtual string vendor_name ()
 Get who created the device.
 
virtual string device_name ()
 Get the device name of the driver.
 
- Public Member Functions inherited from MaxOS::common::GraphicsContext
 GraphicsContext ()
 Constructs a GraphicsContext object and initializes the color palette.
 
uint32_t colour_to_int (const Colour &)
 Converts a colour to an integer value based on the current color depth.
 
Colour int_to_colour (uint32_t)
 Converts an integer value to a colour based on the current color depth.
 
uint32_t width () const
 Gets the width of the screen.
 
uint32_t height () const
 Gets the height of the screen.
 
uint32_t color_depth () const
 Gets the current color depth (bits per pixel)
 
uint64_tframebuffer_address ()
 Gets the address of the context's framebuffer to draw on.
 
void put_pixel (uint32_t x, uint32_t y, const Colour &colour)
 Renders a pixel to the screen (automatically converts the colour to an integer)
 
void put_pixel (uint32_t x, uint32_t y, uint32_t colour)
 Renders a pixel to the screen (automatically converts the colour to an integer), will not render the pixel if it is outside the screen.
 
Colour get_pixel (uint32_t x, uint32_t y)
 Gets the colour of a pixel, or returns black if the pixel is outside the screen.
 
void invert_pixel (uint32_t x, uint32_t y)
 Inverts a pixel.
 
void draw_line (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, const Colour &colour)
 Draws a line on the screen.
 
void draw_line (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t colour)
 Draws a line on the screen.
 
void draw_rectangle (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, const Colour &colour)
 Draws a rectangle on the screen.
 
void draw_rectangle (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t colour)
 Draws a rectangle on the screen.
 
void fill_rectangle (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, const Colour &colour)
 Draws a rectangle on the screen, filled with a colour.
 
void fill_rectangle (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t colour)
 Draws a rectangle on the screen, filled with a colour.
 
void draw_circle (uint32_t x0, uint32_t y0, uint32_t radius, const Colour &colour)
 Draws a circle on the screen.
 
void draw_circle (uint32_t x0, uint32_t y0, uint32_t radius, uint32_t colour)
 Draws a circle on the screen.
 
void fill_circle (uint32_t x0, uint32_t y0, uint32_t radius, const Colour &colour)
 Draws a circle on the screen, filled with a colour.
 
void fill_circle (uint32_t x0, uint32_t y0, uint32_t radius, uint32_t colour)
 Draws a circle on the screen, filled with a colour.
 

Protected Member Functions

virtual bool internal_set_mode (uint32_t width, uint32_t height, uint32_t color_depth)
 Set the mode of the video driver.
 
- Protected Member Functions inherited from MaxOS::common::GraphicsContext
virtual void render_pixel (uint32_t x, uint32_t y, uint32_t colour)
 Renders a pixel to the screen based on the current color depth.
 
virtual void render_pixel_8_bit (uint32_t x, uint32_t y, uint8_t colour)
 Renders a pixel to the screen using the 8 bit color depth.
 
virtual void render_pixel_16_bit (uint32_t x, uint32_t y, uint16_t colour)
 Renders a pixel to the screen using the 16 bit color depth.
 
virtual void render_pixel_24_bit (uint32_t x, uint32_t y, uint32_t colour)
 Renders a pixel to the screen using the 24 bit color depth.
 
virtual void render_pixel_32_bit (uint32_t x, uint32_t y, uint32_t colour)
 Renders a pixel to the screen using the 32 bit color depth.
 
virtual uint32_t get_rendered_pixel (uint32_t x, uint32_t y)
 Gets the colour of a pixel on the screen, automatically uses the correct color depth.
 
virtual uint8_t get_rendered_pixel_8_bit (uint32_t x, uint32_t y)
 Gets the colour of a pixel on the screen using the 8 bit color depth.
 
virtual uint16_t get_rendered_pixel_16_bit (uint32_t x, uint32_t y)
 Gets the colour of a pixel on the screen using the 16 bit color depth.
 
virtual uint32_t get_rendered_pixel_24_bit (uint32_t x, uint32_t y)
 Gets the colour of a pixel on the screen using the 24 bit color depth.
 
virtual uint32_t get_rendered_pixel_32_bit (uint32_t x, uint32_t y)
 Gets the colour of a pixel on the screen using the 32 bit color depth.
 

Additional Inherited Members

- Protected Attributes inherited from MaxOS::common::GraphicsContext
bool mirror_y_axis
 Should the y axis be mirrored (0,0 is top left if false, bottom left if true)
 
uint32_t m_width { 0 }
 The width of the screen in pixels.
 
uint32_t m_height { 0 }
 The height of the screen in pixels.
 
uint32_t m_color_depth { 0 }
 The color depth of the screen in bits per pixel.
 
Colour m_colour_pallet [256]
 The colour pallet for 8 bit color depth.
 
uint64_tm_framebuffer_address { nullptr }
 The address of the framebuffer.
 

Detailed Description

Driver for the video controller, handles the setting of the video mode.

Definition at line 26 of file video.h.

Member Function Documentation

◆ internal_set_mode()

bool VideoDriver::internal_set_mode ( uint32_t  width,
uint32_t  height,
uint32_t  color_depth 
)
protectedvirtual

Set the mode of the video driver.

Parameters
widthThe width of the screen
heightThe height of the screen
color_depthThe color depth of the screen
Returns
true If the mode was set successfully false otherwise

Definition at line 29 of file video.cpp.

29 {
30 return false;
31}

Referenced by set_mode().

◆ set_mode()

bool VideoDriver::set_mode ( uint32_t  width,
uint32_t  height,
uint32_t  color_depth 
)

Set the mode of the video driver.

Parameters
widthThe width of the screen
heightThe height of the screen
color_depthThe color depth of the screen
Returns
true If the mode was set successfully (and the screen was updated) false otherwise

Definition at line 53 of file video.cpp.

53 {
54
55 // Cant set it if not supported
57 return false;
58
59 // Try set the mode
61 return false;
62
63 // Store the mode
64 m_width = width;
67 return true;
68}
uint32_t m_color_depth
The color depth of the screen in bits per pixel.
uint32_t width() const
Gets the width of the screen.
uint32_t height() const
Gets the height of the screen.
uint32_t m_width
The width of the screen in pixels.
uint32_t color_depth() const
Gets the current color depth (bits per pixel)
uint32_t m_height
The height of the screen in pixels.
virtual bool internal_set_mode(uint32_t width, uint32_t height, uint32_t color_depth)
Set the mode of the video driver.
Definition video.cpp:29
virtual bool supports_mode(uint32_t width, uint32_t height, uint32_t color_depth)
Check if the video driver supports a certain mode.
Definition video.cpp:41

References MaxOS::common::GraphicsContext::color_depth(), MaxOS::common::GraphicsContext::height(), internal_set_mode(), MaxOS::common::GraphicsContext::m_color_depth, MaxOS::common::GraphicsContext::m_height, MaxOS::common::GraphicsContext::m_width, supports_mode(), and MaxOS::common::GraphicsContext::width().

Referenced by MaxOS::drivers::video::VideoElectronicsStandardsAssociation::VideoElectronicsStandardsAssociation().

◆ supports_mode()

bool VideoDriver::supports_mode ( uint32_t  width,
uint32_t  height,
uint32_t  color_depth 
)
virtual

Check if the video driver supports a certain mode.

Parameters
widthThe width of the screen
heightThe height of the screen
color_depthThe color depth of the screen
Returns
true If the mode is supported, false otherwise

Reimplemented in MaxOS::drivers::video::VideoGraphicsArray, and MaxOS::drivers::video::VideoElectronicsStandardsAssociation.

Definition at line 41 of file video.cpp.

41 {
42 return false;
43}

Referenced by set_mode().


The documentation for this class was generated from the following files: