[−][src]Struct sunrise_libuser::window::Window
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]
top: i32,
left: i32,
width: u32,
height: u32
) -> Result<Window, Error>
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]
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SizedIPCBuffer for T
[src]
fn size(&Self) -> usize
[src]
fn is_cool(usize, usize) -> bool
[src]
unsafe fn from_raw_parts<'a>(usize, usize) -> &'a T
[src]
unsafe fn from_raw_parts_mut<'a>(usize, usize) -> &'a mut T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,