···4343 // _always_ be called, but is left to the application to decide when
4444 try vx.queryTerminal();
45454646- var img = try vaxis.Image.init(alloc, .{ .path = "vaxis.png" }, 1, .kitty);
4747- defer img.deinit();
4646+ const img = try vx.loadImage(alloc, .{ .path = "vaxis.png" });
4747+4848+ var n: usize = 0;
48494950 // The main event loop. Vaxis provides a thread safe, blocking, buffered
5051 // queue which can serve as the primary event queue for an application
···5657 // enum has the fields for those events (ie "key_press", "winsize")
5758 switch (event) {
5859 .key_press => |key| {
6060+ n += 1;
5961 if (key.matches('c', .{ .ctrl = true })) {
6062 break :outer;
6163 } else if (key.matches('l', .{ .ctrl = true })) {
···7981 // the old and only updated cells will be drawn
8082 win.clear();
81838282- try img.draw(win);
8484+ const child = win.initChild(n, n, .expand, .expand);
8585+8686+ img.draw(child, false, 0);
83878488 // Render the screen
8589 try vx.render();
···6969 self.screen.writeCell(col + self.x_off, row + self.y_off, cell);
7070}
71717272-/// writes an image to the location in the window
7373-pub fn writeImage(
7474- self: Window,
7575- img: Image,
7676- placement_id: u32,
7777-) !void {
7878- if (self.height == 0 or self.width == 0) return;
7979- try self.screen.writeImage(self.x_off, self.y_off, img, placement_id);
8080-}
8181-8272/// fills the window with the default cell
8373pub fn clear(self: Window) void {
8474 self.fill(.{});
8585- // we clear any image with it's first cell within this window
8686- for (self.screen.images.items, 0..) |p, i| {
8787- if (p.col >= self.x_off and p.col < self.width and
8888- p.row >= self.y_off and p.row < self.height)
8989- {
9090- _ = self.screen.images.swapRemove(i);
9191- }
9292- }
9375}
94769577/// returns the width of the grapheme. This depends on the terminal capabilities