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.2
License MIT License

https://i.ibb.co/XWb02qd/pix.png

Compatibility :

  • Tcl/Tk 8.6 (Only tested with Tcl/Tk 8.6.14).

Platforms :

  • MacOS 14 x64
  • Windows 10
  • Linux x64

Source distributions and binary packages can be downloaded here .

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 documentation examples for more demos.

Documentation :

A large part of the pix documentation comes from the Pixie API and source files.


Currently API tested and supported are :

API
context This namespace provides a 2D API commonly used on the web.
font This namespace allows you to write text, load fonts.
image Crop, resize, blur image and much more.
paint This namespace plays with colors.
paths Vector paths.
svg Parse, render SVG (namespace pretty limited)

Inspiration Nim to Tcl C API :

tclstubs-nimble

Release :

03-Jun-2024 : 0.1

  • Initial release.

25-Jun-2024 : 0.2

  • Add font namespace + test file.
  • Add image namespace + test file.
  • Add paint namespace + test file.
  • Add path namespace + test file.
  • Add documentation based on Pixie API reference.
  • Add binary for Linux.
  • Code refactoring.