A simple python drawing package
Project description
lpdraw
This is a simple drawing package that contains Line and Circle Drawing Algorithms. This package can display the output on terminal as well as visually appealing grayscale image.
Usage
Example:
from lpdraw import Line, Circle, Clear, DisplayTerminal
from lpython import i32, Const
from numpy import empty, int32
def main():
Width: Const[i32] = 100 # x-axis limits [0, 99]
Height: Const[i32] = 40 # y-axis limits [0, 39]
Screen: i32[Height, Width] = empty((Height, Width), dtype=int32)
Clear(Height, Width, Screen)
Line(Height, Width, Screen, 2, 4, 99, 11)
Line(Height, Width, Screen, 0, 39, 49, 0)
Circle(Height, Width, Screen, 52, 20, 6.0)
DisplayTerminal(Height, Width, Screen)
main()
Output:
$ python main.py
+----------------------------------------------------------------------------------------------------+
|. |
| . |
| .. |
| . |
| . |
| . |
| .. |
| . |
| . |
| . |
| .. |
| . |
| . |
| . . |
| .. .. .. |
| . . . |
| . . . |
| . . . |
| .. . . |
| . . . |
| . . . |
| .. . . |
| . . . |
| . . . |
| . .. .. |
| .. . |
| . |
| . |
| . .......|
| .. .............. |
| . .............. |
| . .............. |
| .............. |
| .............. .. |
| .............. . |
| ....... . |
| . |
| .. |
| . |
| . |
+----------------------------------------------------------------------------------------------------+
You can also use the Display()
provided in this package to generate a grascale .pgm
image. You need to save the output produced on execution to a .pgm
file. For example,
python main.py > img.pgm
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lpdraw-0.0.1.1.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file lpdraw-0.0.1.1.tar.gz
.
File metadata
- Download URL: lpdraw-0.0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93db72706daf23f075e58e3db070ddf47633d46cc0a7dc8290549555821ccb36 |
|
MD5 | 8a60560eed7b25c165da19086430accb |
|
BLAKE2b-256 | bfa80a217f0c81cf8c756f87d2e726fdb76fe2e52c7204044cd9ea1890ca1b5c |
File details
Details for the file lpdraw-0.0.1.1-py3-none-any.whl
.
File metadata
- Download URL: lpdraw-0.0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98cd53abc77fae4cc06f92e906234095b0a600acb9a88af2d4645da98851c282 |
|
MD5 | a479ae50b90746719bd435f32f8e2640 |
|
BLAKE2b-256 | 4b7b8c6e41fa98ad7f6437f2db34b0d6409976d4cfe45a43746a4db3a82daa04 |