Alternating white and black stripes

This commit is contained in:
2025-05-04 20:24:39 -07:00
parent cbe54334ca
commit 0fc5d523bf
2 changed files with 10 additions and 7 deletions

View File

@@ -19,12 +19,12 @@ impl WlClient {
self.wl_compositor_create_surface()?;
self.layer_shell_get_layer_surface()?;
self.layer_surface_set_size(800, 800)?;
self.layer_surface_set_size(18, 5)?;
self.layer_surface_set_keyboard_interactivity()?;
self.wl_surface_commit()?;
self.wl_shm_create_pool(800, 800)?;
self.wl_shm_pool_create_buffer(0, 800, 800)?;
self.wl_shm_create_pool(18, 5)?;
self.wl_shm_pool_create_buffer(0, 18, 5)?;
Ok(())
}

View File

@@ -12,10 +12,13 @@ impl WlClient {
pub fn wl_shm_create_pool(&mut self, width: usize, height: usize) -> Result<(), Box<dyn Error>> {
self.current_id += 1;
self.shm_pool = Some(shm::ShmPool::new(width, height, self.current_id)?);
self.shm_pool.as_mut().unwrap().write(&vec![0xffff0000; width * height], 0);
self.shm_pool.as_mut().unwrap().rectangle(50, 50, 50, 50, 0xff00ff00);
self.shm_pool.as_mut().unwrap().circle(300, 300, 200, 0xff0000ff);
self.shm_pool.as_mut().unwrap().rounded_rectangle(450, 400, 60, 40, 16, 0xffffff00);
let mut grid: Vec<u32> = vec![0xffffffff; width * height];
for (pos, color) in grid.iter_mut().enumerate() {
if (pos & 1) == 0 {
*color = 0xff000000;
}
}
self.shm_pool.as_mut().unwrap().write(&grid, 0);
let object = self.shm_id.ok_or(UnsetErr("shm_id".to_string()))?;
const OPCODE: u16 = 0;