tfachmann / slint-painter-example-skia

Example to paint on a screen with the Slint GUI using (tiny) Skia.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slint Painter Example (Skia)

This repository is a little case-study to implement a painter (canvas) with the Slint GUI Toolkit. The drawn objects are not selectable or changeable, as this approach draws the paths directly to an image buffer via tiny-skia. This is my first contact working with Slint.

Features:

  • πŸ”§ different brushes: Freehand, Line, Rectangle, Ellipse
  • πŸ’‘ path preview
  • πŸ“ change brush size
  • 🎨 change brush color (not in GUI - color picker missing)
  • πŸ”„ undo and redo all operations

Annoyances:

  • πŸ’₯ fixed dimensions (at creation time)
  • πŸ’₯ touch area and displayed paths differ when the window is resized
  • πŸ’₯ no operations on individually drawn objects
  • πŸ’₯ tiny-skia engine may be slow in the path preview
  • πŸ’₯ unclear how to create a reusable slint component out of that πŸ˜•

Running

Simply use cargo to run this example

cargo run --release

Preview

screenshot-2024-02-07-130452

About

Example to paint on a screen with the Slint GUI using (tiny) Skia.

License:MIT License


Languages

Language:Rust 100.0%