[][src]Struct sunrise_libuser::window::Window

pub struct Window {
    buf: MappedSharedMemory,
    handle: IBufferProxy,
    width: usize,
    height: usize,
    bpp: usize,
}

A managed window.

Fields

buf: MappedSharedMemory

The framebuffer memory shared with Vi. Drawing to this buffer will take effect on the next call to IBufferProxy::draw.

handle: IBufferProxy

Vi handle for this window.

width: usize

Width of the window.

height: usize

Height of the window.

bpp: usize

Bits per pixel for the framebuffer.

Implementations

impl Window[src]

pub fn new(
    top: i32,
    left: i32,
    width: u32,
    height: u32
) -> Result<Window, Error>
[src]

Creates a window in the vi compositor.

pub fn draw(&mut self) -> Result<(), Error>[src]

Ask the compositor to redraw the window.

pub fn width(&self) -> usize[src]

window width in pixels. Does not account for bpp

pub fn height(&self) -> usize[src]

window height in pixels. Does not account for bpp

pub fn bpp(&self) -> usize[src]

The number of bits that forms a pixel. Used to compute offsets in window memory to corresponding pixel px_offset = px_nbr * bpp

pub fn get_px_offset(&self, x: usize, y: usize) -> usize[src]

Gets the offset in memory of a pixel based on an x and y.

Panics

Panics if y >= self.height() or x >= self.width()

pub fn write_px(&mut self, offset: usize, color: Color)[src]

Writes a pixel in the window respecting the bgr pattern

Panics

Panics if offset is invalid

pub fn write_px_at(&mut self, x: usize, y: usize, color: Color)[src]

Writes a pixel in the window respecting the bgr pattern Computes the offset in the window from x and y.

Panics

Panics if coords are invalid

pub fn get_buffer(&mut self) -> &[AtomicU32][src]

Gets the underlying framebuffer

pub fn clear(&mut self)[src]

Clears the whole window, making it black.

Trait Implementations

impl Debug for Window[src]

Auto Trait Implementations

impl RefUnwindSafe for Window

impl Send for Window

impl Sync for Window

impl Unpin for Window

impl UnwindSafe for Window

Blanket Implementations

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

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

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

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

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

impl<T> SizedIPCBuffer for T[src]

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.

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.