/slint-painter-example-skia

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

Primary LanguageRustMIT LicenseMIT

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