//! # Pinnacle //! //! An app has one window, its whole area of the screen, which the display //! server sizes (and sizes again when the screen turns). Until a GPU draws //! into it, an app draws its pixels itself and says which rectangle changed. use crate::window::Window; /// The window's pixels, drawn into directly. pub trait WindowExtPinnacle { /// Runs `f` on the window's pixels (0xAARRGGBB, row by row) with its /// width and height. fn with_pixels(&self, f: impl FnOnce(&mut [u32], u32, u32) -> R) -> R; /// Tells the display server a rectangle of the pixels changed: it shows /// it. fn present(&self, x: i32, y: i32, width: i32, height: i32); } impl WindowExtPinnacle for Window { fn with_pixels(&self, f: impl FnOnce(&mut [u32], u32, u32) -> R) -> R { self.window.with_pixels(f) } fn present(&self, x: i32, y: i32, width: i32, height: i32) { self.window.present(x, y, width, height) } }