pix : 2D graphics library

What pix
Where https://github.com/nico-robert/pix
Description Tcl/Tk wrapper around Pixie , a full-featured 2D graphics library written in Nim.
Current Release 0.1
License MIT License

https://i.ibb.co/4NTjMzK/pix.png

  • This package requires Tcl/Tk 8.6 (Only tested with Tcl/Tk 8.6.14).
  • Platforms : MacOS 14.4 x64 or Windows 10 (Linux should work, but I don't have a system to test it on.)

Example :

package require pix

# Init 'context' with size + color.
set ctx [pix::ctx::new {200 200} "white"]

# Style first rectangle.
pix::ctx::fillStyle $ctx "rgba(0, 0, 255, 0.5)" ; # blue
pix::ctx::fillRect $ctx {10 10} {100 100}

# Style second rectangle.
pix::ctx::fillStyle $ctx "rgba(255, 0, 0, 0.5)" ; # red
pix::ctx::fillRect $ctx {50 50} {100 100}

# Save context in a file (*.png|*.bmp|*.jpeg|*.qoi|*.ppm)
pix::ctx::writeFile $ctx rectangle.png

# Or display in label by example
set p [image create photo]
pix::drawSurface $ctx $p
label .l -image $p ; pack .l

See examples folder for more demos.

  • Currently options tested and supported are :
Options. Done.
context Yes.
font Partially
image Partially
paint No.
paths No.
svg. Partially

Inspiration : tclstubs-nimble