Skip to main content

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


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 details)

Uploaded Source

Built Distribution

lpdraw-0.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file lpdraw-0.0.1.tar.gz.

File metadata

  • Download URL: lpdraw-0.0.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

Hashes for lpdraw-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e2f8a7e0f3004a31652c6362263ba950d16309d70798a8d4a9e131276c0f2f3c
MD5 48226c05fa938d83177597a4fc177e2b
BLAKE2b-256 67662eaa5f6ac785d024da3cbfa6ad39ae90c7c06a80c7d9268484c1d84ee1a1

See more details on using hashes here.

File details

Details for the file lpdraw-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: lpdraw-0.0.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

Hashes for lpdraw-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 212f9bbfced547a2c147437f2ac6eae81e0ab452692842b16b474d1da976899e
MD5 226b6317cad3c9795f326828664b545b
BLAKE2b-256 0d1b2c9cd1b4c1a4b5ab20aecb86cd8027c03aa205418748aa0593a5365756ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page