Python wrapper for Aldrin 2D Computer Graphics Library in C.
Visit Aldrin to C source code repository.
Visit Playground to try online.
- Clone the repo.
$ git clone https://github.com/orhanemree/aldrin.py.git
$ cd aldrin.py- Import
Aldrinclass fromaldrin.pymodule in your code.
from aldrin import Aldrin # that's it!from aldrin import Aldrin
width = 160
height = 90
pixels = [0] * (width*height)
aldrin = Aldrin(pixels, width, height)
def main():
aldrin.fill(0xff00ff)
aldrin.save_ppm("img/hello_world.ppm")
if __name__ == "__main__":
main()Output should look something like this:
Note that: aldrin.save_ppm() function generates .ppm output (see /img/hello_world.ppm). The output converted to .png format to be displayed here.
- This repo and Quick Start is up to date and ready to use. But if you want to build shared library yourself go source code repo, download
src/aldrin.cand run:
# for Unix-like
$ gcc -shared -o bin/aldrin.so src/aldrin.c
# for Windows
$ gcc -shared -o bin/aldrin.dll src/aldrin.c- See
/examples.
$ cd test
$ python main.py- Get more info:
$ python main.py help- See
Documentationto read docs and run examples live. - Important: Documentation is for C actually. But since this Python version uses Aldrin with class structure function names are slightly different. For example:
aldrin_fill()in C isaldrin.fill()in Python wrapper. You can understand better if you compare examples in this repo and in the source code repo. The equivalent of each example is mentiones in the first line of the example.
- Licensed under the MIT License.

