The paint module provides a simple and flexible facility for painting PNG images files. The paint module depends upon three free libraries;
FreeType | This library provides an advanced TrueType font renderer, which means the paint module produces high quality text. |
libart | The libart graphics library provides a PostScript like 2-D rendering model with alpha transparency. |
libpng | Allows the images produced in the paint module to be saved as PNG files. |
import paint image = paint.image(100, 80) image.stroke(paint.line(10, 10, 90, 70).dash(0, (10, 5)), paint.rgb(0xff,0,0), 10) rect = paint.rect(20, 10, 70, 50) image.fill(rect, paint.rgb(0xff,0xff,0)) image.stroke(rect, paint.rgb(0,0xff,0), 5) image.stroke(paint.arc(10, 20, 60, 70, 270, 180), paint.rgba(0,0,0xff,0x40), 5) arial = paint.font('/dosc/windows/fonts/arial.ttf', 24, 30) image.text(arial, 15, 70, paint.rgb(0,0,0), 'Hooray') image.write_png("intro.png") |
Produces this image | ![]() |
Step by step, the program does the following