Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smerrony/easy_graphics
Easy_Graphics is a simple library for generating graphical output from your Ada program
https://github.com/smerrony/easy_graphics
ada alire gif graphics ppm turtle-graphics
Last synced: about 1 month ago
JSON representation
Easy_Graphics is a simple library for generating graphical output from your Ada program
- Host: GitHub
- URL: https://github.com/smerrony/easy_graphics
- Owner: SMerrony
- Created: 2024-07-03T19:22:14.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-08T12:16:34.000Z (5 months ago)
- Last Synced: 2024-08-08T14:27:49.180Z (5 months ago)
- Topics: ada, alire, gif, graphics, ppm, turtle-graphics
- Language: Ada
- Homepage:
- Size: 447 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Easy_Graphics Package
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.
## Main Features
* 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### Utility Subprograms
* `New_Image` create a new image ("canvas"), prefilled with a colour or transparent
* `Write_PPM` create "raw" or "plain" NetPBM PPM file from image, Alpha is ignored
* `Write_GIF` create GIF file - only partially implemented at the moment
* `Write_PAM` create NetPBM PAM file from image, includes transparency. N.B. Convert to PNG with `convert img.pam img.png` or view directly with `pqiv`
* `HSV_To_RGB` convert colour values### Drawing Primitives
* `Plot` a point on the image
* `Set_Alpha` changes the transparency of a point
* `Fill` an entire image with a colour
* `Line` draw a line between two `Point`s
* `Rect` (filled or outline)
* `Triangle` (filled or outline)
* `Circle` (filled or outline)
* `Char` draw a character using a simple built-in font
* `Text` draw a string### Turtle Graphics
* `New_Turtle` creates a virtual turtle for an image
* `Home` centres the turtle
* `Go_To` a specific coordinate
* `Pen_Up`, `Pen_Down` and `Pen_Color`
* `Forward`, `Back`
* `Left` and `Right` turn relative to the current heading
* `Turn_To` turns to an absolute heading### Example Code
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.