Easy_Graphics is a simple library for generating graphical output from your Ada program.
Typical use cases might be educational projects, prototyping, programming challenges, or simply when you want to visualise something quickly in a larger system.
The logo on the right is created with just a few lines of code, see this program
The package is free to use, with no warranty, under the MIT license.
- Image output as portable PPM, PAM, and GIF files (other formats to follow)
- Images of any size using whatever (integer) coordinate ranges you like
- Simple set of graphics primitives provided
- Basic turtle graphics are supported
- Images are 24-bit colour + 8-bit alpha
- Basic (HTML/CSS) colours predefined as constants, as is TRANSPARENT
New_Image
create a new image ("canvas"), prefilled with a colour or transparentWrite_PPM
create "raw" or "plain" NetPBM PPM file from image, Alpha is ignoredWrite_GIF
create GIF file - only partially implemented at the momentWrite_PAM
create NetPBM PAM file from image, includes transparency. N.B. Convert to PNG withconvert img.pam img.png
or view directly withpqiv
HSV_To_RGB
convert colour values
Plot
a point on the imageSet_Alpha
changes the transparency of a pointFill
an entire image with a colourLine
draw a line between twoPoint
sRect
(filled or outline)Triangle
(filled or outline)Circle
(filled or outline)Char
draw a character using a simple built-in fontText
draw a string
New_Turtle
creates a virtual turtle for an imageHome
centres the turtleGo_To
a specific coordinatePen_Up
,Pen_Down
andPen_Color
Forward
,Back
Left
andRight
turn relative to the current headingTurn_To
turns to an absolute heading
There are several example programs using Easy_Graphics in the tests/src
directory.
The tests.adb file is intended to demonstrate all features
that are currently implemented.