PyAmanith is a Python wrapper for the Amanith 2D vector graphics library. It strives to offer a pythonic interface to the library and make all its features accessible.
The current release is 0.3.35, which requires Amanith 0.3. This version fixes a compilation error on GCC 4.x.
In order to compile the wrapper, you'll need to have at least version 1.3.29 of SWIG installed. The code generated by SWIG should work on most compilers, but for reference I've used GCC 4.0 and Microsoft Visual Studio .NET 2003 (VS 7.1).
Here's a short example that draws a red heart on a white background. It requires PyGame and PyOpenGL.
import amanith, pygame, sys, time
from OpenGL.GL import *
pygame.display.init()
pygame.display.set_mode((640, 480), pygame.OPENGL | pygame.DOUBLEBUF)
drawboard = amanith.GOpenGLBoard(0, 0, 640, 480)
keys = [
amanith.GKeyValue(0.0, (1.0, 0.0, 0.0, 1.0)),
amanith.GKeyValue(0.5, (1.0, 1.0, 1.0, 1.0)),
amanith.GKeyValue(1.0, (1.0, 0.0, 0.0, 1.0)),
]
grad = drawboard.CreateLinearGradient((360, 100), (320, 300), keys)
drawboard.SetFillEnabled(True)
drawboard.SetStrokeEnabled(True)
drawboard.SetStrokeWidth(8)
drawboard.Clear(1.0, 1.0, 1.0, True)
drawboard.SetFillPaintType(amanith.G_GRADIENT_PAINT_TYPE)
drawboard.SetFillGradient(grad)
drawboard.DrawPaths("M 320,360 c +250,+100 +250,-175 0,-300 c -250,+100 -250,+400 0,300 z")
pygame.display.flip()
time.sleep(10)