pix - 2D graphics libraryTop, Main, Index
Tcl/Tk wrapper around Pixie, a full-featured 2D graphics library written in 👑 Nim.
CompatibilityTop, Main, Index
Tcl/Tk 8.6 & 9.0
PlatformsTop, Main, Index
- MacOS (x64 / arm64)
- Windows x64
- Linux x64
Source distributions and binary packages can be downloaded here for the platforms mentioned above.
Note: I have mainly tested this package on Windows and MacOs x64 with version 8.6.16 and 9.0.1 of Tcl/Tk, it should work on Linux and MacOS arm (I hope so!)
ExampleTop, Main, Index
package require pix # Init 'context' with size + color. set ctx [pix::ctx::new {200 200} "white"] # Style first rectangle. pix::ctx::fillStyle $ctx "rgb(0, 0, 255)" ; # blue color pix::ctx::fillRect $ctx {10 10} {100 100} # Style second rectangle. pix::ctx::fillStyle $ctx "rgba(255, 0, 0, 0.5)" ; # red color with alpha 50% pix::ctx::fillRect $ctx {50 50} {100 100} # Save context in a image file (*.png|*.bmp|*.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.
DocumentationTop, Main, Index
A large part of the pix documentation comes from the Pixie API and source files.
APITop, Main, Index
Currently API tested and supported are :
| This namespace provides a 2D API commonly used on the web. | |
| This namespace allows you to write text, load fonts. | |
| Crop, resize, blur image and much more. | |
| This namespace plays with colors. | |
| Vector Paths. | |
| Parse, render SVG (namespace pretty limited) |
Acknowledgement:Top, Main, Index
- tclstubs-nimble (MIT)
- Pixie (MIT)
LicenseTop, Main, Index
MIT License Copyright (c) 2024-2025 Nicolas ROBERT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Other Copyrights ================ Portions of code are inspired, derived or copied from code covered by the following copyright: Pixie: MIT License (MIT) ----------------------------------- Copyright (c) 2020 Andre von Houck and Ryan Oldenburg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. tclstubs-nimble: MIT License (MIT) ----------------------------------- Copyright (c) 2021 Mark Janssen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.