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 lptypes 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.tar.gz
(3.9 kB
view hashes)
Built Distribution
lpdraw-0.0.1-py3-none-any.whl
(3.7 kB
view hashes)