Struct vga::writers::Graphics640x480x16[][src]

pub struct Graphics640x480x16;
Expand description

A basic interface for interacting with vga graphics mode 640x480x16

Examples

Basic usage:

use vga::colors::Color16;
use vga::writers::{Graphics640x480x16, GraphicsWriter};
let mode = Graphics640x480x16::new();
mode.set_mode();
mode.clear_screen(Color16::Black);
mode.draw_line((80, 60), (80, 420), Color16::White);
mode.draw_line((80, 60), (540, 60), Color16::White);
mode.draw_line((80, 420), (540, 420), Color16::White);
mode.draw_line((540, 420), (540, 60), Color16::White);
mode.draw_line((80, 90), (540, 90), Color16::White);
for (offset, character) in "Hello World!".chars().enumerate() {
    mode.draw_character(270 + offset * 8, 72, character, Color16::White)
}

Implementations

impl Graphics640x480x16[src]

pub const fn new() -> Graphics640x480x16[src]

Creates a new Graphics640x480x16.

Trait Implementations

impl Clone for Graphics640x480x16[src]

fn clone(&self) -> Graphics640x480x16[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Graphics640x480x16[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Graphics640x480x16[src]

fn default() -> Graphics640x480x16[src]

Returns the “default value” for a type. Read more

impl GraphicsWriter<Color16> for Graphics640x480x16[src]

fn set_pixel(&self, x: usize, y: usize, color: Color16)[src]

Note: This method is provided for convenience, but has terrible performance since it needs to ensure the correct WriteMode per pixel drawn. If you need to draw more then one pixel, consider using a method such as draw_line.

fn clear_screen(&self, color: Color16)[src]

Clears the screen by setting all pixels to the specified color.

fn draw_line(&self, start: Point<isize>, end: Point<isize>, color: Color16)[src]

Draws a line from start to end with the specified color.

fn draw_character(&self, x: usize, y: usize, character: char, color: Color16)[src]

Draws a character at the given (x, y) coordinant to the specified color.

fn set_mode(&self)[src]

Sets the graphics device to a VideoMode.

fn get_frame_buffer(&self) -> *mut u8[src]

Returns the frame buffer for this vga mode.

impl Screen for Graphics640x480x16[src]

const WIDTH: usize[src]

The width of the Screen.

const HEIGHT: usize[src]

The height of the Screen.

const SIZE: usize[src]

The size (total area) of the Screen.

impl Copy for Graphics640x480x16[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.