# Seizer: Wayland application framework

**URL:** <https://ziggit.dev/t/seizer-wayland-application-framework/6788>\
**Category:** Showcase\
**Created:** [November 10, 2024, 7:13am UTC](https://ziggit.dev/t/seizer-wayland-application-framework/6788 "2024-11-10T07:13:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![geemili](https://ziggit.dev/user_avatar/ziggit.dev/geemili/32/1277_2.png) [@geemili](https://ziggit.dev/u/geemili)\
**Post date:** [November 10, 2024, 7:13am UTC](https://ziggit.dev/t/seizer-wayland-application-framework/6788/1 "2024-11-10T07:13:52Z")

</div>

> **[seizer](https://codeberg.org/klaji/seizer)**
>
> Wayland application framework

Hi all, posting `seizer` here for its `v0.2.0` release. It’s changed a lot since its initial conception, especially recently. However, what is the list of features as of now, copied from the README:

- Wayland native (using the [`shimizu`](https://git.sr.ht/~geemili/shimizu) module)
- Handles setting up a [`libxev`](https://github.com/mitchellh/libxev) event loop
- [`color`](https://codeberg.org/klaji/seizer/src/branch/main/src/color.zig) module for sRGB gamma encoding and decoding
- 2d Canvas API, targeting realtime rendering:
  - [`fillRect`](https://codeberg.org/klaji/seizer/src/branch/main/examples/fill_rect.zig)
  - [`textureRect`](https://codeberg.org/klaji/seizer/src/branch/main/examples/texture_rect.zig)
  - [`line`](https://codeberg.org/klaji/seizer/src/branch/main/examples/canvas.zig)

- A `ui` module exposing some high level elements:
  - basic types: `ui.Element.Label`, `ui.Element.Button`, `ui.Element.TextField`, `ui.Element.Image`
  - containers: `ui.Element.FlexBox`, `ui.Element.Frame`
  - [`ui.Element.PanZoom`: a container that let’s users closely inspect the contents](https://codeberg.org/klaji/seizer/src/branch/main/examples/ui_view_image.zig)
  - [`ui.Element.Plot` for simple line plots](https://codeberg.org/klaji/seizer/src/branch/main/examples/ui_plot_sine.zig)

---

<div class="post-metadata">

**Author:** ![geemili](https://ziggit.dev/user_avatar/ziggit.dev/geemili/32/1277_2.png) [@geemili](https://ziggit.dev/u/geemili)\
**Post date:** [November 17, 2024, 1:38am UTC](https://ziggit.dev/t/seizer-wayland-application-framework/6788/2 "2024-11-17T01:38:01Z")

</div>

`seizer` 0.3.0 is released:

> **[seizer/CHANGELOG.md at 0.3.0](https://codeberg.org/klaji/seizer/src/tag/0.3.0/CHANGELOG.md)**
>
> seizer - Wayland application framework

Thanks to @desttinghim for helping with some of the development.

There have been a lot of changes, but I want to highlight the new `seizer.tvg.Flattened` struct. It supports parsing (some) [TinyVG files](https://tinyvg.tech/), which it converts into a list of `Canvas` draw commands. Previously `seizer` had some support for `tvg` files, but it relied on the TinyVG sdk to rasterize to a bitmap image. `seizer.tvg.Flattened` make drawing `tvg` files more efficient and elegant.

Here’s a screenshot of `seizer.tvg.Flattened` rendering a cursor in an unreleased project, `seizer-solitaire`:

 ![seizer-solitaire_tvg-cursor](https://ziggit.dev/uploads/default/original/2X/a/a49c0b11abcf51538b337b6f2a45ef9d652b4b3a.png)

* * *

By the way, @desttinghim and I are currently looking for programming jobs. If you know of any, we would be happy to hear from you. Otherwise, if you want to help the `seizer` project continue, consider donating at polar.sh/klaji:

> **[klaji on Polar](https://polar.sh/klaji)**
>
> klaji on Polar

---

<div class="post-metadata">

**Author:** ![andrewrk](https://ziggit.dev/user_avatar/ziggit.dev/andrewrk/32/7011_2.png) [@andrewrk](https://ziggit.dev/u/andrewrk)\
**Post date:** [November 17, 2024, 8:09am UTC](https://ziggit.dev/t/seizer-wayland-application-framework/6788/3 "2024-11-17T08:09:21Z")

</div>

You’ve arrived at quite a tasteful featureset.

> - Running statically linked binaries on Linux gives me _dopamine_.

Indeed… I’m suddenly starting to feel motivated to make little GUI utilities for myself and others since they can be easily distributed and kept around for the future with no hassle.

---

<div class="post-metadata">

**Author:** ![desttinghim](https://ziggit.dev/user_avatar/ziggit.dev/desttinghim/32/70_2.png) [@desttinghim](https://ziggit.dev/u/desttinghim)\
**Post date:** [November 27, 2024, 12:51am UTC](https://ziggit.dev/t/seizer-wayland-application-framework/6788/4 "2024-11-27T00:51:15Z")

</div>

I’ve been working on improving the fill triangle command in seizer:

 ![Incremental triangle filling](https://ziggit.dev/uploads/default/original/2X/1/16b7eff1a61aca12e077287106f739d1d49bf555.png)  
 ![Incremental triangle (large) filling](https://ziggit.dev/uploads/default/original/2X/3/3742046ab2cb67faa3d16d5e75ce265788403398.png)  
 ![Incremental triangle MSAA](https://ziggit.dev/uploads/default/original/2X/d/dace1ca0b606cd63dd5a17537f618d5b1330b305.png)  
 ![Incremental triangle (large) MSAA](https://ziggit.dev/uploads/default/original/2X/e/ec45feae4f4931bfeeb54655ae649231aadd42cc.png)

The first change I’m working on is increasing the performance. The initial implementation of filling triangles in seizer calculates the 3 edge functions that make up a triangle at every point within the triangles bounding box. This very slow! To speed this up, seizer now calculates what the delta value of the edge functions is. Because edge functions are linear, we can just add these delta values at every step in the bounding box rather than doing the full calculation. This dropped the time per frame for the “triangle filling” images from 137ms to 24ms. For the “triangle (large)” image, the difference was 91ms to 15 ms.

The second feature I was working on is anti-aliasing. If you look at the first set of images, you should see jagged pixels on the edge of each triangle (assuming the images weren’t resized 😅). This can be okay if you’re looking to make a video game with a retro aesthetic, but usually this tends to look somewhat jarring. To avoid the jaggedness, I implemented a technique known as Multi Sampling Anti-Aliasing, or MSAA. Instead of checking just the center of each pixel to determine if the pixel is “covered” by the triangle, MSAA checks four different spots inside each pixel and determines if they are covered. The result is then averaged and the color multiplied by that average (NOTE: this only works because seizer stores pixels in linear sRGB color space with premultiplied alpha). The second set of images should show this, again assuming they weren’t resized.

Of course, doing all that extra work does have a cost. The frame time for the first image jumps from 24ms to 84ms, and the frame time for the second image jumps from 15ms to 55ms. Still faster than the naive approach!
