Function dos_like::video::screen_buffer

source ·
pub unsafe fn screen_buffer() -> &'static mut [u8] 
Expand description

Gets a mutable slice of the current screen buffer.

Only makes sense in graphics mode. The length of the slice is equal to the number of pixels on the screen.

Safety

It is not guaranteed by the compiler that the access to the screen buffer is exclusive. Calling any function in this module that draws anything to the screen during the returned slice’s lifetime is undefined behavior. It is also undefined behavior to call this function multiple times without dropping the previous slices first.

However, if double buffering is enabled (via set_double_buffer), then it is safe to call swap_buffers or swap_buffers_and_get and immediately drop this slice in favor of the new buffer slice.